← Series by topic

Marketing Science in Theory and Practice

Follow chapters 2–12 of the book, from customer segmentation and purchase models to churn, sales forecasting, lifetime value, and recommendations, with theory and Python examples.

Prerequisites Basic Python, probability and statistics, calculus, and matrix operations.

  1. Chapter 2: Grouping customers from purchase histories: k-means and GMM

    Group customers with k-means and GMM, compare purchase patterns and membership probabilities, and use the results to plan and test marketing actions.

  2. Chapter 3: When do new-product sales peak? Forecasting adoption with the Bass model

    Derive the Bass model, estimate monthly adoption and market size, and check forecast errors, uncertainty, and changes as more sales data arrive.

  3. Chapter 4: How do price and performance affect product choice?

    Estimate a multinomial logit model, interpret odds ratios and willingness to pay, and compare a price cut with longer battery life in Python.

  4. Chapter 5: Can purchase counts alone describe a brand's position?

    Model purchase counts with the NBD and brand choice with a Dirichlet distribution. Compare penetration, purchase frequency, and model fit in Python.

  5. Chapter 6: Estimating individual responses to price with a hierarchical Bayesian model

    Use hierarchical Bayes and PyMC to estimate individual price responses. Check shrinkage, MCMC diagnostics, posterior predictions, and uncertainty.

  6. Chapter 7: Predicting churn: from survival analysis to testing retention actions

    Use survival analysis and LightGBM to study churn, choose target customers, and assess a retention action's effect and profit in a separate A/B test.

  7. Chapter 8: Finding products bought together with association analysis

    Find products bought together with Apriori and Eclat. Calculate support, confidence, and lift, then assess rules before testing a recommendation.

  8. Chapter 9: Decomposing sales changes and forecasting with Prophet and state-space models

    Decompose sales with Prophet and state-space models. Check forecasts, latent trends, prediction errors, and interval coverage on held-out data.

  9. Chapter 10: Predicting future customer value from purchase histories

    Estimate future purchase days and gross profit with BG/NBD and gamma-gamma models, validate forecasts, and calculate 12-month customer lifetime value.

  10. Chapter 11: Building personalized recommendations from purchase histories

    Build ALS and BPR recommendations from purchase histories. Evaluate top-five rankings and examine data splits, candidate filtering, and diversity.

  11. Chapter 12: Choosing recommendations from connections in purchase histories

    Model purchase links with NGCF and LightGCN. Follow graph normalization and training, evaluate recommendations, and compare accuracy with runtime.