Customer Lifetime Value
Contents
Customer Lifetime Value#
%load_ext autoreload
%autoreload 2
%matplotlib inline
Imports#
from fastai.vision.all import *
from aiking.data.external import * #We need to import this after fastai modules
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import cross_val_score
from sklearn.feature_selection import mutual_info_regression
Getting Dataset#
#kaggle datasets download -d pankajjsh06/ibm-watson-marketing-customer-value-data
path = untar_data("kaggle_datasets::pankajjsh06/ibm-watson-marketing-customer-value-data"); path
Path('/content/drive/MyDrive/PPV/S_Personal_Study/aiking/data/ibm-watson-marketing-customer-value-data')
path.ls()
(#1) [Path('/content/drive/MyDrive/PPV/S_Personal_Study/aiking/data/ibm-watson-marketing-customer-value-data/WA_Fn-UseC_-Marketing-Customer-Value-Analysis.csv')]
df = pd.read_csv(path/"WA_Fn-UseC_-Marketing-Customer-Value-Analysis.csv")
df.head().T
0 | 1 | 2 | 3 | 4 | |
---|---|---|---|---|---|
Customer | BU79786 | QZ44356 | AI49188 | WW63253 | HB64268 |
State | Washington | Arizona | Nevada | California | Washington |
Customer Lifetime Value | 2763.519279 | 6979.535903 | 12887.43165 | 7645.861827 | 2813.692575 |
Response | No | No | No | No | No |
Coverage | Basic | Extended | Premium | Basic | Basic |
Education | Bachelor | Bachelor | Bachelor | Bachelor | Bachelor |
Effective To Date | 2/24/11 | 1/31/11 | 2/19/11 | 1/20/11 | 2/3/11 |
EmploymentStatus | Employed | Unemployed | Employed | Unemployed | Employed |
Gender | F | F | F | M | M |
Income | 56274 | 0 | 48767 | 0 | 43836 |
Location Code | Suburban | Suburban | Suburban | Suburban | Rural |
Marital Status | Married | Single | Married | Married | Single |
Monthly Premium Auto | 69 | 94 | 108 | 106 | 73 |
Months Since Last Claim | 32 | 13 | 18 | 18 | 12 |
Months Since Policy Inception | 5 | 42 | 38 | 65 | 44 |
Number of Open Complaints | 0 | 0 | 0 | 0 | 0 |
Number of Policies | 1 | 8 | 2 | 7 | 1 |
Policy Type | Corporate Auto | Personal Auto | Personal Auto | Corporate Auto | Personal Auto |
Policy | Corporate L3 | Personal L3 | Personal L3 | Corporate L2 | Personal L1 |
Renew Offer Type | Offer1 | Offer3 | Offer1 | Offer1 | Offer1 |
Sales Channel | Agent | Agent | Agent | Call Center | Agent |
Total Claim Amount | 384.811147 | 1131.464935 | 566.472247 | 529.881344 | 138.130879 |
Vehicle Class | Two-Door Car | Four-Door Car | Two-Door Car | SUV | Four-Door Car |
Vehicle Size | Medsize | Medsize | Medsize | Medsize | Medsize |