Generating weird cooking recipes with TensorFlow
github.com
github.com
But they don't fill the same niche. Cookbooks tend to do an excellent job teaching or introducing me to things I might not have otherwise cooked or searched for. The internet helps me when I have a specific ingredient I need to use up, if I am lowish on ingredients, or need something special that the cookbooks that I own simply don't offer. And sure, I could use cookbooks in a similar manner, but it isn't efficient and I don't always want to spend that sort of time.
Food in supermarkets is often terrible. The selection of cheeses, fresh fruit and veg, fish in mainstream supermarkets is dreadful compared to southern Europe (or even Germany). But restaurants in UK cities are generally excellent and eating out is relatively cheap.
This said I agree that many Brits don't know how to cook. Supermarkets sell a LOT of pre-made meals. People go out a lot. But there is certainly a reinassance of millennial foodies that not only like a good international restaurant, but are also into cooking.
Try the Waitrose. I'm Greek and the best supermarket taramosalata I've ever had is from Waitrose. To clarify home-made taramosalata is cream coloured, but taramosalata sold at supermarkets is always dyed bright pink, for some reason. And that includes Greek supermarkets. The only supermarket taramosalata I've ever seen that has the right colour is the Waitrose one- and it also has the right flavour and consistency. Well ish. Nothing can ever beat my yiayia's taramosalata, but it's a good approximation.
I assume their other "ethnic" foods are also of similar good quality (for mass-produced stuff). They also have sort of decent fruit and veg and their own brand of Duchy Organic farming produce (milk, eggs, meat, fish, etc) that is actually good.
Anyway my feelings are a little bit hurt when you say that you find it in posh neighbourhoods. I'm not posh! I'm just Greek and it seems, like you, I'm used to a highest standard in food quality.
I guess it's a huge privilege to have grown up with good quality food not just sufficient calories- and being able to eat good food a few times a year still. I freak out a bit when I think how much we can lose with climate change. But that's another discussion.
Anyway this is why I don't like to accuse the Brits of having a crap cuisine (or eating too much meat). They do, but that's because their (other) materials are not very good to begin with. If you think about it, the only stuff that grows locally are cabbage, turnips, potatoes and apples. You can only go so far with that.
I'm sure that's a major reason for all the problems this country has. Food is one of the biggest things in life, up there with companionship, sex, good wine and natural surroundings. If you don't get good food, there will always be something missing from your life.
Those damn socialists and their delicious recipes...! shakes fist
There are two sites: bbc.co.uk/food and bbcgoodfood.com
Here's a scone recipe from each:
https://www.bbc.co.uk/food/recipes/scones_1285
https://www.bbcgoodfood.com/recipes/classic-scones-jam-clott...
bbc.co.uk is owned and operated by Our Glorious Comrades the BBC.
bbcgoodfood.com is owned and operated by the running dogs of capitalism - Immediate Media, who are owned by Hubert Burda Media Holding.
Current Conservative government is strongly against the publicly owned bits of BBC (and of all services) and keep finding new ways to i) put huge hurdles in their way ii) complain about the lack of efficiency of the service iii) sell it off to commercial partners who are not subjected to the same regulatory hurdles.
This happened (sort of) to the BBC's food websites:
https://www.theguardian.com/media/2016/may/17/bbc-climbdown-...
https://en.wikipedia.org/wiki/BBC_Good_Food
a. "BBC isn't a socialist enterprise, and anyway b. BBC Good Food is a brand owned by a German multimedia conglomerate
I know the BBC has its critics here in the UK, but I've never seen any one of them conflate it with socialism before. Just reading that sentence forced me to do a double-take...
It was a joke, by the way. There are some hardcore free-market libertarians here really who do make criticisms like that. Isn't monotone sarcasm just as much a part of Britishness as the BBC?
There was something about that in The Name of the Rose- the book in any case. Something about how Englishmen and Germans react differently to a joke etc. I'll see if I can find a quote.
(Also the BBC isn't currently funded by tax payers, but most likely would be if the license fee were abolished https://www.bbc.com/aboutthebbc/governance/licencefee)
Thankfully the task is rather easier than learning natural language concepts. The LSTM only has to learn basic concepts of the language of recipes, which is considerably simpler than unrestricted natural English.
For example, in natural English one would say
"You will need one cup of unsalted butter for this recipe, which you should soften.
Alternatively, you can measure 2 sticks of butter".
Whereas a recipe will simply say: 1 cup (2 sticks) unsalted butter, softened
As in the example on the repository.Also, it seems that most, if not all, sentences begin with a verb that describes an action followed by a list of ingredients to be combined. "Stir the olive oil, garlic, thyme and 1 teaspoon salt in a saucepan;" etc. The regularity and repetitiveness of such structures makes them much easier to learn than arbitrary English text. In more practical terms, they also make the instance space for this task a lot more dense than arbitrary English text, were a sentence with a certain structure may only repeat once after a million utterances.
Edit: OK, if I don't say this I'll explode. "one cup" is "two sticks"? This is just not going to work.
Obviously, it is because the model "understands" the structure of the sentence, but is oblivious of the text as a whole.
I know very little about machine learning or cooking or chemistry in general. How would one make this actually useful and interesting?
My guess is you would need to provide a lot more context to the database. Things like chemical composition seem like the most fundamental component of recipes.
Backwards planning from the composition, you could teach it actions that generate those chemicals such as methods of cooking, and the source foods that provide the building blocks i.e. ingredients.
Then at some point you could link it back to the recipes to create standardized instructions for generating certain chemical patterns.
Does that sound like the right way to make this more realistic?
I'm not talking about how this specific network is trained. I'm talking about how this toy could be perhaps turned into something useful, like my original analogy to building a car out of lego.
I understand enough about neural networks to know they are useful as Boolean supersets. It's all about how the training is defined with your training data containing the Boolean true/false values.
So what I'm saying is, in order to provide context and make this toy useful, you could change your Boolean choices from sequence-based letter chains to something with a little more value like popular chemical combinations.
To go further, consider how a restaurant picks its menu. That is a simple Boolean statement of "accept" or "reject". So how do you work backwards from there? Right now you require a combination of a head chef that has years of experience (your database) and an owner that has a vision.
Don't miss the forest for the trees!
I'm sorry, I think you took my comment in the wrong way. I didn't mean it as some kind of put down. I wished to explain how this kind of thing works.
In the same spirit, of a friendly sharing of knowledge, I would also now explain that what you are proposing, "buildig a car out of lego", or in general assembling structure out of modular components, is not what neural nets do best. Neural nets are best at mapping between sets of objects. Typically, one set represents some entities we are interested to categorise and the other set represents the categories to which we want to assign the entities in the first set. To "build a car out of lego" you would need a different type of AI, like a program synthesis algorithm, or an Inductive Programming algorithm (machine learning algorithms that learn programs from examples; and which I study). In such a setting, your "lego" would be functions or sub-programs and your "car" would be a program created by combinations of the given sub-programs.
Also, neural nets, especially more modern ones of the "deep learning" variety are not limited to boolean features ("data containing Boolean true/false values") and can instead be trained on arbitrary real-valued data. What is often done when training language models is to encode training data in a "one-hot encoding" manner, in which the "features" are very long boolean vectors, with one element for each word or character in the raw text and with a "0" representing "no occurrence" and a "1" "occurrence", of a particular character or word. This is not the case for other types of data, e.g. in machine vision the feature values are raw pixel data, in time series regression they're arbitrary precision real numbers etc.
I confess that I'm not sure how the data looks for neural nets trained to predict chemical structures. It's possible they're one-hot encoded vectors, like for text.
No doubt you can train a neural net classifier to make yes/no decisions about possible items on a menu, but my guess is that a system of this kind would look at customer preferences primarily, rather than the chemical composition of food items. After all, the chemical composition of a dish will vary a lot more than the preference of a particular individual, or group of individuals, for that dish. By which I mean, if I like spaghetti carbonara, I will probably like it regardless of its exact chemical composition, but I won't like it. e.g. if it lacks pancetta. My guess is that the relevant elements of the dish are in the scale of cooking ingredients, rather than the scale of molecules. So a system like the one you describe would be better off taking into account the composition of a dish on that scale.
On the other hand, if you wanted to assemble a menu with finished dishes from a list of ingredients and examples of recipes, then you would need a system like the ones I describe above, in the program synthesis or (preferrably) Inductive Programming category. Or of course you could write a program encoding the rules you have in mind by hand. This is not a task where AI is absolutely necessary, I feel.
We used a linear solver and added a lot heuristics e.g. what time of day certain recipes were 'acceptible' suggestions. We also needed a lot variants e.g. proportions to meet kJ targets.
I would go even further: It's not enough for the system to know how to generate any given "chemical pattern", but to also know which chemical patterns are desirable.
Right now, AI recipes are just an oddity. Weird and barely workable at best, and that's OK. We'll get there.
I started a similar project last year, but using GAN (RecipeGAN). Using a GAN would learn underlying meaning, based on my experience using GANs to synthesize data that maintained univariate statistics and correlation between features of the original data.
The example in the article shows how RNNs can capture structure (I have used LSTM models to synthesize JSON data, and just for fun, to model source code).
I think generating a final 'cooked recipe' image and publishing it to the social media would attract more eyes, but that would involve whole lot of other variables and could become WMD for the recipe video spammers/scammers.
Maybe if you just generate the description and backfill the ingredient list afterward? Hmm.
Crispy duck Stacks
[INGREDIENTS]
• 1 baguette, sliced 1/3 inch thick • 1/4 cup corn oil • 2 cups fresh spinach, coarsely crumbled • 1 cup grated Parmesan • 1/2 cup grated Parmesan • 1 cup creme fraiche • 1/4 cup grated Parmesan
http://beyondloom.com/things/reciprocity.html#chicken%20curr...
What are you trying to cook? fried onions
Hmm. Never heard of fried onions. I guess it's some kind of salad? How about:
Ingredients
1 oz. onion
3/4 tsp clove
1 oz. swiss cheese
1 cups lima beans
2 cups tomato juice
3/4 liters goat milk
Preparation
start with a large mixing bowl.
chop onion, removing any seeds, and stir in.
season with clove.
crumble over swiss cheese.
stir in lima beans (fresh).
apply dressing made by blending goat milk and tomato juice.
toss thoroughly.
Serves
2, at 1050 calories per serving.
More context? What is this, how and why was it made, etc?Edit: aAAAAAAH! I don't want to know what it is. INSECTOID BUTTONS. AAAH.
Hmm. Never heard of hacker news. I guess it's some kind of baked dish? How about: Ingredients
1 1/2 liters simple syrup
1 tbsp mother of vinegar
3 cups white flour
2 large salmon eggs
2 1/2 oz. american cheese
1 1/2 tbsp star anise
1 oz. pork chops
7 cups chicken breast
9 cups kiwifruit juice
3/4 cups water