Starbucks Recommendation System

Abhinav Jha
6 min readMay 15, 2020

Introduction

Starbucks has provided a dataset that emulates the behavior of customers using the Starbucks rewards mobile app. The Starbucks app provides a way to advertise and share offers with the customers. Customers can also use it to pay at the stores. Starbucks sends different types of advertisements and offers once every few days to its customers. A customer might get one of the following:

  • Buy one get one free (BOGO) offer
  • Informational offer (i.e., mere advertisement)
  • Discount offer

Discount and BOGO offers have a challenge, that is, the customer must make a minimum purchase before it can redeem the offer.n the case of the informational offers, the expiration date is when the customer stops feeling the influence of the advertisement.

Problem Statement

The goal of sending advertisements and offers to customers is to increase customer purchases. However, it would be naive to send all offers to all customers at the same time.

The goal of the project is to take advantage of the transactions and demographics data to determine the offers that should be targeted to different groups of customers.

Datasets

The following data files have been provided and included in the project’s repo

  • portfolio.json contains the details of each offer: duration, reward, type, etc
  • profile.json contains demographic information of the customer.
  • transcript.json contains all customer's activity: transactions offers received, offers viewed, and offers completed.

Data Analysis

Population

From the datasets, we first note that the simulated data was obtained for a period of 30 days, with 306,534 events. Each event represents a transaction, an offer received, an offer viewed, or an offer completed.

Figure 1: Population

The figure shows the distribution of the population based on gender, income, and age.

We have noted the information that:

8,500 customers are male,

6,100 are female, and

around 200 belong to another gender.

In the case of the income, we observe that the curve roughly approaches a normal curve with a mean around 65,000 and a standard deviation of 21,000. Finally, the age also seems to approach a normal distribution. It is truncated on the left side of the curve due to the fact that a customer must be 18 years or older to be part of the Starbucks program. The mean of the age is 54 years and the standard deviation is 17.

Expense

Figure 2: Expenses

Now, we observe that the average expense of a single transaction follows a bimodal distribution. The first lobe is centered around $2.5 and the second one around $18. In the case of the distribution of the total expense done by a customer, the values seem to decrease exponentially.

Figure 3: Expenses based on gender

When separating the data based on gender, we note that the women make average purchases of $17.5, others of $15, and men of $12. However, we also note that the total amount of money spent by men and women is similar while others spend a fraction of that. This is distributions are directly affected by the number of members of each gender group.

Figure 4: Average Transaction value and Expenses

In the case of the average transaction and the total expense, we see that the values increase as the income of the customer increases, which is expected. People that make less than $30,000 have an average transaction of $6 while people making more than $90,000 have transactions of more than $25. In the case of the total expense, the values go from $60 to $180 in the same range of income.

Offers

Figure 5: Offer and its types

The figure above shows the distribution of offers received by customers. We note that each 30,000 discount and BOGO offers have been received, and 15,000 informational ones. This detail is important since the simulated data does not have any bias towards a specific offer, each customer has the same changes in receiving any offer.

Recommendation System

Based on the data we have observed, we noticed that different customer groups have different spending habits, that might be influenced by the fact that they received an offer or not. For instance, the correlation coefficient of 0.52 suggesting that there is a moderate correlation between the net expense (i.e., total expense - reward received) and whether a customer completed an offer or not. Similarly, the correlation with the completion of BOGO and discount offers is 0.39 and 0.40, respectively. ink.Finally, we observe a moderate correlation of 0.38 with the income of the customers.

System

Initially, we consider a system that recommends an offer that has been completed by a group of customers with the highest median of the net expense value. This system assumes a dependency between offer completion and net expense and aims at maximizing the net expense.

In order to use significant samples, we impose the following conditions:

  1. Customers with a positive net expense.
  2. Customers with at least 5 transactions completed.
  3. Only use customers that viewed and completed the offer.

The first condition is due to the fact that some customers received more rewards than the amount of money they spent. This is possible due to the fact that

(a) a customer might have multiple offers active at the same time, and

(b) a transaction might help multiple offers to reach their goal.

The second condition is necessary so we consider customers engaged with the offer/reward system. Finally, the third condition also targets considering customers engaged with the system. There are a few customers that completed offers without knowing that they received an offer.

Evaluation

In order to formally evaluate these methods, we should pick a control and test groups with real users. The two recommendation systems can be used together. That is, the systems should be used for customers that do not provide their personal information, while the one with filters can be used for customers that do.

In this experiment, the control group would be subject to a random distribution of offers in which each user has the same odds of receiving the offer. This distribution mimics the same used to generate the simulated data provided for this analysis. The control group would use the two recommendation systems provided in this project.

Conclusions

This project provided a way to implement a real recommendation system from scratch. The process was engaging since it required the implementation of all the steps of the data science methodology. It was interesting as well as difficult to decide what kind of data to use for the analysis. The project could have taken different directions if other aspects of the data were taken into account. For instance, instead of using the net expense and the average transaction value, we could have used the frequency at which offers were completed, or what was the time that customer took to complete an offer after viewing it. This was possible thanks to the timestamps provided in the datasets.

Also, other recommendation systems could have been explored. Modeling the data could have been another choice to recommend offers. This was not picked since the simulated data made a lot of simplifications in comparison to the real app. The mathematical model would have needed considerable adjustments in order to be used in production systems. Picking metrics and methods that can be used in both the simulated system and the production system was considered in the design.

To improve the recommendation system, we could include other metrics. For instance, the frequency at which offers are completed would add an interesting dimension to the system. Also, our system does not take into account the number of valid offers a customer has given time. As we noted in our analysis, some customers took advantage of this to maximize the reward received at the least possible expense. To prevent this from happening, the company could limit the number of offers a customer receives, or if the customer has multiple offers, a purchase only helps the completion of a single offer.

--

--