Tag Archives: machine learning

Popcorn popping: prediction and causality

Free will vs. determinism

When heated to 200°C, popcorn kernels tend to pop at random times between about 40 s and 2 minutes. But what is this “randomness”? My co-worker Jesús MB and I had different points of view. Jesús previously ran a popcorn decay experiment to make the link between popcorn and radioactive nuclei. The decay of a nucleus is a physically unpredictable process, according to the laws of quantum physics. However, unpredictable does not necessarily mean uncaused. As I argued in a previous post, even quantum mechanics allows causality.

Now, a popcorn is a macroscopic object containing a hierarchical biological structure, mainly composed of starch granules, a little moisture, and a hard impermeable shell. Surely there must be a cause of its popping time (at well-defined temperature) that we can find by studying its physical properties? Moreover, maybe there are measurable characteristics of the unpopped popcorn, that will allow us to predict the popping time, and eliminate the randomness wholly or partially?

Jesús and I got together at the Berlin Science Hack Lab to put these questions to an experimental test. Thanks also to Narek B who joined us on the day to help with the experiments.

Popping individual popcorn kernels and predicting the popping time

The idea was to use a hot air blower as shown below, to pop individual kernels in a reproducible manner. We first measured the height, weight and photograph each kernel, before popping it and recording the popping time. This information allows us to calculate the volume, density and 2D shape of the kernel also.

Furthermore we photographed each kernel after popping. This may give us more information on the physical properties of the kernel which was not practical to measure before popping.

It look a whole day to collect 36 data points (and one kernel did not pop). Then we used a simple machine learning technique: multiple linear regression (MLR) with related methods to try to predict popping time from the physical data.

machine

Popcorn machine: consists of a hot air blower blowing into an aluminium drum. The machine reaches a steady state temperature of 200 C within about 2 minutes. The popcorns bounce around in the hot air, sampling an average temperature in the drum.

 

What do the photos of popcorn tell us?

Below are the images of a few unpopped kernels. They differ slightly in shape: some are more or less rounded or symmetrical. They differ slightly in size and mass. We know that the vast majority of kernels split at the yellow round end, not the pointy white end.

image12 image11 image10

image9 image8 image7

However there is more variation after the pop. Most popcorns look like an “octopus” with 3 or 4 legs, but some have a “blocky” or “blotchy” appearence. See photos below.

image3

“Octopus”: the kernel splits symmetrically, and the hot starch solution expands in a smooth round bulge. 3 or 4 sections of the shell peel back, like a banana peel or legs of an octopus.

image5

“Blocky”: the expanding starch solution is not always uniform. Sometimes cracks appear, leading to the “blocky” appearance.

image4

“Blotchy”: sometimes the shell (mainly at the pointy white end) disintegrates too, leading to a blotchy appearence.

Multiple linear regression with cross-validation: mass, height, area, volume and density don’t help us predict popping time

The first model correlates the mass, height, area, volume and density of the kernel against its popping time. We used “leave-one-out” cross-validation to ensure that we were not cheating ourselves: each data point n was predicted using a model calibrated on all the other data excluding point n). The model is poor as shown below. R-squared is 0.05. The standard error of the prediction is 25 s, which is indeed worse than if we just used the mean popping time as a prediction (error 22 s).

image2

MLR model of popping time based on mass, height, area, volume and density of the kernel. No predictive value.

2D Kernel shape also doesn’t predict popping time

We photographed and traced all kernel outlines, rotated and centered them, and made a Fourier decomposition of their shapes to be able to use the shape (at low spatial frequencies) in our model:

image13

Popcorn kernel outlines

image14

Fourier decomposition (and reconstruction) of a kernel outline (up to circular frequency = 5)

Unfortunately this was also not helpful in making a useful prediction. We added Fourier components up to circular frequency = 5 (i.e. 11 components: 5 sine, 5 cosine and 1 constant) to the predictor data above. The extra data necessitates some more sophistication: we used instead a principal components analysis followed by MLR (PCA-MLR) with cross-validation. 6 components worked best. However, the prediction is still useless: a standard error of 23 seconds shows this model is better than the earlier model, but still worse than just the mean.

image16

image15

PCA-MLR model based on mass, height, area and 2D spatial information. Still no useful prediction.

Some “after the fact” information is correlated to popping time

Inspection of the popping data shows that, in general, “blocky” and “blotchy” take longer to pop than “octopus” individuals. The PCA-MLR model (3 PCs with cross-validation) is shown below, to which the popped shape data has been added to the mass, height, area, volume, density data. This is our only model that shows a useful prediction (standard error of 19 s) compared to the mean (22 s).

image6

“After the fact” model: “blocky” and “blotchy” take longer to pop than “octopus” individuals. The PCA-MLR model shows an improved prediction than the mean.

Conclusion: popcorn popping time is caused but unpredictable

When we started this experiment, we hoped that we would be able to predict popping time from measurements on the unpopped kernels. However, the only useful measurement that we found came from a measurement on the popped kernel (its shape classification), which is of course impossible to measure before popping. So this counts as a causation but not a prediction!

This experiment was just for fun, of course. But it is interesting that the analogy to quantum mechanics and radioactive nuclei has held true. We have found a (partial) cause of the popping time, but no way of predicting it!