15
$\begingroup$

I once had a veteran in my course that created an algorithm that would suggest cooking recipes. At first, all sort of crazy recipes would come out. Then, she would train the cooking algorithm with real recipes and eventually it would suggest very good ones.

I believe she used something related to Bayes Theorem or Clustering, but she is long gone and so is the algorithm. I have searched the internet but looking for cooking recipes will yield any sort of results but not the one I am looking for. So, my question is:

What techniques can be used to devise an algorithm that (randomly) suggests feasible recipes (without using a database of fixed recipes)?

Why would I bother looking for a cooking algorithm? Well, it was a very good example of a real world application of the underlying concepts, and such algorithm could be useful in different settings that are closer to the real world.

$\endgroup$
24
  • 1
    $\begingroup$ It might be worth looking at various types of evolutionary algorithm $\endgroup$
    – Henry
    Apr 8, 2012 at 0:33
  • 7
    $\begingroup$ ... or for light relief, this from xkcd $\endgroup$
    – Henry
    Apr 8, 2012 at 0:36
  • 2
    $\begingroup$ @Henry: And which function would you use for fitness? That is the main point of the question! $\endgroup$
    – Raphael
    Apr 8, 2012 at 9:42
  • 1
    $\begingroup$ Can the person who voted to close explain the reason behind his vote? Voting to close without giving a reason does not help the OP improve his question. $\endgroup$ Apr 8, 2012 at 9:54
  • 1
    $\begingroup$ The comments seems more exotic than the question itself. $\endgroup$ Apr 8, 2012 at 14:55

4 Answers 4

4
$\begingroup$

Hmm, using Bayes Theorem to make new recipes out of old recipes. I imagine you first would want the algorithm to pull apart the ingredients into a form it understands (not sure if we are using NLP for that, or if you manually enter the data in yourself, that's neither here nor there.) From there...

I envision something like this.

Test Data analyzed. Now we have a list of recipes and the probabilities that each ingredient will take place alongside another ingredient, and in what quantities. After we have this data then you would have the program randomly make the new recipes. First it cycles through a list of all the known ingredients, then randomly selects a main ingredient, from there it uses the probabilities of an ingredient given another ingredient to start throwing in more random ingredients, all the while matching appropriate trained data for quantities and compatible ingredients.

Might I suggest that when creating a new recipe the program be given information like, I want something sweet, or something sour, or for instance something mostly made up of wheat.

Hopefully this helps a bit.

$\endgroup$
3
$\begingroup$

For a broad US-centric dataset of nearly 2000 recipes you could look at the Armed Forces Recipe Service. This does not answer your question, but would provide you with real-world training data.

The requirements for the problem are probably difficult to articulate for most people and the selected approach will likely end up implicitly adjusting fitness in the way you have suggested. Foods in geenral are very culture-specific and the approach would probably travel very poorly without extensive tuning.

This also needs substantial sematic, and domain, knowledge to prepare more than just a list of ingredients. After all, coffee-flavoured ice-cream with wafer, cafe au lait and a croissant and tira misu would otherwise be indistinguishable.

$\endgroup$
2
  • $\begingroup$ "This does not answer your question" -- exactly, so it should be a comment. I see you are not allowed to comment yet; I flagged for conversion. $\endgroup$
    – Raphael
    Apr 10, 2012 at 7:35
  • $\begingroup$ @Raphael: not converting this, because it's too long and - although it may not be an ideal answer - as a whole it does attempt to address the problem. If you feel it is unhelpful, please down-vote it. Pekka, although this may not be the most productive source of new culinary art, it is an interesting - and relatable - problem... If you could expand your answer to discuss the specifics of developing such an algorithm, it might be more acceptable. $\endgroup$
    – Shog9
    Apr 10, 2012 at 17:59
3
$\begingroup$

Recipe generation is commonly used as an example application for Case Based Reasoning systems. It is even used as an example on the Wikipedia Page. A google search for "case based reasoning recipes" yields numerous results.

$\endgroup$
1
$\begingroup$

The class of algorithms you are looking for is the bandits one. They are usually used to handle the exploration part of a classification problem.

A basic approach would be to represent the recipes as a limited bag of components (a vector of booleans with at most k non 0 values) and to use LinUCB to select a set of components. Then the feedback would be 'like' or 'dont like'. Of course if you are a bayesian you could prefer to use Trueskill (using the Adpredictor variant).

Something less basic would require to use a kernel instead of a linear separation. Kernel ucb can help to handle that part. But at some point I think it would become usefull to pay attention to the chemical compositions of the aliments because at the end you probably want to achieve a balance between different basic tastes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.