swizec.com

Senior Mindset Book

Get promoted, earn a bigger salary, work for top companies

Bayesian modeling for the perfect pizza

How do you check your pizza's done? You look at it.

But what if you're mass producing pizza? You could have somebody look at every pizza. But people get tired. So you need more people. But then you have to train everyone and you might lose some consistency in what is The Best Pizza (tm).

In Multivariate Bayesian cognitive modeling for unsupervised quality control of baked pizzas Neto, Aguiar, Santos and Wangenheim propose using computers specifically trained to look at a pizza and say "Yup, perfect! Done."

They improved on earlier research that focused on pizza toppings, cooking cheese, and baking bread. According to the authors earlier research relied mostly on reducing colour dimensions, even using greyscale to analyze the browning of bread, and thus could not achieve desired accuracy.

More importantly, nobody before seems to have applied scientific rigor to the baseline - When do humans think pizza is tastiest?

To that end the authors performed a pizza baking experiment with three mozzarella pizzas. Each was baked in an electric oven for 40 minutes at 200°C and a picture was taken every 4 minutes.

These pictures were then sent to 68 untrained volunteers from the Mechanical Engineering department - seriously, an engineer untrained in deciding when pizza looks tastiest? - who had to rate images on a Hedonic scale from 1 to 5.

A hedonic scale is basically a scale used to answer "How much I like this". It's used in food science, there are even calibrated devices to measure these things called olfactometers.

The data said the best baking time for a mozzarella pizza at 200°C is in the 8 to 16 minute range. Which sounds strangely familiar as something reading the box might have told them.

But it's interesting to think this sort of rigorous approach can be taken to deciding whether a pizza looks good or not.

After the initial experiment in determining when pizza looks the tastiest the authors performed another baking experiment to analyze how colour values in the RGB space change when pizza is baked at 250°C. From what I understand higher temperature means shorter baking times and thus quicker experiments.

Another three mozzarella pizzas were destroyed in the name of science.

There are four colour elements you can observe when baking pizza: the background - discarded because it doesn't matter - olives, sauce, cheese, and crust.

It seems that during the baking process olives remain black the whole time and the colour of sauce doesn't change significantly either. But cheese and crust do.

Samples in that magic time range - 8 to 16 minutes - were averaged across the three pizzas to produce a graph of RGB value variation for cheese and crust over the whole baking process. The pixels that represent cheese and crust were chosen manually and troublesome pixels for the cheese were removed.

The problem with cheese is that it generally browns slower than the crust, but can be very quick around the edges.

Their bayesian model used Mahalanobis distance to compare pizzas from the validation stage to the training set from the human subjects. Mahalanobis distance is a statistical measure that performs better than Euclidean distance when you have distinct covariances in the target patterns.

As expected, their experiment confirmed that pizza baked at 250°C will be done faster than pizza baked at 200°C - 7 to 16 minutes is the magic range according to their Bayesian model. The beginning of the interval was very similar for all pizzas, but the ending varied greatly.

The authors speculate this variability might have been caused by variances in cheese distribution on the pizza, which wouldn't exist in a mass production environment because robots can spread cheese very precisely.

They also noticed cheese can fall below threshold values during baking, which they speculate might be the result of released grease being shiny and thus messing up RGB values.

The real question now is who is going to use this research to install a camera in my oven and make it beep when pizza is done, not when some nebulous timer runs out?

The world needs this! Home ovens that know when food is done regardless of the timer you set. Imagine the endless possibilities!

Published on October 8th, 2013 in Baking, Cheese, Cook, Dough, Pizza, Uncategorized

Semantically similar articles hand-picked by GPT-4

Senior Mindset Book

Get promoted, earn a bigger salary, work for top companies

Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.

Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.

Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.

Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev

Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization

Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections

Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog

Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️

Created by Swizec with ❤️