What's That Beer Style? Ask a Neighbor, or Two

Beer is delicious but it is not one thing. If you disagree with the former part of the previous sentence please keep the latter in mind[1]. Think of sports, for instance. Many would agree with the blanket statement "sports are fun" but depending on what you have in mind two people can easily have opposite reactions to being presented the opportunity to play ping-pong. Sports are not one thing, music is not one thing, and neither is beer.

Presented with a finely crafted brew in a style of your preference it is difficult to have a more pleasurable gastronomical experience. Throw off one of those two criteria, craftsmanship or style preference, and you're likely to have a decent experience at best or an off-putting one at worst.

I was recently dismayed to find that a beer I had been enjoying, Naughty Boy[2], a purported stout made in collaboration by two Dutch breweries, LOC and de 3 Horne, was not particularly well received. Upon reading the online reviews I was convinced that the reviews were unwarranted. Something was missing and whether from my perspective or others was what I went about investigating.

Of the fourteen top reviewers that rated this on RateBeer (Accessed: 24 July 2016) eleven mentioned “bitter”[3], and some more than once. Consumers naturally have predefined ideas about what they are getting into. I believe the misplaced expectations of what a stout should taste like left reviewers surprised, and clearly not always in a pleasant way.

Is Naughty Boy a stout or is it a black India Pale Ale (BIPA)? The color and roast undertones say “stout”. The nose and forward flavor say “hops”. Expectations help determine experience and I believe the brewer is shortchanging themselves and their customers by possibly miscategorizing this beer.

In an effort to bear this out I collected data for 108 Dutch beers, 36 apiece for the styles stout[4], India Pale Ale (IPA), and BIPA. This was a simple two dimensional feature set consisting of alcohol by volume (ABV) and international bitter and units (IBU), which determine, you guessed it, the level of bitterness found in a beer. Though ABV numbers were available for all beers I was not as fortunate when it came to the IBU numbers. Upon removing NaN’s from the collection I was left with a total of 71 beers: 28 IPA, 27 BIPA, and 16 stouts.

Working with two primary features made it simple to visualize the data via a scatter plot, with ABV on the x-axis and IBU on the y-axis. I included a third feature in the plot by differentiating the dots by beer style using different colors and shapes for quick identification. Implementing a simple one nearest neighbor (1-nn) function I color-coded the entire background region by the color of the nearest beer and superimposed the beers on top of this new background. The final step prior to running any analysis was standardizing the features due to the difference in scale (ABV: 2–14, IBU: 0–120) and re-creating the plot.

With the above data and visualization preparation in hand I went about training a k-nearest neighbor (kNN) model using scikit-learn. By running a 10-fold cross 

validation on a range of k (from 1 to 31) I determined that for this limited data set (and yes, we should use more data) k==2 would be the likeliest candidate for generalizing on unseen data . 

The next steps from here should have been clear and straightforward: standardize the features of LOC's Naughty Boy and submit it to the model for classification. As luck would have it, we found ourselves with a similar limitation a second time, LOC does not provide the IBU for Naughty Boy. Apparently this is a little shtick of theirs that extends to other beer collaborations We had come too far to turn back now, besides the fun had just started and it now became clear that the visualization would prove to be more than simply ornamental.

Improvisation ensued: we took the one beer feature that was available, ABV, and standardized it; next we plotted all candidates for the entire IBU range of this ABV; lastly, each of of the candidate points above were then categorized by their two closest beer style neighbors and colored in based on scores. Naughty Boy occasionally receives a vote for “stout”, but never without a matching IPA or BIPA vote. In fact, the IPA and BIPA votes occur most often and are the two styles that represent unanimous categorizations. Above a certain IBU, fifty-five, there are no votes for stout as a style.

If Naughty Boy has an IBU of 55 or greater I argue its creators should reconsider its style and thereby, hopefully, re-calibrate expectations, improve experiences, and raise the estimation of a possibly unfairly maligned beer.


[1] This post is an attempt at highlighting just this point: that beer is not one set commodity (sure it may have been in the dark ages of American food & beverage mass production during the 50’s and most of the 80’s), that there are a slew of different styles, with more being created through the years incidentally, and that one's expectation of what they're about to consume has an influence on their appreciation. 

[2] Great name, right? It depends on your perspective but one of the other pleasures of good/craft beer is coming across all types of ridiculous names.

[3] The bitterness I first experienced in drinking this beer was of a different kind. It was a bitterness common enough to beers but of a different style, India Pale Ale (IPA). This type of bitterness is hop-based and is associated with the floral notes and the smell, or nose, of a beer.

[4] To bring everyone up to speed stout is a beer style that is black in color with a tan foam head typically having roasted and malty flavors. There are a ton of sub-styles when it comes to stouts that I do not intend to even scratch the surface of but for which I highly recommend first hand field research. Bitter may also be a characteristic of this kind of beer, but need not be and often times you will also hear descriptors such as creamy, sweet, and/or roasted. This last characteristic can certainly lend itself to a bitter flavor but it is typically of the coffee bitterness variety.

Views: 1447

Tags: Python, kNN, scikit-learn, visualization


You need to be a member of Data Science Central to add comments!

Join Data Science Central

© 2021   TechTarget, Inc.   Powered by

Badges  |  Report an Issue  |  Privacy Policy  |  Terms of Service