At Firstleaf we care about matching you with wine that we know you'll love. How do we know what you like? Today we are taking a moment to speak with our data scientist and discuss some of the finer details of how that happens.
Firstleaf (FL): Matt, first can you tell us a little about your background, where you’re coming from?
Dr. Matthew Martz (MM): My background is in the biomedical sciences. I did my undergraduate work at Penn State in Biochemistry and Molecular Biology. From there I went on to get a Ph.D. in the same field from Thomas Jefferson, and did post doc work at U.N.C. focusing on quantitative cell biology and biophysics. I‘ve always had a particular fascination with computers and artificial intelligence, and the application of machine learning to real time computation and big data made up my primary research focus.
FL: Right, of course. So, as someone with a deep background in philosophy and theater, could you maybe break that down a bit…
MM: Ha, sure thing. My research was about teaching computers, using machine learning models and big data sets, to learn how to make specific decisions. In the medical field we would simulate the response to different therapeutic drugs to understand why patients could develop resistance to specific chemotherapies. We tested these hypotheses in cell models using live cell imaging, where machine learning played a critical role in not only developing and analyzing simulations, but also in comparing models to real data and making predictions that we further tested in the laboratory.
FL: How did you make the jump from cancer researcher to wine-savant?
MM: After I finished my post doc I decided to venture out of the academic setting and move into the private sector. With Firstleaf, I saw an opportunity to apply what I learned in the biomedical world to the challenge of personal taste. My work at Firstleaf is about using science to discover why people like certain flavors or styles in wine. I figured I could use the prescriptive mindset from academia and the knowledge of molecular biology, chemistry, and big data to build something that would provide recommendations for people based on their individual tastes. It was a natural evolution of what I’d been doing in the academic research arena- the variable names have changed, but the underlying mathematics have largely stayed the same.
FL: Ok, so now we’re getting back closer to my wheelhouse, the booze of the matter. Can you dig into what you built, and how it works?
MM: Absolutely. Every wine we make for the club gets sent out for chemical analysis, where we run a growing panel of tests. Some are pretty straight forward, like percentage of alcohol and pH value, but we dig layers deeper- testing not just the total level of acidity but the breakdown of the specific composition of components like gluconic vs. lactic vs. malic acid, for example. We’ll then take each user’s individual ratings and train a set of machine learning algorithms to understand an individual’s taste with respect to known chemical attributes. The magic of the algorithm is to figure out which sets or combinations of chemical attributes are most important to each user. We use that information to build an individual palate profile for every member, and the algorithm uses that profile to select the wines the member hasn’t yet had but will probably enjoy from our portfolio.
FL: Sounds like the user ratings are crucial to this process?
MM: By rating the wines the members are teaching the algorithm what they like or don’t like. As I mentioned before, the key trick is to figure out not just what attributes the members like, but how different combinations of attributes result in different outcomes. Maybe the user likes malic acid above X grams per liter, but only when the lactic acid is below Y grams per liter and overall alcohol is between A and B. In order to do the massive number of calculations for each member’s preferences, the algorithm uses machine learning principles and deep neural networks to test over a billion scenarios and arrive at the best possible prediction for what will delight the member’s palate. Thus, training several machine learning algorithms on user input, we are able to generate recommendations that will get better and better over time. We can further use these data to understand what our club members really want and guide our wine production. So yes, ratings are crucial to the process!
FL: A Billion with a B??
MM: Yep, a billion with a B. The power of machine learning isn’t as much being able to do math we can’t do ourselves, but the power to go into the data and find deep relationships that would be too cumbersome for any human to do in a reasonable timeframe. What we can do is take the member’s ratings, attach the plus and minus to each wine’s chemical panel, and the machine will go in and figure out how you differentiate between combinations of chemical attributes and predict how you’ll rate a wine you’ve never tasted. Sometimes it can be obvious, like this wine is clearly sweet and this user likes sweet wine so let’s give them that one instead of the one that’s bone dry. But there is also subtle interplay between the attributes that are less obvious, and that’s where the algorithm goes to work to uncover subtle relationships that ultimately govern why we like or don’t like particular wines. We also layer these decisions into several downstream algorithms that let us really refine our predictions and home in on the best wines for each individual user.
FL: And you do this for every single member, or can you do it for a few and then figure “well, since Matt liked these five wines and so did Lex, we can assume they have the same preferences”?
MM: What you are describing is called collaborative filtering. And no, we don’t do that because we believe each person’s palate is distinct. Even though we may have liked the same five wines at the outset that’s not a great predictor of each individuals taste. There are also critical breakdowns in this approach that present challenges when building a system like this. When I set out to develop how we made recommendations, I knew I wanted to employ a truly individualized approach to match the personalization our club members expected of Firstleaf. Therefore, we look at each member as having a unique palate and use only their ratings to teach the algorithm what they like, so all member recommendations are specific to one’s individual palate profile. The more a user rates the wines, the better the algorithm’s understanding of their palate, the more accurate the recommendations.
FL: If it’s that sophisticated with just an up or down rating, why not use a 1-5 scale?
MM: The algorithm works better off a binary input, which also removes the subjectivity of each individual’s perception of where they are on a scale of 1-5. Sometimes a person’s perception of what a 4 means will change over time, or even day by day. The binary rating system eliminates some of that subjectivity and variance, while still getting the accuracy that we need to produce the best recommendations. We borrowed some of these findings from companies like Netflix and Spotify who realized the binary ratings actually lead to better recommendations – stand on the shoulders of giants, as they say.
FL: When in doubt, do what Netflix does. What about if I never rate a wine, what happens then?
MM: For neutrals (no ratings) we look at the composition of the wines and split them into a larger similar group and a smaller dissimilar using a particular set of algorithms I have been working on for some time. We then assign the larger group as positive votes, the smaller outliers as negatives, and build an initial exploratory palate model based on this split chemistry approach. This gives us a pretty good starting model and set of recommendations until the user guides the algorithm in a more specific manner.
FL: And if I’m just the easiest and like all the wines? Or the grouchiest and like none of the wines?
MM: That’s when we generate something we call “phantom wines.” A different set of machine learning algorithms will take all your positive ratings and make a wine that represents your “ideal” wine. This phantom wine is then fed through a special set of filters that analyze similarity of chemical composition to generate a set of recommendations. If they’re all negative it’s true in the counter-positive: we create your “ideal” dislike wine and find wines for you that are essentially the antithesis of that wine.
FL: Ok, I’m sold on the process, but how good is it at actually predicting the wines I’m going to like?
MM: Actually, pretty good, and getting better as we test for more attributes. Right now, after 3 ratings there’s about an 83% probability of picking a wine you’re going to like. As you rate more wines, the algorithm understands the boundaries of your palate and gets a better sense of what specific combination of attributes result in a delightful experience. This allows us to select wines that may be more unexpected, varietals alike Airen or Monastrell, because we’re confident their underlying chemistry is in line with a member’s palate profile.
FL: Wow. Matt, thank you so much for explaining this. I feel like I already understand it so much better. Is there anyone else out there doing this much?
MM: Ha. You are welcome! And, not that we know of. We think that Firstleaf really does have the most accurate suggestions of any wine club out there.