Baking with machine learning (2020)
sararobinson.dev
sararobinson.dev
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.
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.
"""
WEIGHING VERSUS MEASURING
For years, chefs, professional bakers, and cookbook authors alike have urged home cooks to become comfortable with a scale, but habits are hard to change. Your mother and grandmother probably didn’t use scales, and you may even have their measuring cups in your kitchen drawer. But using a scale will change the way you cook and bake for the better in many ways.
And the merits of weighing are not only about accuracy: weighing is also more convenient. Weighing is a much easier and cleaner way to measure peanut butter, molasses, or corn syrup, for example—you simply set the mixing bowl on the scale, tare the scale (set it to zero), and measure the ingredient into the bowl, rather than having to scrape it into and out of a measuring cup. And, of course, there is the additional bonus that more than one ingredient can be measured into that same bowl.
Precision matters more in baking than in savory cooking, which is why Sebastien and Matthew provided exact weights, for optimum results. You’ll see that most of these recipes have what may seem crazily specific weights: 519 grams of flour, for instance, or 234 grams of sugar. This is because we converted these recipes from the larger-scale recipes used by the bakery. (This is another benefit of using weights—all recipes can easily be halved, doubled, or tripled, and so on, and they will work.) Do not be intimidated by these specific amounts—when you use a scale, it’s easy to measure 234 grams. However, when converting those weights to volume, we often had to round them off (despite Sebastien and Matthew’s preference that we not). In a short time it should become readily clear why weighing is the preferable route.
We strongly recommend using digital scales, either a bigger one that weighs to the tenth of a gram, or a basic kitchen scale for larger quantities and a palm scale that weighs smaller quantities.
"""
For cakes, all other ingredients should be measured in multiples of the used egg parts.
"""
Likewise, eggs vary slightly in weight from one to another; measuring eggs by weight ensures great accuracy. “Large” eggs are 56 grams/2 ounces by definition, but they vary in weight by 10 or more grams, so calling for eggs by weight, as we do in these recipes, guarantees more consistent results. And weighing allows you to use any size egg you have access to, which is especially helpful if you use farm-raised eggs, which are often not graded by size.
"""
Where baking is done can override volumetric measuring, even with sound, consistent technique. I'm a professional bread baker working at altitude in a low humidity environment. One cup of flour for me will weigh less than a cup for someone in a high humidity area. Parents and grandparents passing down volumetric recipes in the past were unlikely to experience inconsistent baking/cooking outcomes because back in the day succeeding generations were apt to remain in the same geographic area.
But yes, I did not mean to endorse measuring by volume—only that you can avoid much of the problem if you follow proper measuring technique. As I noted in my post, I personally use weights when baking.
As for the historical justification for using volumetric recipes: you’re probably overthinking it if you’re connecting it to geography, and especially if you’re connecting it to altitude. More likely the reason would just be that volumetric measuring was easier and cheaper to reproduce until quite recently. Scales can be expensive, can break, etc. Cups are cheap and durable.
And altitude may be an issue, never had to consider that.
I think there are other factors that affects the amount of flour you should use, such as the ratio of water already in the flour.
If you use fresh flour directly from the mill, you may not need as much water in the dough.
I also imagine the method of grinding the flour may make a difference.
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/Tablespoon
Now my so gave me a weird look. I had all the ingredients in the bowl and I said, "It's a cookie!"
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.
Edit: after reading your link, it appears to me that it is graduated in imperial pints, not US pints.
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.
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.
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.
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.
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.
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.
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://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.
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).
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....
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.