c u stomer lifetime val u e clv basics
play

C u stomer Lifetime Val u e ( CLV ) basics MAC H IN E L E AR N IN G - PowerPoint PPT Presentation

C u stomer Lifetime Val u e ( CLV ) basics MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON Karolis Urbonas Head of Anal y tics & Science , Ama z on What is CLV ? Meas u rement of c u stomer v al u e Can be historical or predicted


  1. C u stomer Lifetime Val u e ( CLV ) basics MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON Karolis Urbonas Head of Anal y tics & Science , Ama z on

  2. What is CLV ? Meas u rement of c u stomer v al u e Can be historical or predicted M u ltiple approaches , depends on b u siness t y pe Some methods are form u la - based , some are predicti v e and distrib u tion based MACHINE LEARNING FOR MARKETING IN PYTHON

  3. Historical CLV S u m re v en u e of all past transactions M u ltipl y b y the pro � t margin Alternati v el y - s u m pro � t of all past transactions , if a v ailable Challenge 1 - does not acco u nt for ten u re , retention and ch u rn Challenge 2 - does not acco u nt for ne w c u stomers and their f u t u re re v en u e MACHINE LEARNING FOR MARKETING IN PYTHON

  4. Basic CLV form u la M u ltipl y a v erage re v en u e w ith pro � t margin to get a v erage pro � t M u ltipl y it w ith a v erage c u stomer lifespan MACHINE LEARNING FOR MARKETING IN PYTHON

  5. Gran u lar CLV form u la M u ltipl y a v erage re v en u e per p u rchase w ith a v erage freq u enc y and w ith pro � t margin M u ltipl y it w ith a v erage c u stomer lifespan Acco u nts for both a v erage re v en u e per transaction and a v erage freq u enc y per period MACHINE LEARNING FOR MARKETING IN PYTHON

  6. Traditional CLV form u la M u ltipl y a v erage re v en u e w ith pro � t margin M u ltiple a v erage pro � t w ith the retention to ch u rn rate Ch u rn can be deri v ed from retention and eq u als 1 min u s retention rate Acco u nts for c u stomer lo y alt y, most pop u lar approach MACHINE LEARNING FOR MARKETING IN PYTHON

  7. Introd u ction to transactions dataset Online retail dataset Transactions w ith spent , q u antit y and other v al u es MACHINE LEARNING FOR MARKETING IN PYTHON

  8. Introd u ction to cohorts dataset Deri v ed from online retail dataset Assigned acq u isition month Pi v ot table w ith c u stomer co u nts in s u bseq u ent months a � er acq u isition Will u se it to calc u late retention rate MACHINE LEARNING FOR MARKETING IN PYTHON

  9. Calc u late monthl y retention Use � rst month v al u es to calc u late cohort si z es cohort_sizes = cohort_counts.iloc[:,0] Calc u late retention b y di v iding monthl y acti v e u sers b y their initial si z es and deri v e ch u rn v al u es retention = cohort_counts.divide(cohort_sizes, axis=0) churn = 1 - retention Plot the retention v al u es in a heatmap sns.heatmap(retention, annot=True, vmin=0, vmax=0.5, cmap="YlGn") MACHINE LEARNING FOR MARKETING IN PYTHON

  10. Retention table MACHINE LEARNING FOR MARKETING IN PYTHON

  11. Let ' s calc u late some CLV metrics ! MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON

  12. Calc u lating and projecting CLV MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON Karolis Urbonas Head of Anal y tics & Science , Ama z on

  13. The goal of CLV Meas u re c u stomer v al u e in re v en u e / pro � t Benchmark c u stomers Identif y ma x im u m in v estment into c u stomer acq u isition In o u r case - w e ' ll skip the pro � t margin for simplicit y and u se re v en u e - based CLV form u las MACHINE LEARNING FOR MARKETING IN PYTHON

  14. Basic CLV calc u lation # Calculate monthly spend per customer monthly_revenue = online.groupby(['CustomerID','InvoiceMonth'])['TotalSum'].sum().mean() # Calculate average monthly spend monthly_revenue = np.mean(monthly_revenue) # Define lifespan to 36 months lifespan_months = 36 # Calculate basic CLV clv_basic = monthly_revenue * lifespan_months # Print basic CLV value print('Average basic CLV is {:.1f} USD'.format(clv_basic)) Average basic CLV is 4774.6 USD MACHINE LEARNING FOR MARKETING IN PYTHON

  15. Gran u lar CLV calc u lation # Calculate average revenue per invoice revenue_per_purchase = online.groupby(['InvoiceNo'])['TotalSum'].mean().mean() # Calculate average number of unique invoices per customer per month freq = online.groupby(['CustomerID','InvoiceMonth'])['InvoiceNo'].nunique().mean() # Define lifespan to 36 months lifespan_months = 36 # Calculate granular CLV clv_granular = revenue_per_purchase * freq * lifespan_months # Print granular CLV value print('Average granular CLV is {:.1f} USD'.format(clv_granular)) Average granular CLV is 1635.2 USD Revenue per purchase: 34.8 USD Frequency per month: 1.3 MACHINE LEARNING FOR MARKETING IN PYTHON

  16. Traditional CLV calc u lation # Calculate monthly spend per customer monthly_revenue = online.groupby(['CustomerID','InvoiceMonth'])['TotalSum'].sum().mean() # Calculate average monthly retention rate retention_rate = retention_rate = retention.iloc[:,1:].mean().mean() # Calculate average monthly churn rate churn_rate = 1 - retention_rate # Calculate traditional CLV clv_traditional = monthly_revenue * (retention_rate / churn_rate) # Print traditional CLV and the retention rate values print('Average traditional CLV is {:.1f} USD at {:.1f} % retention_rate'.format( clv_traditional, retention_rate*100)) Average traditional CLV is 49.9 USD at 27.3 % retention_rate Monthly average revenue: 132.6 USD MACHINE LEARNING FOR MARKETING IN PYTHON

  17. Which method to u se ? Depends on the b u siness model . Traditional CLV model - ass u mes ch u rn is de � niti v e = c u stomer " dies ". Traditional model is not rob u st at lo w retention v al u es - w ill u nder - report the CLV . Hardest thing to predict - freq u enc y in the f u t u re . MACHINE LEARNING FOR MARKETING IN PYTHON

  18. Let ' s calc u late c u stomer lifetimes v al u es ! MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON

  19. Data preparation for p u rchase prediction MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON Karolis Urbonas Head of Anal y tics & Science , Ama z on

  20. Regression - predicting contin u o u s v ariable Regression - t y pe of s u per v ised learning Target v ariable - contin u o u s or co u nt v ariable Simplest v ersion - linear regression Co u nt data ( e . g . n u mber of da y s acti v e ) sometimes be � er predicted b y Poisson or Negati v e Binomial regression MACHINE LEARNING FOR MARKETING IN PYTHON

  21. Recenc y, freq u enc y, monetar y ( RFM ) feat u res RFM - approach that u nderlies man y feat u re engineering methods Recenc y - time since last c u stomer transaction Freq u enc y - n u mber of p u rchases in the obser v ed period Monetar y v al u e - total amo u nt spent in the obser v ed period MACHINE LEARNING FOR MARKETING IN PYTHON

  22. E x plore the sales distrib u tion b y month # Explore monthly distribution of observations online.groupby(['InvoiceMonth']).size() InvoiceMonth 2010-12 4893 2011-01 3580 2011-02 3648 2011-03 4764 2011-04 4148 2011-05 5018 2011-06 4669 2011-07 4610 2011-08 4744 2011-09 7189 2011-10 8808 2011-11 9513 dtype: int64 MACHINE LEARNING FOR MARKETING IN PYTHON

  23. Separate feat u re data # Exclude target variable online_X = online[online['InvoiceMonth']!='2011-11'] # Define snapshot date NOW = dt.datetime(2011,11,1) # Build the features features = online_X.groupby('CustomerID').agg({ 'InvoiceDate': lambda x: (NOW - x.max()).days, 'InvoiceNo': pd.Series.nunique, 'TotalSum': np.sum, 'Quantity': ['mean', 'sum'] }).reset_index() features.columns = ['CustomerID', 'recency', 'frequency', 'monetary', 'quantity_avg', 'quantity_total'] MACHINE LEARNING FOR MARKETING IN PYTHON

  24. Re v ie w feat u res print(features.head()) MACHINE LEARNING FOR MARKETING IN PYTHON

  25. Calc u late target v ariable # Build pivot table with monthly transactions per customer cust_month_tx = pd.pivot_table(data=online, index=['CustomerID'], values='InvoiceNo', columns=['InvoiceMonth'], aggfunc=pd.Series.nunique, fill_value=0) print(cust_month_tx.head()) MACHINE LEARNING FOR MARKETING IN PYTHON

  26. Finali z e data preparation and split to train / test # Store identifier and target variable column names custid = ['CustomerID'] target = ['2011-11'] # Extract target variable Y = cust_month_tx[target] # Extract feature column names cols = [col for col in features.columns if col not in custid] # Store features X = features[cols] MACHINE LEARNING FOR MARKETING IN PYTHON

  27. Split data to training and testing # Randomly split 25% of the data to testing from sklearn.model_selection import train_test_split train_X, test_X, train_Y, test_Y = train_test_split(X, Y, test_size=0.25, random_state=99) # Print shapes of the datasets print(train_X.shape, train_Y.shape, test_X.shape, test_Y.shape) (2529, 5) (2529, 1) (843, 5) (843, 1) MACHINE LEARNING FOR MARKETING IN PYTHON

  28. Let ' s w ork on data preparation e x ercises ! MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON

  29. Predicting c u stomer transactions MAC H IN E L E AR N IN G FOR MAR K E TIN G IN P YTH ON Karolis Urbonas Head of Anal y tics & Science , Ama z on

  30. Modeling approach Linear regression to predict ne x t month ' s transactions . Same modeling steps as w ith logistic regression . MACHINE LEARNING FOR MARKETING IN PYTHON

  31. Modeling steps 1. Split data to training and testing 2. Initiali z e the model 3. Fit the model on the training data 4. Predict v al u es on the testing data 5. Meas u re model performance on testing data MACHINE LEARNING FOR MARKETING IN PYTHON

Recommend


More recommend