cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
Choose Language Hide Translation Bar
A taste for the optimum: Baking with Bayesian optimization

There’s something irresistible about light and fluffy cupcakes! While at first glance these tasty desserts may seem simple, bakers know that achieving the perfect recipe requires tedious testing.

In the past, I’ve struggled to master the leavening process. Cupcakes require air bubbles inside the batter to create a light and spongy texture. It’s usually accomplished through two methods: using baking powder and mixing the eggs and sugar.

 

Research question: What is the ideal mixing time (of eggs and sugar) and optimal amount of baking powder needed to achieve maximum cupcake rise without compromising its lightweight quality? 

 

Why use Bayesian optimization for baking?

The primary reason to use it is because baking batches of cupcakes is time-consuming! Since Bayesian optimization uses active and adaptive learning, it can potentially reduce unnecessary testing. Also, cupcakes are responsive to small changes. Traditional experimental designs may “overlook” the targeted optimum region.

 

Responses/goals

  • Maximize Height (cm): between 2-6 cm
  • Minimize Weight (oz): between 0.5-3 oz


Factors

  • Mix Time (min) for eggs and sugar: restricted between 1-10 minutes
  • Baking Powder (oz): restricted between 0.01-0.15 oz

The recipe for this study was converted to ounces for the use of a standard kitchen scale. All ingredients except for baking powder were held constant.

 

The recipe

Eggs

0.9 oz

Butter

1 oz

Milk

2.25 oz

Flour

2.25 oz

Baking powder

VARIES (0.08 oz)

Salt

0.02 oz

Sugar

1.5 oz

 

Procedure

Mix eggs and sugar with a handheld mixer for a specified time as determined by the Bayesian Optimization platform in JMP Pro. Next, combine melted butter, milk, and dry ingredients with the eggs and sugar. Mix small amounts of the dry ingredients into the wet mixture, incorporating no longer than 30 seconds.

Add 2 oz of batter to a cupcake wrapper and place in a baking tray. Bake the cupcake at 350°F for 25 minutes.

Remove cupcake from the baking tray and measure height (in cm) using a standard ruler. Measure weight in ounces using the kitchen scale (wrapper included).

Record results and begin next trial.

 

Findings

Using two initial trials as historical data, six iterations of Bayesian optimization were required to reach an optimal mix time and baking powder amount. See the data table below:

Cupcake Table.png

The best iterations from Bayesian optimization: mixing eggs and sugar for nine minutes, paired with 0.12 ounces of baking powder. Experimental runs with these amounts yielded the tall cupcakes with a reduced weight.

The winner (with icing)!The winner (with icing)!

Cupcakes from experimental runs. Notice the height differences, which are between 0.8-1.5 cm.Cupcakes from experimental runs. Notice the height differences, which are between 0.8-1.5 cm.

Conclusions

Despite inevitable measurement quirks in the baking process, the final cupcakes produced by Bayesian optimization were quite tasty. The cupcakes were tall and airy, perfect for a birthday party!

Overall, this baking session was a “sweet” success as goals of maximizing cupcake height and minimizing weight were satisfied. This simple example is one of the countless applications of Bayesian optimization in JMP Pro.

Last Modified: Jul 21, 2025 9:00 AM
Comments
Phil_Kay
Staff

A very nice, simple example of data-driven experimental optimisation. Love it.

Victor_G
Super User

Very nice and simple use case @bradley_bowen, thanks for sharing !

With its iterative nature, Bayesian Optimization lends itself very easily and quickly to nice animated visualizations to better understand the mechanisms and inner workings of the algorithm.
I reproduced your dataset and created this bubble plot showing where the algorithm has recommended points in your experimental space, with the Prediction formula for height response as background image.

 

It is also possible to show how the predicted surface response change with added points and more information, or also how the predicted variance in experimental space can be reduced.

Ben_BarrIngh
Staff

Great job @bradley_bowen - it's great to see how Bayesian Optimisation can be applied even for something like baking!

 

@Victor_G  - that's a great tip for visualisation, I might steal that idea