Food

70 Bars of Chocolate Later

October 3, 2023
  •  
3 min read
George Hill
Sagitto Ltd

Just for fun, we tested 70 different bars of chocolate using our hand-held NIR spectrometer and a tiny NIR spectral sensor from ams-Osram. Here's what we found.

But before describing what we found, we need to look at what constitutes chocolate ... and in particular, what is meant by "cocoa solids".

What Is Chocolate?

"Chocolate is made from the kernels of fermented and roasted cocoa beans. The kernels are ground to form a pasty fluid chocolate liquor ... pressed to reduce the cocoa butter content and then pulverized to make cocoa powder, or mixed with sugar and additional cocoa butter to make sweet (eating) chocolate."

 https://www.britannica.com/topic/chocolate

NIR can distinguish between cacao beans from different origins
NIR can distinguish between cacao beans from different origins

While cocoa butter is a natural part of the cocoa liquor (also known as cocoa mass), chocolate makers often blend additional cocoa butter with the cocoa mass to adjust the flavour and texture of their chocolate. Together these two components - the cocoa mass and any additional butter - form the 'cocoa solids' usually listed on the label.

70% cocoa mass (with or without additional cocoa butter), and 30% sugar, is a common ratio for dark chocolate. Pure cocoa mass tends to have a bitter taste, and the added sugar makes for a more enjoyable taste experience for most people.

NIR Absorbance 'Fingerprints' for Chocolate

Just as milk chocolate appears lighter in colour compared to dark chocolate when we look with our eyes, when we scan chocolate with NIR spectrometers we can see similar differences iin the way that chocolate absorbs light in the near-infrared.

Using an experimental NIR spectrometer developed by ams-Osram to demonstrate the potential for lab-on-a-chip applications, we found that there are clear differences in the near infrared absorbance of chocolate just beyond what the human eye can see.

NIR absorbance spectra from ams-Osram spectral sensor
NIR absorbance spectra using an experimental chip-scale NIR spectrometer from ams-Osram

We found a similar differentiation by % cocoa solids with Sagitto's miniature hand-held NIR spectrometer, which operates at higher wavelengths. Here (for example) are the absorbance spectra for Lindt Excellence chocolate bars.

NIR absorbance spectra for Lindt Excellence chocolate
NIR Absorbance Spectra of different Lindt Excellence chocolate bars using a Sagitto hand-held specrometer

If we process the above Lindt chocolate spectra using a mathematical technique called Linear Discriminant Analysis ('LDA'), and plot the analysis in 2 dimensions, we can see the different chocolate bars clearly separated - with the 30% cocoa solids bar furthest from the 95% cocoa solids.

Linear Discriminant Analysis for Lindt Excellence chocolates
Liner Discriminant Analysis of NIR Spectra for Lindt Excellence Chocolate Bars

The same pattern is revealed if we apply Linear Discriminant Analysis to a range of chocolates from another manufacturer, Whittakers. Their 'White' chocolate (for which cocoa butter makes up the entire 28% cocoa solids) on the far left and "92% Ghana Intense" on the far right.

Linear Discriminant Analysis for Whittakers chocolates
Linear Discriminant Analysis of NIR spectra for Whittakers chocolates

Single-Origin Chocolates

It is not surprising that we should be able to use near-infrared spectroscopy to readily distinguish between chocolates with different percentages of cocoa solids. After all, this is something that we can do to some extent with our own eyes. So what about chocolate bars which all have the same proportion of cocoa solids and sugar and which differ only in the origin of the cacao beans?

Foundry Chocolate produces an amazing range of single-origin chocolates, with no added cacao butter, lecithin or vanilla. When we apply Linear Discriminant Analysis to nine different bars of Foundry 70% chocolate, each bar with the same % cocoa solids but made from cacao beans from a different geographical origin, we can see clear differences (and similarities) between chocolate from different origins.

Linear Discriminant Analysis of NIR spectra for single origin Foundry chocolates
Linear Discriminant Analysis of Single-Origin Chocolates, made by Foundry Chocolate, New Zealand

Measuring Cocoa Solids With NIR Spectroscopy and Machine Learning

We next decided to see if we could use machine learning to predict the percentage cocoa solids in chocolate.

A machine learning model to measure the % cocoa solids in chocolate
A machine learning model to measure the percentage cocoa solids in chocolate

We know that the composition of 'cocoa solids' varies depending not only on the source of the beans and the method of their processing into chocolate, but also on whether extra cocoa butter and other compounds (such as milk products) have been added. So we were pleasantly surprised to find that we could build a reasonably accurate machine learning model that would predict the % cocoa solids just from a single NIR scan.

machine learning prediction for percentage cocoa solids in chocolate
Wellington Chocolate Factory Raspberry Milk 48% Cocoa Solids predicted as 49%

Measuring Chocolate Sensory Parameters With NIR Spectroscopy and Machine Learning

Studies such as this one conducted at the University of Melbourne's Sensory Laboratory have shown that accurate machine learning models can be built using near-infrared spectroscopy to predict not only physicochemical parameters in chocolate such as pH, Brix and viscosity, but also sensory parameters such as bitterness, saltiness, sourness, sweetness, and umami. The study concluded that:

"[machine learrning] models can be used as an alternative to consumer panels to determine the sensory properties of chocolate more accurately, with lower cost."

Conclusion

Our model for predicting coca solids was fun to create, but it is not very useful. After all, we can find out the % cocoa solids in a chocolate bar just by reading the packaging. However it does illustrate the discriminative power of NIR spectroscopy. We are confident that if we were to gather reference data for chocolate bars from a properly trained sensory panel then we would be able to develop accurate machine learning models to generate taste profiles for these chocolates.

We started this experiment out of curiosity, to see what we could learn and because we like eating chocolate! 70 bars of chocolate later, we've learned that there is considerable scope for combining machine learning with near-infrared spectroscopy to measure taste profiles - not just for chocolate but many other foods too!

Watch this space!

Footnote

The chocolate bars were all purchased in New Zealand, often from small speciality chocolate makers that pride themselves in sourcing beans direct from individual cacao farmers in the South Pacific, including:-

Our reference data came from what was printed on the manufacturer's labels, or their websites. And for this experiment we used two NIR spectrometers to scan the chocolate bars to obtain their NIR absorbance fingerprints:-

  • Sagitto's miniature NIR spectrometer, which measures in wavelength range of 900nm to 1700nm; and
  • an even smaller NIR spectrometer supplied by ams-Osram, which measures between 750nm to 1050nm

Subscribe to Sagitto's Blog

Get industry insights that you won't delete, straight in your inbox.
We use contact information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For information, check out our Privacy Policy.
George Hill
Sagitto Ltd
Sagitto's founder, George Hill, first started working with artificial intelligence during the 1980s, while developing 'expert systems' within Bank of America in London. On returning to New Zealand, he undertook part-time study with the University of Waikato's Machine Learning Group while working for Hill Laboratories, a well-known New Zealand commercial testing laboratory. This led to the formation of Sagitto Limited, dedicated to combining the power of artificial intelligence and machine learning with spectroscopy.

More news

Vendor Lockin

You Should Be Free To Leave

We believe that our customers should subscribe to our services willingly, because of the value that they receive and not because they are locked in to using us. That is why we take particular care to provide a smooth pathway, should our corporate customers decide to no longer use Sagitto's services.

Read Article
Authentication

Know Your Lavender Oil

'English lavender' oil is extracted from the flowers of Lavandula angustifolia, while 'Lavandin' oil is made from Lavandula x. intermedia, a hybrid cross between Lavandula angustifolia and Lavandula latifolia (Spike Lavender). Near infrared spectroscopy not only gives a very rapid and inexpensive method to tell the difference between these two types of oil, but also allows the composition of oils to be accurately measured.

Read Article
Data Science

Benchmark Against Machine Learning Models

The success of generative AI applications such as ChatGPT and DALL-E has increased public awareness of the power of artificial intelligence software. Sagitto's Benchmarking Service allows users of infrared spectroscopy instruments to benchmark their current models against models generated by machine learning.

Read Article