58 points · by oleksiitwork · 6y ago · 51 comments
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.
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
Those damn socialists and their delicious recipes...! shakes fist
(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)
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...
a. "BBC isn't a socialist enterprise, and anyway b. BBC Good Food is a brand owned by a German multimedia conglomerate
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?
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'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.
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.
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.
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