7 ms·
Baking with machine learning (2020)
- ipsum2 6y agoSeems like a linear model would work equally as well, without all the deep learning bits.
- refactor_master 6y agoBut tensorflow go brrrr
- simonhughes22 6y agoMy thoughts exactly. A DL for 100 row dataset seems like overkill (and likely overfits).
- mlthoughts2018 6y agoI normally agree, but this is clearly just for fun and for poking around with cloud tools. The author is not making claims about accuracy or anything, I think this post is not a good one for the stampede of “well actually...” ML approach bashing of HN. This is a nice post. In my mind it stands in contrast to the SMART stats hard drive failure model post from a few days ago - that was an inappropriate approach AND the person was putting forward as actually being a valid analysis workflow & conclusion. This post is obviously just for giggles, and it’s very good.
- ipsum2 6y agoYeah I know its just for fun, but you could use a single linear layer to demonstrate the same thing, and use the fancy TF tools as well.
- jamesfe 6y agoYou are right, but she is a GCP ML advocate, so her job is to distill this stuff down into blog posts or 45 minute talk tracks.
- ekianjo 6y agoAgree no need for DL for this. Far more efficient models for this kind of use exist.
- ff7f00 6y agoHow would you go about creating something that could generate recipes (e.g. generate me a cookie recipe)?
- devindotcom 6y agoIn case you're wondering why this is circulating, Google had it on their cloud blog a couple weeks ago: https://blog.google/products/google-cloud/just-desserts-baking-ai-made-recipes https://blog.google/products/google-cloud/just-desserts-baki... I wrote it up around then too. Haven't tried the recipe, but the cakies look legit.
- Jugurtha 6y agoNext step, watch Ben Krasnow's "Cookie Perfection Machine" video[0] on his Applied Science channel. Next step: integrate the model with the machine. I wasn't able to reproduce this (couldn't find a link to the data in the article, the code to train the model, etc). - [0]: https://www.youtube.com/watch?v=8YEdHjGMeho https://www.youtube.com/watch?v=8YEdHjGMeho
- dfraser992 6y agoYou can tell HN is full of engineers - all discussing the difference between weighing and measuring, the utility of using DL for this.... but no discussion of the end product. Well, I made this the other day. I measured, so probably didn't do that right and my oven is crummy, so the temperature was probably off and I think I left it in a little too long (or I'm at the wrong altitude?) So the outside was a bit more crispy that I'd expect, but it wasn't burnt. The inside was definitely cakie - not fluffy enough to be called cake, but not solid or hard enough to be a proper cookie (the outside was cookie-like). Quite edible, but it turns out you can actually use too many chocolate chips....
- pizza 6y agoSide note: one project I would like to do myself is a followup to YY Ahn et al's Flavor Networks research, but this time with some extra.. `zest`: using the flavor and ingredient networks, but turbocharging the model using some kind of molecular representation of the flavor compounds using e.g. dgl-lifesci for graph-based representations of individual molecules. Basically instead of food <-> ingredients <-> flavor molecules (strings) relations use food <-> ingredients <-> flavor molecule (graphs) since graph neural networks are all the rage these days. I already made a kind of graph neural network thingy that works similarly for the AICrowd Learning to Smell competition that was kind of similar :) https://www.aicrowd.com/challenges/learning-to-smell https://www.aicrowd.com/challenges/learning-to-smell
- fileyfood500 6y agogo sara!!
- thih9 6y agoLooks like the article is almost a year old, we should add "(2020)" to the title.
- xiaodai 6y agoI honestly read banking....
- vavooom 6y agoWas also confused how banking and tablespoon measurements related!
- sillysaurusx 6y agoI noticed something about Adam. Suppose you want to do gradient accumulation. Easy: compute the gradients of the loss with respect to each model parameter, and accumulate it over N training examples. Then pass the result into Adam, performing a single step. This is standard gradient accumulation; it's equivalent to running a mega-GPU that can process 64 training examples at once, rather than a small-GPU that can only process 8. It just takes longer to train, since you're performing an adam update every 8 steps in that case. But, I was staring at the Adam formula and thought of something. I'm not sure if it makes sense, but there seems to be an "alternate" way to accumulate gradients: For each training example, compute the gradients and apply the gradients. However, we apply them in a special way. The final step of adam normally looks like this: param = param - (lr * m_t / (v_sqrt + epsilon_t)) I propose accumulating the gradients like this: accum = accum + (lr * m_t / (v_sqrt + epsilon_t)) Then after N training samples, when you want to do the actual variable update: param = param - accum accum = 0 The advantage of this approach (if it works at all) is that Adam updates continuously. Every training example would cause Adam's mean and variance estimators to update. (Recall that the whole point of Adam is that it tracks mean and variance for every parameter in the entire model.) So, in traditional gradient accumulation, those mean and variance slots would only update every N training examples. With this approach, they would update every training example, and then the model params update every N training examples. It might seem like a small tweak, but adam's variance stats are crucial; it's what makes adam effective. Updating the variance 8x more frequently might be an advantage.
- cozzyd 6y agoI guess this is not a reference to the TDP of some video cards.
- jzer0cool 6y agoFun fact, measure of a teaspoon is confusing: 1 US tablespoon = 14.8 mL = 3 teaspoon A metric tablespoon is exactly equal to 15 mL The Australian definition: 1 tablespoon = 20 mL = 4 teaspoons > https://en.wikipedia.org/wiki/Teaspoon https://en.wikipedia.org/wiki/Teaspoon > https://en.wikipedia.org/wiki/Tablespoon https://en.wikipedia.org/wiki/Tablespoon Now my so gave me a weird look. I had all the ingredients in the bowl and I said, "It's a cookie!"
- tornato7 6y agoThere are also Metric Cups, Imperial Cups, American Cups and Japanese Cups. Good luck following a recipe now.
- magnetowasright 6y agoCups also differ regionally; ‘half a liquid pint’ in ‘US customary units’, and varies between 200ml and 250ml elsewhere. https://en.m.wikipedia.org/wiki/Cup_(unit) https://en.m.wikipedia.org/wiki/Cup_(unit)
- com2kid 6y agoOh bonus is when a recipe is partially translated from metric in youtube captions. So you have 500ml of something, then 1 cup of something, and temperatures in Fahrenheit and you have to guess if it is US cups, or whatever cups the origin country of the video uses.
- throwawayboise 6y agoThat's interesting and I never knew that. I have a stainless steel liquid measuring cup, originally my mom's, from Sweden. Probably dates to the 1960s if not older. It's graduated in ml and pints. But its pints are a few ounces larger than US pints. I wonder if it's some other pint scale? I have always just assumed that they got the conversion factor wrong. Edit: after reading your link, it appears to me that it is graduated in imperial pints, not US pints.
- tppiotrowski 6y agoThe instant pot also comes with a “measuring cup” and it is a different amount than my Pyrex measuring cup. Took about 6 months to discover that.
- xiphias2 6y agoI was hoping for a home made robot that cooks at home...are we still that far from it?
- andrewem 6y agoAn interesting normalization of amounts for baking bread and similar foods is called “baker’s percentage”. The total weight (or mass) of flour in the recipe is 100%, and all ingredients are measured in terms of that. You do end up with very small percentages for ingredients like yeast, but in general it’s nice because you can easily see for instance how sweet a recipe is based on how much sugar is added as a percentage of the total flour. https://en.m.wikipedia.org/wiki/Baker_percentage https://en.m.wikipedia.org/wiki/Baker_percentage
- throwawayboise 6y agoThis is the right approach. Then the measurement system doesn't matter. You can use lbs/oz, grams, whatever kind of scale you have handy.
- slow_donkey 6y agoI wrote an Android app for managing recipes with bakers percents so I definitely agree - being able to scan over the ratios of water, salt, and sugar tells you a lot about the recipe and what the dough will feel like. I do wish normal cooking recipes had a similar convention - it's rare that I've ever used exact amounts since the ratio and technique are always more important.
- kyrofa 6y ago> I know, I’m using cups and teaspoons and not something more universal like grams. If my little model becomes a smash hit, I will try to add metric system support. It's not that cups/teaspoons aren't universal that makes them noteworthy, it's that they're volumetric. You should be measuring your dry ingredients by weight. The unit isn't that important, we can convert once you start measuring properly.
- aidenn0 6y agoIndeed. She should use mcwt (thousands of a hundredweight). That will be much improved :)
- kyrofa 6y agoshrug it will produce more consistent results than what she has now, anyway.
- justlv 6y agoInteresting, but would it matter if the model can learn the non-linearity?
- YokoZar 6y agoIt's not about linearity, it's that a "cup" of flour can be two completely different amounts of flour depending on how densely it's packed. Going by weight prevents this sort of measurement error.
- mdeck_ 6y agoWell, it CAN vary quite a lot theoretically, but that’s why there are guidelines on how to measure a cup of flour. https://www.mashed.com/182198/youve-been-measuring-flour-wrong-this-whole-time/ https://www.mashed.com/182198/youve-been-measuring-flour-wro... Yet, to your point: when I bake (at least when I bake sourdough, which is virtually all I make), I always measure using a scale, and I measure in grams. No reason to go for imprecision when you don’t have to. But these guidelines for how to measure flour by volume are also important simply for historical reasons: lots of the most respected cookbooks measure by volume, not by weight.
- nicholast 6y agoAn interesting application is the target of a feature set configuration that returns a specific desired output activation value (eg 50/50 for two of classes). I do not know if tensorflow has an automation for this task available, perhaps could be a fun followup project for the author.
- inopinatus 6y agoI recently used AI Dungeon to obtain an omelette recipe. You follow the resulting instructions at https://play.aidungeon.io/main/adventureView?publicId=6a346ed2-81d9-4706-a489-ded1be54244a https://play.aidungeon.io/main/adventureView?publicId=6a346e... at your own risk.
- Mathnerd314 6y ago> cornflour (ground corn, water)
- op03 6y agoWell we know what happens next. Some ambitious kid, in some random corner of the world, is going to cut and paste it and sell it to some police dept as a "Google" profiler. It will work as badly as the police do, but now they just point at the app to cover their ass, cause you know Google said so Judge. Where it doesnt do what the cops want the kid will add "features" to make sure it does. Give it a year or two and the local PD will be happily be promoting it to everyone else for a decent commision ofcourse. "Whistleblowers" will get taken care off. VCs will step in to scale up ops. The price will be so cheap it will bankrupt most honest competition. Half the world will be using it soon enough and then ofcourse Palantir will step in and buy them. The billionaire founder will then strut around grooming the next gen, funding further mindlessness. And the same thing will repeat from Medicine to the Military, from Finance to Psychology all the while a clueless buffoon class of corporate programmed robots stand up and talk about how they are empowering the masses. So how do we stop the cycle? Dont empower the masses. Just yet. Dont work for execs pushing such narratives. If you are in positions of authority sideline them. They dont know what they are doing. Scaling everything is a prime directive for these robots and they are too dumb and unimaginative to rewrite their own code let alone decide what is good for the population.
- pcstl 6y agoThis seems like a rather... circuitous justification for gatekeeping knowledge.
- slow_donkey 6y agoThere's a more practical but relevant cooking problem that I haven't seen discussed - when extracting recipes from websites it's tricky to parse the actual ingredients and quantities. For example, "1/2 cup of diced tomatoes or a can of tomatoes (preferably san marzano)". This sort of freeform text doesn't suit regex very well but also lacks substantial context clues. You'd most likely use named entity recognition which could recognize that "1/2" is a quantity, "cup" is the unit, etc. but I haven't gotten very good results yet. Maybe I'll write up a post when I land on a solution.
- Mathnerd314 6y agoThere was an old HN post about the NYT recipe tagger. This seems to be the most up-to-date repo: https://github.com/mtlynch/ingredient-phrase-tagger https://github.com/mtlynch/ingredient-phrase-tagger
- slow_donkey 6y agoAh yeah I saw this initially but haven't given CRFs a try yet. I was hoping ml had advanced enough that I could throw newer solutions at the problem. Thanks for linking this though, I just realized there's a lot of labelled training data the NYT provided which I will definitely use.
- mdeck_ 6y agoThe next logical step here, it seems to me, is to scrape tens of thousands of recipes and apply this more broadly. There are, alas, perhaps a dozen or more dimensions along which recipes are going to be difficult to sanitize and normalize—there’s weight vs volume, variations in how to describe similar ingredients, and perhaps worst of all is the actual steps! But are these challenges insurmountable? Well, maybe a few would limit you in some respects, but it certainly can’t be denied that some intrepid coder-cook could push this concept somewhat further. You could also turn this all around and have a “consensus recipe generator.” Type in “pesto genovese” and it gives you a best guess of ingredients and amounts, with links to some recipes roughly matching those consensus amounts, perhaps with notable variations/“nearby” recipe clusters (sun-dried tomato pesto? or just the most popular pine nut substitute?) noted too.