Machine Learning Models for MarketingIntroductionMachine learning (ML) is a set of computational methods that enables systems to learn patterns from data and use those patterns to make predictions, classifications, recommendations, or decisions. In marketing, ML supports customer segmentation, churn prediction, demand forecasting, media optimisation, recommendation systems, fraud detection, and personalisation. ML does not replace marketing strategy. It provides evidence and automation that can improve decisions when the business objective, data, measurement system, and governance are sound. A highly accurate model can still create poor business outcomes if it predicts the wrong target, uses biased data, ignores customer privacy, or is deployed without human oversight. This chapter examines supervised, unsupervised, and reinforcement learning; classification, regression, and clustering; model training and validation; performance metrics; overfitting; explainability; and responsible managerial use. Learning ObjectivesBy the end of this chapter, students should be able to: - Distinguish supervised, unsupervised, and reinforcement learning.
- Explain classification, regression, and clustering in marketing contexts.
- Describe how training, validation, and test data are used.
- Select and interpret appropriate model-performance metrics.
- Diagnose overfitting and explain methods for improving generalisation.
- Evaluate explainability, bias, privacy, and human oversight requirements.
- Translate model outputs into responsible marketing decisions.
1. The Marketing Machine-Learning ProblemA marketing ML project begins with a decision, not an algorithm. Typical questions include: - Which customers are likely to churn in the next 30 days?
- What revenue might a customer generate over the next quarter?
- Which products should be recommended to a visitor?
- Which customer groups exhibit similar purchasing behaviour?
- How should a campaign budget be allocated across channels?
A useful formulation identifies four elements: | Element | Marketing example |
|---|
| Unit of analysis | Customer, transaction, session, advertisement, or store | | Features | Recency, frequency, spend, channel activity, demographics | | Target or reward | Churn, revenue, conversion, profit, or long-term value | | Decision | Contact, offer, recommendation, budget, or no action |
A feature is an input variable used by a model. A target is the outcome that a supervised model learns to predict. A label is the observed category or value assigned to a training example. The target must be available at the time the model is trained and defined consistently with the business decision. Marketing data may be structured, such as purchase value and campaign exposure, or unstructured, such as text, images, audio, and reviews. Data quality problems include missing values, duplicate records, inconsistent identifiers, measurement error, and changes in customer behaviour over time. These problems often matter more than the choice between two advanced algorithms. 2. Three Learning Paradigms2.1 Supervised learningIn supervised learning, the model receives examples containing inputs and known outcomes. It estimates a function that maps features to a target: ŷ = f(x; θ) Here, x is the feature vector, θ represents learned model parameters, f is the model, and ŷ is the prediction. The model is trained by minimising a loss function over training observations: θ̂ = arg min_θ (1/n) ∑ᵢ₌₁ⁿ L(yᵢ, f(xᵢ; θ)) In this expression, n is the number of observations, yᵢ is the observed target, and L measures prediction error. The objective is applicable when examples are sufficiently representative and the target is measured reliably. Classification predicts categories, such as churn versus no churn. Regression predicts a numerical quantity, such as expected order value. Supervised marketing applications include propensity modelling, lead scoring, sales forecasting, and customer lifetime-value estimation. 2.2 Unsupervised learningUnsupervised learning uses inputs without a known target. The purpose is to discover structure, such as groups, associations, or lower-dimensional representations. Customer clustering is a common example: the algorithm may identify groups based on purchase frequency, average order value, product categories, and engagement. Unsupervised results are not automatically meaningful customer segments. Marketers must assess stability, interpretability, size, actionability, and commercial value. A mathematically distinct cluster may not justify a distinct marketing treatment. 2.3 Reinforcement learningReinforcement learning (RL) concerns sequential decisions. An agent observes a state, selects an action, receives a reward, and moves to a new state. In marketing, a state might describe a customer’s recent interactions; an action might be the timing or type of message; and the reward might combine conversion, margin, retention, and customer-experience measures. The discounted return from time t is commonly represented as: Gₜ = Rₜ₊₁ + γRₜ₊₂ + γ²Rₜ₊₃ + … Gₜ is the return, R is a future reward, and γ is the discount factor, where 0 ≤ γ < 1. A higher discount factor gives greater importance to future outcomes. RL requires careful experimentation, reliable reward definitions, sufficient feedback, and safeguards against harmful exploration. Many marketing problems are better addressed initially by supervised prediction or controlled experimentation than by unconstrained RL. 3. Core Model Types3.1 ClassificationClassification assigns an observation to one of two or more categories. Binary classification might predict whether a customer will churn. Multiclass classification might predict the most likely product category. Models may output probabilities rather than only labels. A probability threshold converts a probability into an action; changing the threshold changes the balance between false positives and false negatives. Logistic regression is an interpretable classification model. For a binary outcome, it models the log-odds as a linear function of features: log(p/(1 − p)) = β₀ + β₁x₁ + … + βₖxₖ Here, p is the probability of the positive class, β₀ is the intercept, βⱼ are coefficients, and xⱼ are features. The odds ratio associated with a one-unit increase in xⱼ, holding other variables constant, is eβⱼ. This interpretation assumes the log-odds relationship is appropriately specified and that the feature measurement is meaningful. Decision trees, random forests, gradient-boosting models, and neural networks can capture nonlinear relationships. More flexible models may improve predictive performance but often require stronger validation and explanation practices. 3.2 RegressionRegression predicts a continuous numerical outcome, such as monthly revenue, demand, or customer lifetime value. In ordinary least squares linear regression, coefficients are estimated by minimising squared residuals: β̂ = arg min_β ∑ᵢ₌₁ⁿ (yᵢ − β₀ − ∑ⱼ₌₁ᵖ βⱼxᵢⱼ)² The residual is the difference between observed and predicted values. The model assumes, for conventional statistical inference, an appropriate functional form, independent errors, and suitably behaved residual variance; prediction can still be useful when some assumptions are imperfect, but interpretation should then be cautious. Regression is used for sales forecasting, price-response estimation, media-spend prediction, and expected customer value. Forecasting requires special attention to time order: future information must not enter the features used to predict the past. 3.3 ClusteringClustering groups observations so that members of the same group are more similar under a selected distance or similarity measure. In k-means clustering, the objective is: J = ∑ᵢ₌₁ⁿ ||xᵢ − μcᵢ||² xᵢ is observation i, cᵢ is its assigned cluster, and μcᵢ is that cluster’s centroid. The method seeks assignments and centroids that minimise within-cluster squared Euclidean distance. Variables should generally be scaled when units differ substantially, and k-means is most suitable for relatively compact, numerical clusters. The number of clusters may be assessed using domain reasoning, stability analysis, the elbow method, or silhouette analysis. No single statistical criterion proves that a segmentation is commercially valid. A segment should be profiled, named carefully, tested for stability, and linked to a feasible proposition or action. 4. Training, Validation, and TestingA model should be evaluated on data that were not used to fit its parameters. A common design divides data into training, validation, and test sets: - Training data fit model parameters.
- Validation data compare models, features, and hyperparameters.
- Test data provide a final estimate after modelling choices are complete.
For time-dependent marketing data, chronological splitting is usually safer than random splitting. For example, transactions from January–September may train a model, October may validate it, and November may test it. Random splitting can create leakage when the same customer appears in multiple sets or when future behaviour influences past records. Cross-validation repeatedly divides the training data into folds. In k-fold cross-validation, each fold is used once for validation while the remaining folds are used for fitting. The reported score is commonly the mean across folds; variability should also be examined. Cross-validation is not a substitute for a genuinely untouched final test set when model selection has been extensive. Data leakage occurs when information unavailable at decision time is used during training. Examples include using a cancellation code to predict churn, using post-campaign purchases to predict campaign response, or scaling the entire dataset before splitting. Leakage produces deceptively strong results. A complete pipeline should document data origin, feature definitions, extraction dates, transformations, model version, evaluation population, and deployment assumptions. After deployment, monitoring should examine data drift, prediction quality, calibration, fairness, and business outcomes. 5. Performance MetricsMetrics must reflect the decision and the costs of errors. Classification metricsFor binary classification, a confusion matrix contains true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN). Accuracy = (TP + TN)/(TP + TN + FP + FN) Precision = TP/(TP + FP) Recall = TP/(TP + FN) Accuracy is the proportion of correct classifications. Precision is the proportion of predicted positives that are truly positive. Recall, also called sensitivity, is the proportion of actual positives detected. Specificity is TN/(TN + FP). Accuracy can be misleading with class imbalance. For example, a campaign-response model facing a 2% response rate could achieve 98% accuracy by predicting no response for everyone, while providing no useful targeting. The F1 score is the harmonic mean of precision and recall: F1 = 2 × (Precision × Recall)/(Precision + Recall) It is useful when both precision and recall matter, but it does not directly incorporate monetary costs. Precision–recall curves can be informative for rare positive outcomes. ROC-AUC summarises ranking performance across thresholds, but it may appear strong even when the practical precision at the available contact capacity is poor. Calibration asks whether predicted probabilities correspond to observed frequencies. Among customers assigned a 0.70 probability, roughly 70% should experience the event within comparable groups if the model is well calibrated. Calibration is important when probabilities guide budget or intervention decisions. Regression metricsMean absolute error (MAE) is: MAE = (1/n) ∑ᵢ₌₁ⁿ |yᵢ − ŷᵢ| Mean squared error (MSE) is: MSE = (1/n) ∑ᵢ₌₁ⁿ (yᵢ − ŷᵢ)² Root mean squared error is √MSE. MAE is expressed in the target’s units and is less sensitive to large errors than MSE. RMSE penalises large errors more strongly. Mean absolute percentage error can be unsuitable when actual values are zero or close to zero. Always compare performance with a simple baseline, such as last-period demand or average customer value. Clustering assessmentClustering can be evaluated using internal measures such as within-cluster variation or silhouette score, but business validation is essential. A useful segment should be sufficiently large, stable over time, distinguishable on relevant behaviours, and actionable at acceptable cost. 6. Overfitting, Underfitting, and GeneralisationOverfitting occurs when a model learns noise or idiosyncrasies in training data and performs poorly on new data. Underfitting occurs when the model is too simple to capture important patterns. Generalisation is the ability to perform well on unseen cases. Symptoms of overfitting include a much better training score than validation score, unstable feature importance, and sharp performance decline after deployment. Remedies include simpler models, regularisation, more representative data, feature selection, early stopping, cross-validation, and reducing unnecessary model complexity. Regularisation adds a penalty to the objective. For example, ridge regression uses an L2 penalty: Loss = ∑ᵢ (yᵢ − ŷᵢ)² + λ∑ⱼ βⱼ² λ ≥ 0 controls the penalty strength. Larger values shrink coefficients toward zero but do not usually make them exactly zero. The penalty must be selected using training-validation procedures, not the final test set. Regularisation does not correct biased labels, leakage, or a poorly defined business target. 7. Explainability and Human OversightExplainability concerns the ability to understand how a model produces or supports an outcome. Interpretability is often associated with models whose structure is directly understandable, such as a small decision tree or logistic regression. Post-hoc explanation methods estimate how features contributed to a particular prediction or to overall model behaviour. Such explanations are useful but are not necessarily causal evidence. Marketing managers should ask: - What data influenced the prediction?
- Is the feature available before the decision?
- Could the feature act as a proxy for a protected attribute?
- Does the explanation remain stable under small data changes?
- Can a customer or employee receive an understandable reason?
- What action is permitted, and who can override it?
Human oversight is required when decisions affect access, price, credit, employment, essential services, or vulnerable people. A human reviewer should have adequate time, authority, training, and evidence—not merely the formal ability to click “approve.” Marketing teams should establish escalation rules, audit logs, appeal channels, and periodic review. Privacy principles include purpose limitation, data minimisation, security, retention control, transparency, and lawful processing. Consent and legal permission do not automatically make a use ethical. Sensitive attributes should be handled with particular care, and fairness should be assessed across relevant groups where legally and ethically appropriate. Regulations differ by jurisdiction; organisations must consult applicable privacy, consumer-protection, anti-discrimination, and automated-decision rules. 8. Illustrative Case: Retail Churn InterventionBackgroundAn illustrative regional subscription retailer has 300,000 active customers. Management wants to reduce monthly churn while avoiding unnecessary discounting. ProblemThe team defines churn as cancellation within the next 30 days and proposes a binary classifier using tenure, recent usage, payment history, service contacts, and prior cancellations. The business can contact only 20,000 customers per month. AnalysisThe team initially obtains 94% accuracy. However, only 5% of customers churn, and a model predicting “no churn” for everyone would achieve 95% accuracy. Accuracy is therefore uninformative. The team instead examines precision, recall, lift, calibration, and expected incremental profit. The data are split chronologically. Features are extracted as they existed at the prediction date. A cancellation reason recorded after cancellation is removed because it creates leakage. A gradient-boosting model is compared with logistic regression as an interpretable baseline. The selected model is evaluated on a later test month that was not used for tuning. Approach and solutionThe retailer ranks customers by predicted churn probability and selects the top 20,000. Before full deployment, it runs a randomised holdout experiment: some high-risk customers receive the retention offer, while comparable customers do not. The experiment measures incremental retention, margin after discount, complaints, and subsequent engagement—not merely predicted risk. The model card records the target definition, training period, features, limitations, threshold, test performance, and monitoring plan. A review process prevents automatic offers where account activity suggests fraud or where contact restrictions apply. OutcomeSuppose the intervention increases retention in the treatment group, but the effect is concentrated among customers with moderate predicted risk. The retailer changes its policy from “contact the riskiest customers” to “contact customers with both meaningful risk and positive estimated treatment effect.” This distinction illustrates an important principle: predicting who will churn is not the same as predicting who will respond beneficially to an intervention. Learning points- Business capacity and intervention cost determine the operating threshold.
- A predictive model does not establish causal impact.
- Incrementality testing is necessary for campaign evaluation.
- Leakage and class imbalance can make accuracy misleading.
- Human review and governance remain necessary after deployment.
9. Contemporary Developments and Best PracticesModern marketing systems increasingly combine tabular ML, natural-language processing, recommender systems, and generative AI. Foundation models can assist with content and interaction analysis, but their outputs require factual checking, privacy controls, brand governance, and evaluation for stereotyping or harmful personalisation. Retrieval systems and customer-data platforms can improve context, but integration increases the importance of access control and data lineage. Best practice is to: - Start with a measurable decision and baseline.
- Define the prediction window and intervention time precisely.
- Use features available at decision time.
- Split data according to the real deployment process.
- Compare simple and complex models.
- Select metrics based on business costs and customer impact.
- Test calibration, subgroup performance, and robustness.
- Validate causal or incremental effects through experiments where feasible.
- Document assumptions, limitations, versions, and approvals.
- Monitor the model and retire it when its validity or value declines.
Chapter SummaryMachine learning supports marketing decisions by learning patterns from customer, campaign, transaction, and contextual data. Supervised learning predicts labelled outcomes through classification or regression; unsupervised learning discovers structure such as customer clusters; and reinforcement learning addresses sequential decisions through rewards. Model quality depends on target definition, feature quality, leakage prevention, appropriate data splitting, and evaluation on unseen data. Classification metrics include accuracy, precision, recall, F1, ROC-AUC, and calibration. Regression metrics include MAE, MSE, and RMSE. Clustering requires both statistical assessment and managerial judgement about stability and actionability. Overfitting reduces generalisation and can be addressed through validation, regularisation, simpler models, and better data. Explainability, privacy, fairness, documentation, experimentation, and human oversight are essential because prediction is not the same as causation and automation is not a substitute for responsibility. Key TermsMachine learning: Methods that learn patterns from data to make predictions or decisions. Feature: An input variable used by a model. Target: The outcome a supervised model is trained to predict. Label: The observed category or value attached to a training example. Supervised learning: Learning from inputs paired with known outcomes. Unsupervised learning: Learning patterns from data without a labelled target. Reinforcement learning: Learning sequential actions through rewards and feedback. Classification: Prediction of a categorical outcome. Regression: Prediction of a numerical outcome. Clustering: Grouping observations according to similarity. Training set: Data used to fit model parameters. Validation set: Data used to compare models and tune choices. Test set: Untouched data used for final performance estimation. Overfitting: Learning noise that harms performance on new data. Data leakage: Use of information unavailable at decision time. Precision: The share of predicted positives that are actual positives. Recall: The share of actual positives that are detected. Calibration: Agreement between predicted probabilities and observed frequencies. Explainability: Ability to understand or communicate model behaviour. Human oversight: Structured human responsibility for reviewing and governing automated outputs. Review QuestionsShort Answer Questions- Distinguish supervised learning from unsupervised learning.
- What is the difference between classification and regression?
- Why can accuracy be misleading for imbalanced marketing outcomes?
- Define data leakage and provide one marketing example.
- What is the purpose of a test set?
Long Answer Questions- Explain the three major machine-learning paradigms and give one marketing application of each.
- Compare precision, recall, F1, and calibration for a churn campaign.
- Explain how chronological data splitting can improve the validity of marketing forecasts.
- Discuss the causes, symptoms, and remedies of overfitting.
- Evaluate the roles of explainability, privacy, fairness, and human oversight in marketing ML.
Analytical / Application Questions- A response model has 1,000 customers: TP = 80, FP = 120, FN = 20, and TN = 780. Calculate precision, recall, and accuracy, and recommend which metric a marketer should prioritise if missing a likely responder is twice as costly as contacting a non-responder.
- Design a validation plan for a model predicting next-month customer revenue using three years of transaction data. Identify the split strategy, leakage risks, baseline, metrics, and monitoring requirements.
- A retailer has clusters based on purchase frequency and average order value. Explain how you would determine whether the clusters are stable, interpretable, ethically acceptable, and actionable before launching differentiated campaigns.
Multiple Choice Questions with AnswersQuestion 1Which learning paradigm uses labelled outcomes during model training? A. Supervised learning B. Unsupervised learning C. Reinforcement learning only D. Random sampling Correct Answer: A. Supervised learning Question 2Which task is a classification problem? A. Predicting next month’s revenue B. Grouping customers by similarity C. Predicting whether a customer will churn D. Estimating average order value Correct Answer: C. Predicting whether a customer will churn Question 3What is the main purpose of a validation set? A. To store raw customer data permanently B. To tune and compare modelling choices C. To guarantee causal conclusions D. To replace the training set Correct Answer: B. To tune and compare modelling choices Question 4A model predicts 90 positive cases, of which 60 are truly positive. What is its precision? A. 30% B. 60% C. 66.7% D. 90% Correct Answer: C. 66.7% Question 5Which situation is an example of data leakage? A. Using tenure measured before a churn prediction B. Scaling training data using training-set statistics C. Using a cancellation reason recorded after cancellation to predict churn D. Comparing a model with a simple baseline Correct Answer: C. Using a cancellation reason recorded after cancellation to predict churn Question 6Which metric is expressed in the same units as the regression target? A. MAE B. MSE C. R-squared only D. Log loss Correct Answer: A. MAE Question 7What is a central characteristic of k-means clustering? A. It requires a labelled target B. It assigns observations around cluster centroids C. It predicts only binary outcomes D. It learns exclusively through monetary rewards Correct Answer: B. It assigns observations around cluster centroids Question 8Which pattern most strongly suggests overfitting? A. Similar training and test performance B. Poor training and validation performance C. Excellent training performance but substantially worse validation performance D. A model with documented limitations Correct Answer: C. Excellent training performance but substantially worse validation performance Question 9Why is calibration important in a marketing propensity model? A. It ensures every feature is normally distributed B. It checks whether predicted probabilities correspond to observed frequencies C. It eliminates all false positives D. It determines the number of clusters automatically Correct Answer: B. It checks whether predicted probabilities correspond to observed frequencies Question 10Why should a retention model often be followed by a controlled experiment? A. Prediction alone does not show whether an offer causes incremental retention B. Experiments eliminate the need for data governance C. Experiments guarantee perfect model accuracy D. Prediction models cannot use customer data Correct Answer: A. Prediction alone does not show whether an offer causes incremental retention
|