10: Predictive Analytics and Machine Learning Basics
- Page ID
- 48111
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
In this chapter, we introduce the essentials of predictive analytics and machine learning. We learn what predictive analytics entails – using historical data and algorithms to predict future events – and survey common supervised and unsupervised learning techniques. Key algorithms like linear regression, logistic regression, decision trees, random forests, and clustering methods are explained, blending the theoretical intuition with practical examples and Python code. We emphasize how to properly evaluate models through train/test splits, cross-validation, and metrics like confusion matrices to ensure that models generalize well. The crucial concept of overfitting we discuss along with strategies to avoid it, stress the importance of the bias-variance tradeoff in model development. Finally, we discuss when advanced machine learning methods are appropriate versus when traditional analytic approaches might be sufficient or preferable, highlighting that the “best” approach depends on the problem’s nature, data availability, and requirements for interpretability.
With these foundations, students should be equipped to both build and assess predictive models, understanding not just how to make them accurate but also reliable and actionable. The blend of academic theory (like understanding algorithms and tradeoffs) with practical implementation (such as scikit-learn examples) in this chapter aims to prepare students to apply predictive analytics techniques to real-world datasets thoughtfully and effectively. The next step is to delve deeper into specific algorithms or domains (like time-series forecasting or deep learning for certain data types) and to practice on case studies, but the principles covered here will remain fundamentally important throughout those advanced topics.
Learning Objectives
-
Define predictive analytics and explain its relationship to descriptive and prescriptive analytics.
-
Distinguish between supervised and unsupervised learning and identify appropriate problem types for each.
-
Describe common ML algorithms: linear regression, logistic regression, decision trees, random forests, and K-means clustering.
-
Evaluate model performance using metrics: accuracy, precision, recall, F1 score, and confusion matrices.
-
Explain overfitting and underfitting and strategies to prevent them (train/test split, cross-validation, regularization).
-
Implement basic predictive models using Python's scikit-learn library.
- 10.1: Introduction to Predictive Analytics
- Defines predictive analytics as using historical and current data to forecast future outcomes; contrasts it with descriptive and prescriptive analytics; and outlines uses in CRM, finance, healthcare, operations, and fraud detection.
- 10.2: Supervised vs. Unsupervised Learning
- Supervised Learning: The model learns from labeled examples to predict a target (classification or regression) by fitting inputs to known outputs. Unsupervised Learning: The model finds structure in unlabeled data (e.g., clustering, dimensionality reduction) without a target variable. Semi-Supervised Learning: The model uses a small amount of labeled data plus a larger amount of unlabeled data to improve learning when labels are scarce.
- 10.3: Overview of Common Algorithms in Predictive Analytics
- Supervised Learning: The model learns from labeled examples to predict a target (classification or regression) by fitting inputs to known outputs. Unsupervised Learning: The model finds structure in unlabeled data (e.g., clustering, dimensionality reduction) without a target variable. Semi-Supervised Learning: The model uses a small amount of labeled data plus a larger amount of unlabeled data to improve learning when labels are scarce.
- 10.4: Model Evaluation and Validation
- Training, Testing, and Validation Splits: Data are split so the model is trained on one subset and evaluated on held-out data to estimate generalization; a separate validation set is used for tuning. Cross-Validation: K-fold cross-validation trains the model K times on different train/validation splits and averages performance to get a more stable estimate of generalization. Confusion Matrix and Classification Metrics: The confusion matrix (TP, TN, FP, FN) supports metrics such as accuracy, prec
- 10.5: Overfitting and Generalization
- Overfitting is when the model fits training data (including noise) too closely and performs poorly on new data; underfitting is when it is too simple to capture the real pattern. The bias–variance tradeoff is discussed, along with ways to improve generalization: more data, regularization, cross-validation, ensembles, pruning, early stopping, and feature selection or dimensionality reduction.
- 10.6: When to Use Machine Learning vs Traditional Analytics Methods
- Scenarios Suited for Machine Learning: ML is appropriate for large or complex data, prediction/automation, non-linear or unstructured data, and when patterns are hard to specify by hand. Scenarios Suited for Traditional Analytics: Traditional methods are better when the problem is simple, data are limited, interpretability or hypothesis testing (e.g., causality) is important, or a simple rule or regression is sufficient. Guidelines Recap: Choose ML when prediction and automation on complex data


