Skip to content

chapman-mcd/Starbucks_Sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Scientist Capstone Project - Starbucks

This is the final project for my Data Scientist Nanodegree with Udacity. The project is to analyze a simulated dataset of an A/B test of different marketing offers to the customers of a fictional coffee company (which I have called Stuckbars).

An introduction to the project is available in this video and the complete problem statement is included at the end of this readme.

Before looking into the notebooks, I recommend reading the one of the accompanying blog posts - the narrative version and the version structured around the project rubric.

Project Discussion

The major challenge with this project is how to process the event data created by the test (called the 'transcript' in the problem statement). Customers can take a number of different paths through the marketing offers, making data processing and preparation difficult.

I set the following goal for the project:

  • The objective is to determine the best offer to present to each customer

  • The best offer is the one that yields maximum return for Stuckbars.

I achieve this goal by determining the best-performing overall offer, looking through the customer base to find subsets who respond better to different offers, and applying supervised learning through a tensorflow neural net to predict the best offer to present to each customer.

Dependencies

This project depends on numpy, pandas, matplotlib, seaborn, jupyter, tensorflow, scikit-learn and progressbar2 libraries.

Installation

From a clean directory, using conda:

conda create -n stuckbars
conda activate stuckbars
conda install tensorflow numpy pandas matplotlib seaborn progressbar2 scikit-learn
git clone https://github.com/chapman-mcd/Starbucks_Sandbox

Instructions

The project is entirely contained in the notebook. Type jupyter notebook and select Starbucks_Sandbox.ipynb.

Included Files

  • Main notebook: Starbucks_Sandbox.ipynb
  • Supervised Learning Notebook: Sandbox_ML.ipynb
  • /data: contains the simulated data files
  • /images: various image files created for the blog post
  • /models: model artifacts from machine learning

Acknowledgements


Problem Statement

Introduction

This data set contains simulated data that mimics customer behavior on the Starbucks rewards mobile app. Once every few days, Starbucks sends out an offer to users of the mobile app. An offer can be merely an advertisement for a drink or an actual offer such as a discount or BOGO (buy one get one free). Some users might not receive any offer during certain weeks.

Not all users receive the same offer, and that is the challenge to solve with this data set.

Your task is to combine transaction, demographic and offer data to determine which demographic groups respond best to which offer type. This data set is a simplified version of the real Starbucks app because the underlying simulator only has one product whereas Starbucks actually sells dozens of products.

Every offer has a validity period before the offer expires. As an example, a BOGO offer might be valid for only 5 days. You'll see in the data set that informational offers have a validity period even though these ads are merely providing information about a product; for example, if an informational offer has 7 days of validity, you can assume the customer is feeling the influence of the offer for 7 days after receiving the advertisement.

You'll be given transactional data showing user purchases made on the app including the timestamp of purchase and the amount of money spent on a purchase. This transactional data also has a record for each offer that a user receives as well as a record for when a user actually views the offer. There are also records for when a user completes an offer.

Keep in mind as well that someone using the app might make a purchase through the app without having received an offer or seen an offer.

Example

To give an example, a user could receive a discount offer buy 10 dollars get 2 off on Monday. The offer is valid for 10 days from receipt. If the customer accumulates at least 10 dollars in purchases during the validity period, the customer completes the offer.

However, there are a few things to watch out for in this data set. Customers do not opt into the offers that they receive; in other words, a user can receive an offer, never actually view the offer, and still complete the offer. For example, a user might receive the "buy 10 dollars get 2 dollars off offer", but the user never opens the offer during the 10 day validity period. The customer spends 15 dollars during those ten days. There will be an offer completion record in the data set; however, the customer was not influenced by the offer because the customer never viewed the offer.

Cleaning

This makes data cleaning especially important and tricky.

You'll also want to take into account that some demographic groups will make purchases even if they don't receive an offer. From a business perspective, if a customer is going to make a 10 dollar purchase without an offer anyway, you wouldn't want to send a buy 10 dollars get 2 dollars off offer. You'll want to try to assess what a certain demographic group will buy when not receiving any offers.

Final Advice

Because this is a capstone project, you are free to analyze the data any way you see fit. For example, you could build a machine learning model that predicts how much someone will spend based on demographics and offer type. Or you could build a model that predicts whether or not someone will respond to an offer. Or, you don't need to build a machine learning model at all. You could develop a set of heuristics that determine what offer you should send to each customer (i.e., 75 percent of women customers who were 35 years old responded to offer A vs 40 percent from the same demographic to offer B, so send offer A).

About

Capstone project for Udacity Data Science Nanodegree, analyzing a simulated dataset created by Starbucks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published