Understanding our customers is the key providing them a good service and sustain a profitable business. To understand them well, we need to pay attention on their purchase behaviour. One way we can collect and analyse their purchasing behaviour through an app, then identify their needs based on demographics.
- Project Overview
- Problem Statement / Metrics
- Installation
- Project Motivation
- File Descriptions
- Analysis Summary
Customer satisfaction drives business success and data analytics provides insight into what customers think. For example, the phrase "360-degree customer view" refers to aggregating data describing a customer's purchases and customer service interactions.
The Starbucks Udacity Data Scientist Nanodegree Capstone challenge data set is a simulation of customer behavior on the Starbucks rewards mobile application. Periodically, Starbucks sends offers to users that may be an advertisement, discount, or buy one get on free (BOGO). An important characteristic regarding this dataset is that not all users receive the same offer.
This data set contains three files. The first file describes the characteristics of each offer, including its duration and the amount a customer needs to spend to complete it (difficulty). The second file contains customer demographic data including their age, gender, income, and when they created an account on the Starbucks rewards mobile application. The third file describes customer purchases and when they received, viewed, and completed an offer. An offer is only successful when a customer both views an offer and meets or exceeds its difficulty within the offer's duration.
The problem that I chose to solve is to build a model that predicts whether a customer will respond to an offer. My strategy for solving this problem has four steps. First, I will combine the offer portfolio, customer profile, and transaction data. Each row of this combined dataset will describe an offer's attributes, customer demographic data, and whether the offer was successful. Second, I will assess the accuracy and F1-score of a naive model that assumes all offers were successful. This provides me a baseline for evaluating the performance of models that I construct. Accuracy measures how well a model correctly predicts whether an offer is successful. However, if the percentage of successful or unsuccessful offers is very low, accuracy is not a good measure of model performance. For this situation, evaluating a model's precision and recall provides better insight to its performance. I chose the F1-score metric because it is "a weighted average of the precision and recall metrics". Third, I will compare the performance of logistic regression, random forest, and gradient boosting models. Fourth, I will refine the parameters of the model that has the highest accuracy and F1-score.
This project requires Python 3.x and the following Python libraries installed:
Or you could install Anaconda, a pre-packaged Python distribution that contains all of the necessary libraries and software for this project.
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. Using this dataset I have built a model that predict whether customers will respond to offers or not.
The Starbucks Udacity Data Scientist Nanodegree Capstone challenge data set contains simulated data that mimics customer behavior on the Starbucks rewards mobile app. Periodically, 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). However, some users might not receive any offer during certain weeks. Using the data, I aim to :
1. Gain understanding what types of customer characteristics and demographics are there.
2. What offer should be sent to each customer ?
3. How well can we predict customer response to offer ?
The data is contained in three files:
- portfolio.json - containing offer ids and meta data about each offer (duration, type, etc.).
- profile.json - demographic data for each customer.
- transcript.json - records for transactions, offers received, offers viewed, and offers completed.
Here is the schema and explanation of each variable in the files:
- id (string) - offer id
- offer_type (string) - type of offer ie BOGO, discount, informational
- difficulty (int) - minimum required spend to complete an offer
- reward (int) - reward given for completing an offer
- duration (int) - time for offer to be open, in days
- channels (list of strings)
- age (int) - age of the customer
- became_member_on (int) - date when customer created an app account
- gender (str) - gender of the customer (note some entries contain 'O' for other rather than M or F)
- id (str) - customer id
- income (float) - customer's income
- event (str) - record description (ie transaction, offer received, offer viewed, etc.)
- person (str) - customer id
- time (int) - time in hours since start of test. The data begins at time t=0
- value - (dict of strings) - either an offer id or transaction amount depending on the record
Analysis complete summary is present here in a Medium Post.
The dataset used in this project contains simulated data that mimics customer behavior on the Starbucks rewards mobile app. Starbucks® Rewards program: Starbucks Coffee Company.
- 360-degree customer view definition
- Model accuracy definition
- F1-score definition
- Evaluation of models with unbalanced classes
- Beyond accuracy precision and recall
- Logistic regression detailed overview
- Random forest algorithm
- Gradient boosting algorithm
- Multi label binarizer
- Why one hot encode data in machine learning?
- Using categorical data with one hot encoding
- Is there a rule-of-thumb for how to divide a dataset into training and validation sets?
- The use of feature scaling in scikit-learn
- Machine learning evaluate classification model
- Hyperparameter tuning the random forest in Python using scikit-learn
- Random forest feature importances
- Gentle introduction to the bias variance trade-off in machine learning
- Decision tree or logistic regression?
- Random forests ensembles and performance metrics
- A Kaggle master explains gradient boosting
- Gradient boosting tree vs random forest
- How can the performance of a Gradient Boosting Machine be worse than Random Forests
- Overfitting in machine learning
- Rotate axis text in Python matplotlib
- Analytic dataset definition
- Set order of columns in pandas DataFrame
- Python pandas selecting rows whose column value is null none nan
- scikit-learn MultiLabelBinarizer
- Python round up to the nearest ten
- datetime strptime in Python
- How to match exact multiple strings in Python
- How to determine a Python variable's type
- Pandas DataFrame settingwithcopywarning a value is trying to be set on a copy
- Should binary features be one hot encoded
- Select pandas DataFrame rows and columns using iloc, loc and ix
- How to merge two dictionaries in a single expression
- Python to print out status bar and percentage
- Progress bar introduction
- Progress bar documentation
- Reversing one hot encoding in pandas
- If else in a list comprehension
- Pandas DataFrame groupby two columns and get counts
- Converting a pandas groupby object to DataFrame
- Change order of columns in stacked bar plot
- Print Python version