Machine Learning for Marketing in Python
Karolis Urbonas
Head of Analytics & Science, Amazon
Use first month values to calculate cohort sizes
cohort_sizes = cohort_counts.iloc[:,0]
Calculate retention by dividing monthly active users by their initial sizes and derive churn values
retention = cohort_counts.divide(cohort_sizes, axis=0)
churn = 1 - retention
Plot the retention values in a heatmap
sns.heatmap(retention, annot=True, vmin=0, vmax=0.5, cmap="YlGn")
Machine Learning for Marketing in Python