Predictive Analytics FundamentalsIntroductionPredictive analytics uses historical and current data to estimate likely future outcomes. In business, it supports decisions such as forecasting sales, identifying customers at risk of leaving, estimating loan default risk, planning inventory and grouping customers for targeted marketing. It does not provide certainty. Rather, it produces estimates whose usefulness depends on data quality, model assumptions, evaluation methods and the decision context. Predictive analytics is commonly distinguished from descriptive and diagnostic analytics. Descriptive analytics asks what happened; diagnostic analytics asks why it happened; predictive analytics asks what is likely to happen; prescriptive analytics asks what action should be taken. These forms are connected: a reliable predictive model normally depends on well-defined historical measures and an understanding of the business process that generated the data. Learning ObjectivesBy the end of this chapter, you should be able to: - Explain the purpose and workflow of predictive analytics.
- Distinguish supervised and unsupervised learning.
- Apply introductory linear regression and classification methods.
- Explain time-series forecasting and customer segmentation.
- Separate training, validation and testing data appropriately.
- Select and interpret suitable model-performance measures.
- Recognise overfitting, data leakage, bias and ethical risks.
The Predictive Analytics WorkflowA practical predictive project usually follows these stages: - Define the decision problem. Specify the business outcome, decision owner, time horizon and cost of errors.
- Define the target and predictors. The target is the outcome to be predicted; predictors, also called features or explanatory variables, are the information used to make the prediction.
- Collect and prepare data. This includes joining sources, correcting errors, handling missing values, encoding categories and checking unusual observations.
- Split the data. Historical observations are separated into training and evaluation sets.
- Select and fit a model. Parameters are estimated from the training data.
- Evaluate performance. Predictions are compared with observations using measures suited to the problem.
- Deploy and monitor. A model must be integrated into business processes and checked as data and behaviour change.
- Review consequences. The organisation should assess fairness, privacy, security and the effect of automated decisions.
A useful distinction is between a model’s statistical performance and its business value. A highly accurate model may be unhelpful if it predicts an outcome that managers cannot act upon, operates too slowly, or creates unacceptable compliance risks. Supervised and Unsupervised LearningIn supervised learning, each training record contains a known target. Regression predicts a numerical target, such as monthly revenue. Classification predicts a category, such as “will churn” or “will not churn.” In unsupervised learning, the target is not supplied. The algorithm looks for structure, such as groups of customers with similar behaviour. Customer segmentation is a common unsupervised-learning application. The distinction is practical rather than absolute. A business may first use clustering to identify customer groups and later use those group labels as features in a supervised churn model. However, the analyst must ensure that any group information available at prediction time is used consistently and does not introduce leakage. Data Splitting and GeneralisationA model should perform well not only on records used to estimate it but also on new records. This ability is called generalisation. A typical split is: | Dataset | Main purpose |
|---|
| Training set | Estimate model parameters and fit the model | | Validation set | Compare alternatives and tune settings | | Test set | Provide a final, relatively unbiased performance estimate |
For example, a dataset might be divided into 60% training, 20% validation and 20% testing. The exact proportions depend on sample size and the modelling method. When data are limited, cross-validation can repeatedly divide the training data into folds. The test set should remain untouched until the final model has been selected. For time-dependent data, random splitting can be misleading because it may allow information from the future to influence a model intended for the past. A chronological split is usually more appropriate: earlier observations train the model and later observations test it. Overfitting occurs when a model learns random noise or peculiarities of the training sample. It usually produces very good training performance but weaker performance on unseen data. Underfitting occurs when the model is too simple to represent important relationships. Regularisation, sensible feature selection, larger samples and careful validation can help manage these problems. A major threat is data leakage: information unavailable at the time of the real prediction is accidentally included in the predictors. For example, using a customer’s cancellation date to predict whether that customer will cancel gives an unrealistically strong result. Linear RegressionLinear regression estimates a numerical outcome from one or more predictors. With one predictor, the population relationship is written as: yi = β₀ + β₁xi + εi Here, yi is the observed outcome for case i, xi is its predictor value, β₀ is the intercept, β₁ is the slope and εi is the error term. The fitted prediction is: ŷi = b₀ + b₁xi The intercept and slope are estimated, commonly by ordinary least squares, which chooses values that minimise the sum of squared residuals: min ∑i=1n(yi − ŷi)² A residual is ei = yi − ŷi. In a simple regression, the slope represents the estimated change in the outcome associated with a one-unit increase in the predictor, assuming the model form is appropriate. It does not automatically prove causation. With multiple predictors: ŷi = b₀ + b₁xi1 + b₂xi2 + … + bpxip Each coefficient is interpreted as the estimated change in the outcome for a one-unit change in that predictor while the other included predictors are held constant. This interpretation requires appropriate measurement, model specification and caution about confounding. Regression assumptions and evaluationBasic linear regression inference commonly assumes a linear conditional relationship, independent observations, errors with constant variance and, for small-sample significance tests, approximately normally distributed errors. Prediction can still be useful when some assumptions are imperfect, but diagnostics are necessary. Common measures include: MAE = (1/n)∑i=1n|yi − ŷi| RMSE = √[(1/n)∑i=1n(yi − ŷi)²] MAPE = (100/n)∑i=1n|(yi − ŷi)/yi| MAE is the average absolute error in the target’s units. RMSE is also in the target’s units but penalises large errors more strongly because errors are squared before averaging. MAPE expresses average percentage error but is problematic when actual values are zero or close to zero. For such data, MAE, RMSE or a scale-aware alternative is preferable. The coefficient of determination is: R² = 1 − [∑(yi − ŷi)² / ∑(yi − ȳ)²] where ȳ is the sample mean of observed outcomes. R² measures improvement over predicting the sample mean on the evaluated data; it is not a universal measure of business usefulness and can be negative on test data. Worked regression exampleSuppose weekly advertising expenditure x is measured in thousands of currency units and the fitted sales model is: Saleŝ = 120 + 8x Sales are measured in thousands of units. At x = 5, predicted sales are 120 + 8(5) = 160 thousand units. The slope suggests that the model associates an additional thousand currency units of advertising with eight thousand additional units of predicted sales, within the observed range and subject to the model’s assumptions. It should not be interpreted as proof that increasing advertising alone will cause that increase. ClassificationClassification predicts a discrete category. Binary classification has two outcomes, such as default and non-default. Multiclass classification has more than two outcomes, such as low, medium and high risk. A classification model often produces a probability. A decision threshold then converts that probability into a class. For example, a customer may be classified as “likely to churn” when predicted probability is at least 0.50. The threshold should reflect the relative costs of false positives and false negatives, not merely convention. Logistic regression is an introductory classification method. For a binary outcome, it models the probability pi of class 1 as: pi = 1/[1 + e^{−(β₀ + β₁xi1 + … + βpxip)}] The exponential function ensures that the predicted probability lies between 0 and 1. Equivalently, the log-odds are linear in the predictors: ln[pi/(1 − pi)] = β₀ + β₁xi1 + … + βpxip A coefficient’s exponent, eβj, is an odds ratio: the multiplicative change in the odds associated with a one-unit increase in predictor xj, holding other predictors constant. Probability changes are not constant across all starting probabilities. Confusion matrix and measuresFor a binary classifier, predictions can be summarised as: | Actual positive | Actual negative |
|---|
| Predicted positive | True positive (TP) | False positive (FP) | | Predicted negative | False negative (FN) | True negative (TN) |
Important measures are: Accuracy = (TP + TN)/(TP + TN + FP + FN) Precision = TP/(TP + FP) Recall = TP/(TP + FN) Specificity = TN/(TN + FP) Accuracy is the proportion classified correctly. Precision asks: among predicted positives, how many are truly positive? Recall, also called sensitivity, asks: among actual positives, how many were detected? Specificity asks: among actual negatives, how many were correctly rejected. Accuracy can be misleading under class imbalance. If only 2% of transactions are fraudulent, predicting “not fraud” for every transaction gives 98% accuracy but detects no fraud. Precision–recall analysis, the ROC curve and the area under the ROC curve can provide additional information. The ROC curve examines sensitivity against false-positive rate across thresholds; the area under it summarises ranking performance, but it does not itself specify the most suitable operating threshold. 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 gives equal weight to them and does not include true negatives directly. Time-Series ForecastingA time series is a sequence of observations ordered in time. Examples include daily orders, monthly revenue and hourly website traffic. Time-series forecasting differs from ordinary regression because temporal dependence, trend, seasonality and changing variance may be important. Key components include: - Level: the underlying typical value.
- Trend: persistent upward or downward movement.
- Seasonality: a repeating pattern with a known period, such as higher retail sales each December.
- Cyclic movement: longer, less regular fluctuations, often associated with economic conditions.
- Noise: irregular variation not explained by the model.
A simple moving-average forecast for a window of k periods is: F̂t+1 = (yt + yt−1 + … + yt−k+1)/k where yt is the observed value at time t. This method smooths short-term variation but reacts slowly to a changing trend. A weighted moving average assigns larger weights to selected observations; the weights must be non-negative and sum to one. Exponential smoothing gives greater weight to recent observations: Ft+1 = αyt + (1 − α)Ft where 0 ≤ α ≤ 1 is the smoothing parameter, yt is the latest observation and Ft is the previous forecast. A larger α responds more quickly to recent changes but may follow noise more closely. This basic form is most suitable when there is no pronounced trend or seasonality; extensions are needed for those patterns. Forecast accuracy can be evaluated using MAE, RMSE and, where appropriate, percentage measures. Forecast errors must be calculated on periods not used to fit or tune the forecasting method. A naïve benchmark—using the last observed value as the next forecast—is important because a complex model should outperform a simple baseline to justify its use. Customer SegmentationCustomer segmentation divides customers into meaningful groups for differentiated service, communication or resource allocation. Unlike classification, segmentation usually begins without a known target. A common technique is k-means clustering. The analyst selects a number of clusters k, assigns records to clusters, calculates each cluster’s centroid, and repeatedly reassigns records to the nearest centroid and updates the centroids until assignments stabilise or an iteration limit is reached. With numerical variables, Euclidean distance between two observations x and z is: d(x,z) = √[∑j=1p(xj − zj)²] Variables should generally be scaled when their units or ranges differ. Otherwise, a variable measured in thousands may dominate a variable measured from zero to one. K-means is sensitive to outliers, initial centroid selection and the chosen value of k. The analyst may compare within-cluster variation, silhouette measures, stability and—most importantly—whether the groups are actionable and interpretable. Segmentation is not automatically valuable because clusters exist mathematically. A useful segment should be sufficiently large or strategically important, distinguishable in behaviour, reachable through an intervention and governed responsibly. For example, a retailer might use recency, purchase frequency and monetary value, but must avoid using protected characteristics or inappropriate proxies to deny services. Integrated Illustrative Case: Northstar RetailThis is a fictional illustrative case. Background and problemNorthstar Retail operates 40 stores and an online channel. Management wants to forecast monthly demand, identify customers likely to stop purchasing and create segments for personalised campaigns. The business has 30 months of transaction history, product information, website activity and customer-service records. Analysis and approachThe analyst first defines three targets: next-month product demand, customer churn within 60 days and customer value segment. The final four months are held out as a chronological test period for forecasting. For churn, records are constructed using only information available at the prediction date. A random or chronological split is selected according to the operational timing of the decision, and leakage checks are documented. A baseline forecast uses the previous month’s demand. An exponential-smoothing model is then compared with the baseline using MAE and RMSE. A logistic-regression churn model produces probabilities. Because contacting a non-churning customer has a cost while missing a likely churner loses margin, managers examine precision and recall at several thresholds rather than adopting 0.50 automatically. For segmentation, the team standardises recency, frequency and monetary value, tests several values of k, and reviews cluster stability. Four interpretable groups emerge: recent high-value customers, frequent moderate-value customers, occasional customers and inactive customers. The segments are described behaviourally rather than as fixed personal identities. OutcomeThe selected forecast reduces test-period MAE relative to the naïve baseline, but only modestly. Management therefore avoids presenting the forecast as certainty and uses prediction intervals supplied by the forecasting method where available. The churn model identifies a high-recall group for low-cost digital reminders and a high-precision group for expensive human outreach. A controlled campaign experiment is used to determine whether interventions actually improve retention; model accuracy alone cannot establish that the campaign caused improvement. Learning pointsThe case illustrates that predictive analytics is a decision system, not simply an algorithm. The target must match the decision, the time boundary must be respected, evaluation measures must reflect costs, and segments must lead to feasible action. Monitoring is required because customer behaviour, product mix and economic conditions can change after deployment. Professional Practice, Ethics and GovernancePredictive models can reproduce historical discrimination. A model trained on past lending decisions may learn unequal treatment rather than genuine creditworthiness. Analysts should examine representation, error rates across relevant groups, proxy variables, documentation and the legitimacy of the intended use. Fairness measures can conflict: improving one group’s false-negative rate may affect another measure. Therefore, fairness is a governance decision requiring legal, ethical and organisational judgement, not merely a technical setting. Privacy principles include data minimisation, purpose limitation, secure storage, access control and retention limits. Organisations should explain significant automated decisions in understandable language and provide appropriate human review. Sensitive data should not be collected or used merely because it improves predictive performance. Applicable privacy, consumer-protection, employment and sector-specific regulations must be considered in the relevant jurisdiction. Good practice includes a data dictionary, reproducible preparation steps, version-controlled code, model cards or equivalent documentation, approval records, a clear owner, monitoring thresholds and an escalation process. Monitoring should track data drift, prediction drift, performance, missingness, latency and fairness indicators. Generative AI can assist with coding or documentation, but generated material requires verification; it must not be treated as evidence or allowed to expose confidential data. Best-Practice ChecklistBefore deployment, an analyst should be able to answer the following questions: - Is the decision and prediction horizon clearly defined?
- Is the target measured consistently and at the correct time?
- Could any predictor contain future information?
- Was the test set protected from model selection?
- Is there a meaningful baseline?
- Do evaluation measures reflect the costs of errors?
- Were missing values, outliers and class imbalance addressed appropriately?
- Are results stable across relevant time periods and groups?
- Can decision-makers understand and act on the predictions?
- Are privacy, fairness, security and accountability controls documented?
- Who will monitor the model and what action follows deterioration?
Chapter SummaryPredictive analytics estimates future or unknown outcomes to support business decisions. Regression predicts numerical values, classification predicts categories or probabilities, time-series methods account for temporal order and repeated patterns, and segmentation identifies groups without a predefined target. Training data are used to fit models, validation data to select or tune them, and test data to provide a final estimate of generalisation. Overfitting and leakage can make results appear stronger than they are. Linear regression uses a fitted relationship between predictors and a numerical outcome. Logistic regression converts a linear predictor into a probability for binary classification. MAE, RMSE and R² support regression evaluation; confusion-matrix measures such as precision, recall and specificity support classification evaluation. Moving averages and exponential smoothing provide accessible forecasting methods, while k-means illustrates customer segmentation. In every case, performance measures must match the decision context. Professional predictive analytics also requires ethical and operational discipline. Data quality, temporal validity, fairness, privacy, explainability, monitoring and human accountability determine whether a model is safe and useful in practice. Key TermsPredictive analytics: Analysis that estimates likely future or unknown outcomes. Target: The outcome a model is designed to predict. Predictor: An input variable used to make a prediction. Supervised learning: Learning from records with known target values. Unsupervised learning: Learning patterns without a supplied target. Regression: Prediction of a numerical outcome. Classification: Prediction of a category or class probability. Training set: Data used to estimate model parameters. Validation set: Data used to compare models or tune settings. Test set: Held-back data used for final evaluation. Generalisation: Performance on new, unseen data. Overfitting: Learning sample-specific noise rather than general patterns. Data leakage: Use of information unavailable at the time of prediction. Residual: Difference between an observed and predicted value. Precision: Proportion of predicted positives that are actually positive. Recall: Proportion of actual positives correctly identified. Time series: Observations recorded in chronological order. Seasonality: A repeating pattern with a regular period. Segmentation: Division of entities into meaningful groups. Cluster: A group of observations judged similar under a chosen method. Review QuestionsShort Answer Questions- What is the difference between predictive and prescriptive analytics?
- Why should a test set remain untouched until final model selection?
- Define overfitting and data leakage.
- What does recall measure in binary classification?
- Why should variables commonly be scaled before k-means clustering?
Long Answer Questions- Explain the predictive analytics workflow from problem definition through monitoring.
- Compare MAE, RMSE, MAPE and R², including one limitation of each where relevant.
- Explain linear regression, its coefficients and its major assumptions.
- Describe how a classification threshold affects precision and recall, and explain why accuracy may be misleading.
- Compare a moving-average forecast with exponential smoothing and identify situations in which each may be appropriate.
Analytical / Application Questions- A fraud model has high accuracy but detects almost no fraudulent transactions. Diagnose the problem and recommend evaluation measures and threshold considerations.
- A retailer randomly splits three years of monthly data and reports excellent test performance. Explain why the result may be unreliable and propose a better evaluation design.
- A bank wants to segment customers using income, transaction count and account balance. Design a responsible segmentation approach, including preparation, choice of distance or algorithm, evaluation and governance considerations.
Multiple Choice Questions with AnswersQuestion 1Which dataset should normally be used for the final relatively unbiased estimate of a selected model’s performance? A. Training set B. Validation set C. Test set D. Unlabelled production set Correct Answer: C. Test set Question 2A model predicts sales using Saleŝ = 120 + 8x, where x = 5. What is the prediction? A. 128 B. 140 C. 160 D. 600 Correct Answer: C. 160 Question 3Which measure answers: among cases predicted positive, what proportion are actually positive? A. Recall B. Precision C. Specificity D. RMSE Correct Answer: B. Precision Question 4Why can accuracy be misleading for a highly imbalanced fraud-detection problem? A. Accuracy cannot be calculated for classification B. A model can achieve high accuracy by predicting the majority class C. Accuracy always penalises false positives more than false negatives D. Accuracy is measured only on training data Correct Answer: B. A model can achieve high accuracy by predicting the majority class Question 5Which forecasting approach gives a weighted combination of the latest observation and the previous forecast? A. Exponential smoothing B. Random splitting C. K-means clustering D. Logistic regression Correct Answer: A. Exponential smoothing Question 6What is the main purpose of a chronological test split in forecasting? A. To ensure future information does not help predict the past B. To increase the number of observations C. To remove all seasonal patterns D. To guarantee zero forecast error Correct Answer: A. To ensure future information does not help predict the past Question 7In k-means clustering, what does k usually represent? A. The number of predictors B. The number of observations C. The chosen number of clusters D. The prediction error Correct Answer: C. The chosen number of clusters Question 8Which measure penalises large regression errors more strongly because errors are squared? A. MAE B. RMSE C. Precision D. Recall Correct Answer: B. RMSE Question 9What is data leakage? A. Deleting duplicate records B. Using information unavailable at the time of the real prediction C. Scaling numerical variables D. Splitting data into folds Correct Answer: B. Using information unavailable at the time of the real prediction Question 10A classifier labels a customer positive when predicted churn probability is at least 0.80 instead of 0.50. What is a likely effect, although not guaranteed? A. More customers will be labelled positive B. Fewer customers will be labelled positive C. The target variable will become continuous D. The training data will be doubled Correct Answer: B. Fewer customers will be labelled positive
|