# REAL WORLD

### By John Toczek, Manoj Pai and Gauri Telang

#### Mobile app integrates statistical modeling for wine recommendations.

Statistical models are being used everywhere today to predict consumer behavior such as how much someone will like a movie they haven’t yet seen to pricing for hotel rooms. However, there is one area these models have not yet been applied and where they have incredible potential: mobile applications.

One example of this mobile predictive technology is Wine Stars, a wine recommendation application for the iPhone, which was recently launched in the Apple App Store. With hundreds of thousands of wines available on the market, it is almost impossible to discover new ones that you will like with any reliability. Wine Stars utilizes user ratings and statistical modeling to predict how much a user will like a wine he or she has never tried.

Figure 1: Wine Stars use statistical modeling to help users find new wines that they are likely to love.

Wine Stars has a built-in bar code scanner that allows users to scan wine bar codes directly from the bottles and then record their personal ratings (from 1 to 5 stars) into the app. It will then subsequently predict customized ratings for new wines based on users’ past ratings of other wines. This technology is particularly useful during in-store shopping as users can scan many wines and get instant recommendations on which ones they are most likely to enjoy.

Wine Stars uses mathematical modeling to create these customized predictions for each individual user. The more ratings that are entered by the user, the more accurate the predictions become.
There are many ways to model these kinds of predictions. Larger companies can bring to bear the effectiveness of ensemble modeling – that is, multiple modeling methods blended together. But for small applications on a limited budget, there are many simple and accurate options. In this case, Wine Stars uses Pearson Product Momentum combined with nearest neighbor (knn) because of its ease of programming integration into small handheld applications and straightforward calculations.

Pearson Product Momentum calculates a linear correlation dependence between two variables providing a value between +1 and -1. +1 represents a perfect correlation, 0 represents no correlation, and -1 represents a reverse correlation.

The simple example displayed in Table 1 examines how modeling using the Pearson Product Momentum methodology works.

Table 1: How will Frank rate Wine B?

Table 1 shows two wines that have been rated by five users (and one additional user, Frank, who has not yet rated Wine B). Because the users rate Wine A and Wine B exactly the same, the Pearson Product Momentum Correlation is +1. This means that whatever rating users give to Wine A, they are also likely to give to Wine B. If everyone else is rating Wine A the same as Wine B, then we can reasonably conclude that Frank will do the same. This allows us to predict that Frank will rate Wine B with two stars.

Based on that simple example, we can create a Pearson Product Momentum correlation matrix for multiple wines, allowing Wine Stars to generate predictions on all wines.

Figure 2: The Pearson Product Momentum equation.

Table 2 shows four different wines and their ratings by six users. Note that Frank has not rated two of these wines. In order to make rating predictions for Frank’s unrated wines, we will first build a matrix of Pearson correlations for all wines. Using the Pearson Product Momentum equation, we come up with the matrix shown in Table 3.

Table 2: User wine ratings.

Table 3: The Pearson Correlation matrix.

We can begin to make wine rating predictions as soon as Frank has rated just one single wine (as he has done already for two of them).

In order to predict Frank’s rating for Guardian Peak Shiraz 2002 we look for its nearest neighbor in the matrix table. In this case it is Crios Cabernet 2011 (with a Pearson score of 0.95). Frank rated Crios Cabernet 2011 with five stars so we can make a reasonable guess that he will rate the Guardian Peak Shiraz 2002 with five stars as well.

In order to predict Frank’s rating for Whitehaven Sauvignon Blanc 2012 we look for its nearest neighbor in the matrix table. In this case it is Spy Valley Sauvignon Blanc 2012 (with a Pearson score of 0.87). Frank rated Spy Valley Sauvignon Blanc 2011 with three stars so we can make a reasonable guess that he will rate the Whitehaven Sauvignon Blanc 2003 with three stars as well.
Making predictions based on only the single most highly correlated wine can cause a lot of variability. To counter this and increase stability and accuracy of the predictions, Wine Stars incorporated a nearest neighbor (knn) approach to smooth out the predictions. Instead of choosing just the one nearest neighbor, it uses the ratings for several of the nearest neighbors.

#### Wine Stars in Action

Wine Stars is just one example of integrating predictive modeling into handheld applications. For an interactive, hands-on walk-through of Wine Stars, try the following exercise with your iPhone.
First you’ll need to install Wine Stars, which is free in the Apple App Store. Just search for “WineStarsApp.” Once it is installed, scan the bar codes below one at a time and rate the wines based on their descriptions. You can also use any wines you have at home. As you scan and rate wines, Wine Stars will begin to make customized predictions as it learns about your preferences.

Select reviewer comments:
Scents of artichoke, herbaceous flavors, fresh, dry finish, good volume, ruby grapefruit.

Select reviewer comments:
Light, crisp, clean, refreshing, green apples, citrus fruits, well-structured, sophisticated.

Select reviewer comments:
Lemon peel, citrusy pear, nutmeg, floral tones, round and soft, bright acidity, full body.

Select reviewer comments:
Full bodied, rich fruit, aromas of toast, smoked meats, black cherry, plum and currants, with hints of violets.

Select reviewer comments:
Black fruit, tobacco, mocha aromas, smooth, rich and full bodied.

Select reviewer comments:
Dense blackberry, raspberry flavors, white plum, coffee, oak notes, smoky, round and slightly creamy.

John Toczek (toczek@gmail.com) is the senior director of decision support and analytics for ARAMARK Corporation in the Global Operational Excellence Group, and the creator of Wine Stars. Gauri Telang (gauri.t@mnop.in) and Manoj Pai (manoj.p@mnop.in), of MNOP Consultants LLC, were instrumental in the development of Wine Stars. While Manoj coded the User Interface, Gauri coded the server-side programming and implemented the mathematical models.