Predictive Analytics
What Will Happen?
Predictive analytics, stated honestly, is this: use the past to estimate the future, then measure how wrong you are. It builds on diagnostic work — once you understand which factors drive an outcome, you can train a model to project that outcome onto new, unseen cases. The headline lesson is that the workflow matters more than the algorithm. A simple model evaluated honestly beats a sophisticated one you can't trust.
This is a four-chapter mini-series. Every model is trained in scikit-learn on the shared synthetic retail dataset, and every metric quoted — R², MAE, AUC, precision, recall — is computed on a held-out test set and rendered in the charts. Where the synthetic data has no real outcome to predict (churn), that is stated plainly and a constructed label is used to illustrate the workflow.
The predictive workflow: split the labeled history, fit on the training part, score on the held-out part, and only then project onto new cases.
The Four Chapters
Framing the Problem
Regression (a number), classification (a label), or clustering (groups with no labels) — with a rendered K-Means segmentation.
The Train/Test Split & Overfitting
Why you must score on data the model never saw, shown with a training-vs-test error curve that makes overfitting visible.
Regression — Predicting a Number
A scikit-learn pipeline predicting lifetime sales, with predicted-vs-actual and feature-importance charts and an honest baseline.
Classification — Predicting a Label
A churn classifier judged the right way — confusion matrix, ROC/AUC, precision and recall — not by accuracy alone.
Reference Code
The split → fit → evaluate → persist flow shown here is packaged in the
Data Analytics Library's
predictiveanalysis and machinelearning modules. Predictive analytics builds on
Diagnostic ("why") and feeds
Prescriptive ("what should we do").