Leading With Data· a Bicycle Guide
Guide highlights

You can build marketing reporting and interactive dashboard solutions. You can segment customers, predict their lifetime value, and model their decisions.

  • Prepare and clean raw data into structured form with pandas.
  • Explore and visualize data to identify KPIs and relationships.
  • Segment customers using clustering and evaluate the best approach.

Book profile

Data Science for Marketing Analytics

One book, placed in its field — what Tommy Blanchard's book gets right, where it goes further than the rest, and what the rest of the field adds.

Edited by Mike West

Choose a reading path or an exercise

Suggested sections

Choose a starting point below. Each link opens a section of this guide.

Do this now — Data Quality and Structure

  1. Reshape raw exports into one row per entity (customer, order, or campaign-day) and verify each value sits in the correct column by checking types, ranges, and category labels.
  2. Profile missingness by column and segment, then choose between imputation, an explicit 'missing' indicator, or removal based on why the values are absent.
  3. Review outliers against business context, such as bulk orders, test transactions, or refunds, before capping, transforming, or excluding them.
  4. Deduplicate customer records across sources using a stable key, and log row counts after each cleaning step.

Then continue in Data Quality and Structure.

Edition 1·Updated 2026-10-03·22 min read

Sources

About this book

An overview of the book, with source information for further reading.

A hands-on, end-to-end guide to applying Python data science techniques—from cleaning raw data to clustering, regression, and classification—to solve real marketing problems like segmentation, customer value prediction, and churn.

More on this book

Data Science for Marketing Analytics teaches marketers and developers how to build a complete analytics pipeline in Python using pandas, Matplotlib, seaborn, and scikit-learn. Starting with messy, unstructured marketing data, the book walks through cleaning and structuring data, exploring and visualizing it to generate targeted insights, and then applies unsupervised learning (k-means, mean-shift, k-modes, k-prototypes) to segment customers. It progresses to supervised learning, teaching linear, lasso, and tree-based regression to predict customer revenue and lifetime value, and logistic regression, SVMs, decision trees, and random forests to predict churn and model customer choice. Through practical exercises and business-scenario activities, readers learn how to select features, evaluate and fine-tune models with proper metrics, handle imbalanced data, and interpret results—leaving them able to think like a data scientist and apply these skills to marketing decisions.

Movement I

Orient

In this part

What this book claims, and who wrote it.

  • — The book's one-line promise
  • — The author and where the book stands

A hands-on, end-to-end guide to applying Python data science techniques—from cleaning raw data to clustering, regression, and classification—to solve real marketing problems like segmentation, customer value prediction, and churn.

The need-to-know

Most of the work in marketing analytics is data preparation—garbage in, garbage out. Standardizing data is essential before computing similarity and clustering when variables are on different scales. There are multiple ways to choose and evaluate clusters (visual inspection, elbow/SSE, silhouette score), each with tradeoffs.

About this guide

The guide describes these challenges, steps and possible outcomes.

Who it is for

A marketing analyst or developer who wants to use more sophisticated data science tools to segment customers, predict value, and reduce churn.

Challenges

  • In practice · Raw marketing data is messy and underused, and traditional segmentation and prediction methods miss valuable patterns.
  • For the reader · They feel that data science's full potential is out of reach and worry they lack the technical skills to build real predictive pipelines.

Steps to consider

  1. 1Prepare and clean raw data into structured form with pandas.
  2. 2Explore and visualize data to identify KPIs and relationships.
  3. 3Segment customers using clustering and evaluate the best approach.
  4. 4Predict customer revenue and lifetime value using regression, with proper feature selection and evaluation.
  5. 5Predict customer churn and choice using classification, then tune, evaluate, and handle imbalanced data.

Risks

Your marketing budget is spent inefficiently on poorly targeted customers. Hidden customer patterns and high-value segments go undetected.

Intended result

You can build marketing reporting and interactive dashboard solutions. You can segment customers, predict their lifetime value, and model their decisions.

Set the record straight

What this book sets straight

The common beliefs this book pushes back on.

The myth

Customer segmentation is best done by an analyst applying intuition and arbitrary thresholds (e.g., income tiers).

The reality

Intuition-based segmentation misses hidden patterns and creates sparse or meaningless groups; unsupervised clustering finds data-driven segments that would otherwise be overlooked.

The myth

A model with high accuracy is a good model.

The reality

Accuracy is misleading on imbalanced data; metrics like precision, recall, F1, and ROC/AUC—and sampling techniques like SMOTE—are needed to build models that actually generalize.

The myth

Linear regression is sufficient for most prediction tasks.

The reality

Linear models only capture linear relationships and interactions poorly; tree-based methods like random forests often fit complex, non-linear marketing relationships better.

The myth

Quantitative measures alone tell you the correct number of clusters.

The reality

Quantitative measures only tell you how well a number of clusters fits the data, not how useful or interpretable the resulting clusters are—judgment still matters.

Movement II

Map

The book's main ideas and how they connect.

In this part

Data Science for Marketing Analytics's own model — and how it sits inside its field.

  • — 10 constructs the book works with
  • — Where it agrees with the field, exceeds it, or fills a gap
What You Design7· the levers you pull
Feature Engineering QualityFeature SelectionData Quality and StructureData Standardization and ScalingAlgorithm and Model ChoiceHyperparameter TuningClass Imbalance Handling
What It Produces1· the states it creates
Model Fit and Generalization

The constructs

Data Quality and Structure

The degree to which raw marketing data has been cleaned, structured into tabular form with correct values in correct attributes, and had missing values and outliers handled before analysis.

Feature Engineering Quality

The extent to which raw or transactional data is transformed into meaningful, predictive features that capture aspects relevant to the outcome of interest, combining data and domain expertise.

Feature Selection

The process of choosing only the features related to the outcome for training a model, using methods such as lasso regularization, tree-based importance, or univariate/recursive selection to reduce noise and dimensionality.

Data Standardization and Scaling

The preprocessing of variables so they are on comparable scales (e.g., z-scoring, min-max scaling, normalization), enabling fair similarity computation and preventing high-magnitude features from dominating.

Algorithm and Model Choice

The selection of an appropriate learning algorithm (e.g., k-means vs mean-shift, linear vs tree-based regression, logistic regression vs SVM vs random forest) matched to the structure and relationships in the data.

Hyperparameter Tuning

The optimization of model hyperparameters (e.g., number of clusters, tree max depth, SVM penalty and kernel) through methods like grid search and cross-validation to improve model performance and generalization.

Class Imbalance Handling

The application of techniques such as random undersampling, oversampling, SMOTE, or class weighting to correct for over-representation of one class so models can generalize to minority classes.

Model Fit and Generalization

The internal state of a trained model reflecting how well it captures the true relationships in data without overfitting, validated on held-out test data via cross-validation.

Predictive Performance

The measured accuracy of the analytical output, captured by metrics such as RMSE/MAE for regression, silhouette score for clustering, and precision/recall/F1/AUC for classification on test data.

Actionable Marketing Insight and Decisionsthe outcome

The business value derived from the analysis, including interpretable customer segments, predicted customer value, identified churn drivers, and targeted marketing actions that improve ROI and resource allocation.

How they connect (10)
  • Data Quality and Structure → predicts → Feature Engineering Quality
  • Feature Engineering Quality → predicts → Feature Selection
  • Feature Selection → predicts → Model Fit and Generalization
  • Data Standardization and Scaling → moderates → Model Fit and Generalization
  • Algorithm and Model Choice → predicts → Model Fit and Generalization
  • Hyperparameter Tuning → moderates → Model Fit and Generalization
  • Class Imbalance Handling → moderates → Model Fit and Generalization
  • Model Fit and Generalization → predicts → Predictive Performance
  • Predictive Performance → predicts → Actionable Marketing Insight and Decisions
  • Data Quality and Structure → influences → Actionable Marketing Insight and Decisions

Where this book diverges from the corpus

  • fills gap The field's model has no construct for turning transactional data into predictive features, which is a core modeling craft the book makes explicit.
  • fills gap Choosing predictors with lasso, tree importance or recursive selection is not covered by the field's reconciled constructs.
  • fills gap Scaling variables so similarity-based methods are not dominated by high-magnitude features is a technical preprocessing step absent from the field model.
  • exceeds The field names matching technique to question as part of rigor, but the book operationalizes it with concrete algorithm comparisons (k-means vs mean-shift, logistic regression vs SVM vs random forest).
  • exceeds The field gestures at validation discipline, while the book specifies grid search and cross-validation for tuning cluster counts, tree depth and SVM parameters.
  • fills gap Undersampling, oversampling, SMOTE and class weighting for rare outcomes such as churn have no counterpart in the field's constructs.

Movement III

Master

Explore the book's ideas, examples and practical tools.

In this part

How the author makes the case — section by section, with the book's own tools.

  • — 10 sections, in the book's order
  • — The book's frameworks, checklists, and worked cases
Hyperparameter Tuning
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section covers tuning settings such as cluster count, tree depth, and SVM penalty and kernel with grid search and cross-validation. It shows how to tune without fooling yourself.

Hyperparameter Tuning

The optimization of model hyperparameters (e.g., number of clusters, tree max depth, SVM penalty and kernel) through methods like grid search and cross-validation to improve model performance and generalization.

Why it matters. Default settings can leave an overfit tree or a poorly chosen segment count in production, while careless tuning against the test set produces numbers that vanish on new customers.

Myth

Tuning is the final polish that reliably lifts accuracy, so the more combinations you search, the better the model.

Reality

Tuning mainly controls the bias-variance trade-off, and gains are often small relative to features and data quality. An exhaustive search against noisy validation scores fits the validation noise.

Tools for this
The least you need to know
  • Tune with cross-validation and touch the test set once, or your final metric overstates real performance.
  • Prefer the simplest configuration within noise of the best, since it generalizes more reliably.
  • Treat the cluster count as a business decision informed by silhouette, not a value the metric alone dictates.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Hyperparameter Search Plan” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 3 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Class Imbalance Handling
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section shows how to deal with rare outcomes like churn, fraud, or purchases using undersampling, oversampling, SMOTE, and class weights. It also covers how to evaluate honestly once classes are rebalanced.

Class Imbalance Handling

The application of techniques such as random undersampling, oversampling, SMOTE, or class weighting to correct for over-representation of one class so models can generalize to minority classes.

Why it matters. With 3% conversion, a model that predicts 'no purchase' for everyone scores 97% accuracy and finds no buyers, so unaddressed imbalance can yield a useless targeting model that looks excellent.

Myth

Balancing the classes is always required, and resampling the whole dataset to 50/50 before modeling is the standard fix.

Reality

Resampling must happen only on training data, and sometimes class weights or a shifted decision threshold work as well without discarding or inventing records. Balancing also distorts predicted probabilities, so they need recalibration before use in expected-value calculations.

Tools for this
The least you need to know
  • Resample only inside training data and keep the test set at the true class ratio.
  • Try class weights and threshold tuning first, since they avoid altering the data.
  • Judge imbalanced models on precision, recall, and AUC, never raw accuracy.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Imbalance Correction Log” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 4 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Model Fit and Generalization
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section explains how to judge whether a model has learned real customer patterns or just memorized its training data. It centers on held-out validation and cross-validation.

Model Fit and Generalization

The internal state of a trained model reflecting how well it captures the true relationships in data without overfitting, validated on held-out test data via cross-validation.

Why it matters. A model that overfits will score well in the notebook and then mis-target real campaigns, wasting spend and eroding trust in analytics.

Myth

A high training score or a good fit to the data you have shows that the model works.

Reality

Training performance rewards memorization, and only the gap between training and held-out results reveals overfitting. Under time-dependent marketing data, even a random cross-validation split can hide drift if future behavior leaks into the past.

Tools for this
The least you need to know
  • Judge a model by the gap between training and held-out performance, not by training fit.
  • Use time-ordered splits when behavior changes over time, and keep each customer in only one fold.
  • Treat feature selection, scaling, tuning, and imbalance handling as inputs to fit that must all stay inside the validation loop.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Model Fit and Generalization Check Sheet” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 2 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Predictive Performance
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section covers choosing and reading the metrics that quantify model accuracy: RMSE and MAE for regression, silhouette for clustering, and precision, recall, F1, and AUC for classification.

Predictive Performance

The measured accuracy of the analytical output, captured by metrics such as RMSE/MAE for regression, silhouette score for clustering, and precision/recall/F1/AUC for classification on test data.

Why it matters. Choosing a metric that diverges from the business cost, such as optimizing AUC when the campaign can only contact the top 5% of customers, leads you to ship a model that is better on paper than in practice.

Myth

The model with the best headline metric is the best model for the business.

Reality

Metrics weight errors in ways that may not match your costs: RMSE punishes large lifetime-value misses, while precision and recall trade wasted offers against missed buyers. A number only means something relative to a baseline and to what the decision requires.

Tools for this
The least you need to know
  • Select metrics by the business cost of each error type, then evaluate against a naive baseline.
  • Report top-decile lift or similar decision-level measures alongside AUC or RMSE.
  • Show variability across folds so stakeholders know how much a small metric difference is worth.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 6 failure modes, and the “Predictive Performance Scorecard” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 7 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Actionable Marketing Insight and Decisions
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section covers turning model output into segments, value predictions, churn drivers, and targeting decisions that change how budget is spent. It focuses on closing the gap between a good model and a different action.

Actionable Marketing Insight and Decisions

The business value derived from the analysis, including interpretable customer segments, predicted customer value, identified churn drivers, and targeted marketing actions that improve ROI and resource allocation.

Why it matters. An accurate model that nobody uses, or that surfaces drivers that can't be acted on, delivers no ROI, while a plainly interpreted segment that reshapes spend can pay for the whole analytics effort.

Myth

Once predictive performance is high enough, the business value follows automatically.

Reality

Accuracy is necessary but not sufficient: value depends on whether outputs are interpretable, tied to an available intervention, and tested against outcomes. A churn score is only useful if the team has an offer that changes the behavior of the customers it flags.

Tools for this
The least you need to know
  • Define the action each segment or score triggers before presenting results, or the analysis will not change spend.
  • Estimate value as probability times customer value minus offer cost, and rank by net return rather than raw score.
  • Prove incremental impact with a holdout test before scaling any model-driven campaign.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Insight-to-Action Brief” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 3 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Data Quality and Structure
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section shows what 'clean enough' means for marketing data and how to get there before any modeling starts. It covers structure, missing values, and outliers as upstream decisions that shape every later result.

Data Quality and Structure

The degree to which raw marketing data has been cleaned, structured into tabular form with correct values in correct attributes, and had missing values and outliers handled before analysis.

Why it matters. A CRM export with misaligned columns, duplicated customers, or silently imputed revenue produces confident segments and churn scores that describe your data pipeline rather than your customers.

Myth

Cleaning is a mechanical chore you finish quickly so the real analysis can begin, and dropping rows with missing values or extreme outliers is the safe default.

Reality

Every cleaning choice is a modeling assumption: missing income may signal a customer who declined to share it, and a $40,000 order may be your most valuable B2B account. Treat deletion and imputation as hypotheses about why the data looks this way, and document them.

Tools for this
The least you need to know
  • Treat missing values and outliers as information about how the data was generated, and decide case by case whether to impute, flag, or drop them.
  • Reshape data to one row per analysis entity with validated types and ranges before any feature work begins.
  • Keep a cleaning log with row counts at each step so you can trace any odd result back to a specific decision.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Data Quality Intake Checklist” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 5 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Feature Engineering Quality
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section explains how to turn transactions, clickstreams, and customer attributes into variables that carry predictive signal. It shows where domain knowledge adds more than additional data does.

Feature Engineering Quality

The extent to which raw or transactional data is transformed into meaningful, predictive features that capture aspects relevant to the outcome of interest, combining data and domain expertise.

Why it matters. Features set the ceiling for what any algorithm can learn, so a model fed raw order lines will miss the purchasing patterns that a few well-built features would expose.

Myth

A flexible enough algorithm will discover the useful patterns on its own, so time spent crafting features is better spent trying more models.

Reality

Algorithms can only recombine what you give them, and they rarely infer concepts like recency or a declining purchase cadence from raw timestamps. Domain-informed features usually move performance more than a model swap does.

Tools for this
The least you need to know
  • Build features that encode behavior over time, such as recency, trend, and cadence, because raw totals hide the change that predicts outcomes.
  • Compute every feature as of the prediction date to prevent leakage that makes the model look better than it is.
  • Use domain experts to propose features before reaching for automated generation.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Feature Quality Checklist” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 3 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Feature Selection
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section covers how to prune a feature set to the variables that relate to the outcome, using lasso, tree-based importance, and univariate or recursive methods. It also shows how to do it without contaminating your evaluation.

Feature Selection

The process of choosing only the features related to the outcome for training a model, using methods such as lasso regularization, tree-based importance, or univariate/recursive selection to reduce noise and dimensionality.

Why it matters. Keeping noisy or redundant features lets a model memorize quirks of the training sample, while pruning carelessly can discard the interaction that drives conversion.

Myth

Features with the highest importance scores are the true drivers of the outcome, so the selected list tells you what to act on.

Reality

Importance reflects predictive contribution within one model and one sample, and correlated features split or steal credit from each other. Selection improves generalization, but it does not establish causes.

Tools for this
  • Feature SelectionFramework — How this mechanism is run, step by step, as the literature describes it.
  • Feature SelectionCase study — Chapter 5, Exercise 22 builds a model that predicts customer spend from wrangled_transactions.csv, indexed by CustomerID.
  • Feature Selection LogTemplate
The least you need to know
  • Perform feature selection inside cross-validation folds, or your performance estimate is optimistic by construction.
  • Treat selected features as predictive, not causal, and test them through experiments before reallocating spend.
  • Handle collinearity before ranking importance, because correlated features split credit and mislead the ranking.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Feature Selection Log” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 3 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Data Standardization and Scaling
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section explains when and how to put variables on comparable scales using z-scores, min-max scaling, or normalization. It focuses on the methods where scale decides the result, such as distance-based clustering and penalized regression.

Data Standardization and Scaling

The preprocessing of variables so they are on comparable scales (e.g., z-scoring, min-max scaling, normalization), enabling fair similarity computation and preventing high-magnitude features from dominating.

Why it matters. In k-means on customer data, an unscaled annual-revenue column measured in thousands overwhelms visit counts and segments customers by spend alone.

Myth

Scaling is a universal prerequisite that improves every model, so every feature should always be standardized.

Reality

Scaling matters for algorithms that use distances or penalties, such as k-means, SVM, KNN, and lasso, and has essentially no effect on tree-based models. It also needs care with skew, since z-scoring a heavy-tailed spend variable leaves the outliers dominant.

Tools for this
The least you need to know
  • Scale features for clustering, SVM, KNN, and lasso, where magnitude changes the result, and not for tree-based models.
  • Fit scalers on training data only and reuse them unchanged at scoring time.
  • Correct skew before scaling, because standardization alone does not tame heavy-tailed spend variables.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Scaling Method Selection Sheet” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 2 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Algorithm and Model Choice
strong · 1 source
  • Data Science for Marketing Analytics
In this section

This section helps you match an algorithm to the structure of your marketing problem, whether segmentation, churn classification, or value regression. It emphasizes starting from the data's shape and the decision's needs.

Algorithm and Model Choice

The selection of an appropriate learning algorithm (e.g., k-means vs mean-shift, linear vs tree-based regression, logistic regression vs SVM vs random forest) matched to the structure and relationships in the data.

Why it matters. A model whose assumptions conflict with your data's structure, such as linear regression on thresholded response curves, caps accuracy no matter how much you tune it, and an opaque model may never get adopted by the team that needs to use it.

Myth

More complex algorithms like random forests or deep networks are inherently better, so the choice should default to the most powerful option.

Reality

On the modest, tabular, noisy datasets typical in marketing, a regularized logistic regression often matches an ensemble while staying explainable. The right choice depends on data size, nonlinearity, interpretability needs, and the cost of an error.

Tools for this
The least you need to know
  • Always benchmark against a simple baseline, because the complex model must earn its added opacity.
  • Choose algorithms by data structure and decision requirements, not by sophistication.
  • Compare candidates under identical splits and preprocessing so differences reflect the algorithm.
Master this◆ Paid

The deep drill-down: 8 operational steps, a worked example from the source, 5 decision rules, 5 failure modes, and the “Algorithm Selection and Comparison Sheet” tool. Included when you buy this guide.

The rest of this section

the full written section · 4 how-to steps · 2 pitfalls to watch for · 8 tools for this section. Included when you buy this guide.

Grounded in: Data Science for Marketing Analytics

Movement III · The run-it-now depth

The Playbook

Practical tools and examples from this guide.

Frameworks

Frameworkfree

Actionable Marketing Insight and Decisions

How this mechanism is run, step by step, as the literature describes it.

  1. 1Write the business question and the KPI before touching a model. The source says KPIs are target metrics that quantify business expectations, and that you must be clear about the scope of the data, the questions it can address and the problems it can solve before drawing inference. Name the decision the analysis feeds (who to target, what to spend, which customers to retain).
  2. 2Run exploratory data analysis and check that each attribute agrees with business intuition. If values don't make sense, dig into them, remove outliers and find out why the attribute holds those values. The source warns that skipping this leads to inaccurate models, models built on the wrong data, and inefficient use of resources.
  3. 3Summarize attributes and compare them with your KPIs. Use pandas aggregations, pivot tables and Matplotlib/seaborn visuals to see how attributes relate to the target metric, and decide which attributes the analysis actually needs.
  4. 4Build interpretable segments with clustering. Standardize the data first (the book's example uses age and income), then run k-means or hierarchical clustering, and pick the segmentation approach by evaluation, not by default. Profile each cluster in business terms so a marketer can describe it in one sentence.
  5. 5Predict customer value with regression. Check predictor–outcome relationships with visualizations and correlations, fit a linear model for customer spend or lifetime value, and evaluate it with MAE and RMSE. Use Lasso regularization to drop weak features, and tree-based models or random forests when trends are non-linear.
  6. 6Model churn or customer choice as a classification problem. Use logistic regression and a pipeline (obtain, scrub, explore, model), and read the coefficients and feature importances to identify churn drivers. Evaluate with multiclass metrics and a confusion matrix, not accuracy alone.
  7. 7Handle class imbalance before trusting a churn model. Rare churners can make a model look accurate while it misses them. Apply sampling techniques such as SMOTE, then rebuild the confusion matrix and check the minority class.
  8. 8Translate outputs into actions with a resource allocation. For each segment or risk tier, state the action, the driver it addresses, and the expected ROI effect. Rank by value times responsiveness, fund the top tiers, and set the KPI that will confirm the result.
Framework◆ Paid

Algorithm and Model Choice

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Class Imbalance Handling

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Data Quality and Structure

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Data Standardization and Scaling

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Feature Engineering Quality

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Feature Selection

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Hyperparameter Tuning

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Model Fit and Generalization

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Framework◆ Paid

Predictive Performance

How this mechanism is run, step by step, as the literature describes it.

◆ The full 8-step framework — included with this guide purchase

Checklists

Checklistfree

Actionable Marketing Insight and Decisions — decision rules

  • If an attribute's values don't match business intuition, then investigate and clean (outliers, data quality) before modeling.
  • If a segment can't be described in plain business terms, then change the number of clusters or the features and re-evaluate before presenting it.
  • If a regression has many weak predictors, then apply Lasso to select features; if trends are non-linear, then compare against a tree-based or random forest model using MAE/RMSE.
  • If churners are a small minority, then do not trust accuracy; rebalance (e.g., SMOTE) and judge the model by the confusion matrix.
  • If a recommendation has no KPI, action and expected ROI attached, then it is not yet an insight; do not allocate budget on it.
Checklist◆ Paid

Algorithm and Model Choice — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Class Imbalance Handling — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Data Quality and Structure — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Data Standardization and Scaling — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Feature Engineering Quality — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Feature Selection — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Hyperparameter Tuning — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Model Fit and Generalization — decision rules

◆ All 5 checkpoints — included with this guide purchase

Checklist◆ Paid

Predictive Performance — decision rules

◆ All 5 checkpoints — included with this guide purchase

Case studies — including what didn't work

Case studyfree

Actionable Marketing Insight and Decisions

Context

The source reports the kind of payoff this work aims at. Predictive algorithms generating marketing leads at Dell reportedly converted 50% of final leads, against 17% for traditional methods. Price management based on customer lifetime value reportedly raised margins 2%–7% over 12 months and returned 200%–350% ROI. Apply the same logic to your own data: first, define the KPI (for example, revenue per customer). Second, standardize age and income and cluster customers with k-means into segments. Third, fit a linear regression for customer spend, check MAE and RMSE, and use Lasso to keep only the predictors that matter. Fourth, fit a churn classifier, rebalance with SMOTE if churners are rare, and read the drivers. Finally, concentrate budget on high-predicted-value segments and apply retention offers where churn drivers are strongest, and track the KPI against the baseline. The book's 17%-to-50% contrast is the benchmark for judging whether a targeted approach beats a traditional one; your own numbers must come from your data.

Case study◆ Paid

Algorithm and Model Choice

Context

The source's clustering chapter gives a direct case. Exercise 16 clusters customers on age and income from ageinc.csv. You standardize both columns into z_income and z_age by subtracting the mean and dividing by the standard deviation. You then run mean-shift, using estimate_bandwidth to set how far each point looks for a denser area. The authors warn that this bandwidth, set through a quantile of nearby-point distances, is the same kind of choice as picking k, so mean-shift does not remove the tuning burden. They justify using it anyway because it is a different algorithm and will fit certain datasets better than k-means. Exercise 18 settles the question empirically: compute the silhouette score to pick the best k for k-means, then compare that result against the mean-shift output. Exercise 19 adds a train-test split so each algorithm is judged on how well it generalizes to unseen data. The choice comes from measured comparison, not preference.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Class Imbalance Handling

Context

The passages give the setup rather than numbers, so this example is partly illustrative. Take a dataset where one class is 90% of samples and another is 10%, the split the source uses to describe imbalance. A model that predicts only the majority class scores 90% accuracy and finds zero minority cases, which is the failure the source describes for decision trees: they split on the majority class and 'don't generalize very well'. First, split with StratifiedKFold (n_splits=10) so every fold holds roughly 90/10, as in the bank churn exercise (Exercise 41). Second, fit the baseline and read its confusion matrix: the minority-class row exposes the problem that the accuracy figure hides. Third, plot the sampling techniques (Exercise 48) and fit a random forest classifier with SMOTE (Exercise 49). Fourth, build the new confusion matrix and check whether minority-class hits rise. The comparison of the two confusion matrices is what the correction is judged on.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Data Quality and Structure

Context

The source's sales dataset has Revenue, Planned Revenue, Quantity, and Gross Profit across 2004 to 2007. You load it into a pandas DataFrame, run info() and describe(), and compare the numbers with what the business expects. Then you draw boxplots per year (2004 to 2007, with 2005, 2006, and 2007 shown separately) to see whether any year's values break from the rest. Gross Profit contains missing values, so you call dropna() on that column and plot a histogram with sns.distplot(sales['Gross profit'].dropna(), kde=False). Any value that looks wrong against the KPI expectations gets investigated, and genuine outliers are removed, before any model is built. Skipping this step risks inaccurate models, models built on the wrong data, and wasted resources.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Data Standardization and Scaling

Context

The source's bank churn exercise uses five features selected by random forest: Age, EstimatedSalary, CreditScore, Balance, and NumOfProducts. Their raw magnitudes differ widely. Balance and EstimatedSalary run far higher than NumOfProducts or Age, so left raw they would dominate a distance or an objective function. The exercise imports `from sklearn import preprocessing` and fits `StandardScaler` on `X_train[top5_features]`. It reads `scaler.mean_` (the five column means) and `scaler.scale_` (the five scaling values). It then calls `scaler.transform` on `X_train[top5_features]` and on `X_test[top5_features]`. The output is a train array centered at zero with unit variance, and the test set is scaled with the training statistics. Exercise 39 repeats the pattern with `MinMaxScaler`, checking `min_` and `scale_` and transforming both sets, which squeezes each feature toward the 0–1 range. For customer segmentation in Chapter 3, the same logic applies to age and income. Income's larger numbers would otherwise swamp age in the distance between customers.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Feature Engineering Quality

Context

The source's Exercise 20 starts from historical transaction data from 2010 and 2011, with a customer identifier on each transaction. The goal is to predict a customer's later spend from earlier behavior. Following the source's two-period logic, you split the data into an earlier window, used to compute features, and a later window, where spend is already known and becomes the outcome. From the earlier window you build one row per customer with the features the source names: number of previous purchases, total amount spent, and time since the last order. While building them, you check each for missing values and outliers. A customer with spend more than three standard deviations above the median is a candidate for removal, because it may not reflect normal behavior. You then plot each feature against later spend and check correlations, as in Exercise 21, to see which features relate to the outcome. The cleaned feature table feeds the linear model in Exercise 22. Only passages for the exercise's setup are available here, so the specific values and the final feature set are not stated.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Feature Selection

Context

Chapter 5, Exercise 22 builds a model that predicts customer spend from wrangled_transactions.csv, indexed by CustomerID. You call df.corr() and recall that days_since_first_purchase has only a weak relationship with 2011 revenue, so you leave it out. You keep four predictors: 2010 revenue, days_since_last_purchase, number_of_purchases and avg_order_cost. You split with random_state=100 and fit LinearRegression on the training portion. The coefficients are 4.14, -1.66, 394.96 and -0.49, with an intercept of 538.74. That gives 2011 revenue = 538.74 + 4.14*(2010 revenue) - 1.66*(days_since_last_purchase) + 394.96*(number_of_purchases) - 0.49*(avg_order_cost). You then predict for a new customer with 2010 revenue 1,000, 20 days since the last purchase, 2 purchases and an average order cost of 500. The selection step is the quiet correlation check that removed one column before any model was fit. The equation stays short enough to read and explain.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Hyperparameter Tuning

Context

Exercise 42 tunes an SVM for customer churn on the top5_features. The data is preprocessed first, and logistic regression with 10-fold CV sets a baseline accuracy of 0.790. The search space is two dicts: a linear kernel with C in [0.1, 1, 10], and an rbf kernel with gamma in [0.5, 1, 2] and C in [0.1, 1, 10]. That is 3 + 9 = 12 candidate settings, each scored through StratifiedKFold(n_splits=10). GridSearchCV(svm.SVC(), parameters, cv=StratifiedKFold(n_splits=10)) is fit on X_train[top5_features] and y_train. The reported best parameters are C=0.1, gamma=0.5, kernel=rbf. The passage's note is that grid search is slow, so the grid must be chosen sensibly. For clustering, Exercise 18 applies the same logic. It runs k-means for k=2 to 10, averages the silhouette per k, and compares the best against mean-shift on the same standardized four_cols data.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Model Fit and Generalization

Context

Exercise 24 gives you store revenue plus 20 unlabeled internal scores, and the task is a predictive model that uses as few scores as possible without sacrificing the ability to predict location revenue. You read 20scores.csv into df, set X to all columns after the first and y to 'revenue', and split with train_test_split(X, y, random_state=10). You fit LinearRegression on the training data and print model.coef_. The output is 20 coefficients of mixed sign and size, such as 31.05, 1.36, -17.20, and -38.21. Every score carries some weight, so you cannot tell which ones matter. You then fit lasso regression, whose regularization pushes useless variables' weights toward being dropped entirely. The surviving variables define a smaller model that is still a simple equation. You judge the smaller model on X_test and y_test using MAE and RMSE and compare it against the full linear model. If the error on held-out data is about the same, the extra features were noise, and the compact model is the one that generalizes.

◆ What happened, and the outcome — included with this guide purchase

Case study◆ Paid

Predictive Performance

Context

The book's lasso exercise (Exercise 24) uses store revenue data with 20 unlabeled scores. The goal is a model that uses as few scores as possible without losing predictive ability. You split with random_state=10, with revenue as y and the 20 scores as X. You fit ordinary LinearRegression on the training set and inspect model.coef_. Most coefficients are small, such as 31.05, 1.36 and -17.20, but one is 9.1258e+03. That outlier tells you the ordinary model leans heavily on a single variable. A lasso model is then used to drop the unhelpful scores. The accuracy check is the book's regression evaluation: compare model predictions with the true test values and compute MAE and RMSE. The book's Exercise 23 prints a pair of results, (0.906..., 1.155...). The second is larger, which is consistent with RMSE being at least MAE. You keep the smaller lasso model only if its test MAE and RMSE stay close to the full model's.

◆ What happened, and the outcome — included with this guide purchase

Templates

Templatefree

Insight-to-Action Brief

Template◆ Paid

Algorithm Selection and Comparison Sheet

◆ The fillable template — included with this guide purchase

Template◆ Paid

Imbalance Correction Log

◆ The fillable template — included with this guide purchase

Template◆ Paid

Data Quality Intake Checklist

◆ The fillable template — included with this guide purchase

Template◆ Paid

Scaling Method Selection Sheet

◆ The fillable template — included with this guide purchase

Template◆ Paid

Feature Quality Checklist

◆ The fillable template — included with this guide purchase

Template◆ Paid

Feature Selection Log

◆ The fillable template — included with this guide purchase

Template◆ Paid

Hyperparameter Search Plan

◆ The fillable template — included with this guide purchase

Template◆ Paid

Model Fit and Generalization Check Sheet

◆ The fillable template — included with this guide purchase

Template◆ Paid

Predictive Performance Scorecard

◆ The fillable template — included with this guide purchase

Items marked Paid are included when you buy this guide.

Movement IV

Reflect

Consider the book's evidence, limitations and how it compares with other sources.

In this part

How good is it — where the book stands against the field, what it leaves open, and when to trust it.

  • — Its positioning, its critique, its blind spots
  • — When to apply it — and when not
  • — The evidence behind the advice

Book profile · in the corpus

This book’s model, against the corpus

6 of 10 constructs align with the field · 4 the book adds · 4 where it diverges · the field spans 36 constructs across 38 books

shared with the corpusthis book's own emphasisthe corpus adds (other sources)where it diverges

Shared with the corpus — corroborated by other sources

Data Quality and StructureAlgorithm and Model ChoiceHyperparameter TuningModel Fit and GeneralizationPredictive PerformanceActionable Marketing Insight and Decisions

This book's own emphasis — where it's the authority

Feature Engineering QualityFeature SelectionData Standardization and ScalingClass Imbalance Handling

Where it diverges — the book and the field pull apart

Algorithm and Model ChoiceHyperparameter TuningModel Fit and GeneralizationActionable Marketing Insight and Decisions

The corpus adds — from 37 other sources this book doesn't cover

The full field guide folds in ideas this book doesn’t reach — drawn from 37 further sources and cited in the full model.

This book’s place in the corpus

1 of 38
sources in this corpus
10
constructs contributed
6
corroborated by others
4
unique to this book

Why the corpus guide, not just this book

The book builds on the field's general call for data quality, rigorous modeling and actionable insight, and is the authority on the technical ML workflow: feature engineering and selection, scaling, imbalance handling, tuning and generalization. The reconciled field-guide still adds the organizational, measurement, experimentation, communication and ethics context that determines whether these models get adopted and create value.

This guide stands on the shoulders of this book and 37 other sources — every claim cited, the disagreements named.

Read the reconciled Marketing Analytics guide →

Read it closely

The book, examined

Not a summary — a close analytical reading: how the book is built, what it leaves open, and where it falls short.

How it’s built — the argument in order

  1. 01
    Front matter: objectives, audience, approach, setup — Sets the promise (analyze and visualize data, cluster, predict CLV, classify customer choice, optimize classifiers). Assumes some Python and high-school math. Defines a hands-on, activity-driven method built on realistic business scenarios, plus the hardware and software setup (Conda Python 3.x, a browser).
  2. 02
    Data preparation and structuring (pandas, cleaning) — Turns messy, unstructured marketing data into clean, analyzable form: reading CSVs, renaming columns, fixing data types, handling missing values. Frames the principle that most analytics work is preparation (garbage in, garbage out).
  3. 03
    Exploration and visualization (Matplotlib, seaborn) — Uses descriptive statistics, correlations, and univariate and bivariate plots to produce targeted insight about relationships, such as complaint code or plan type against churn, before any modeling.
  4. 04
    Unsupervised learning: customer segmentation — Introduces standardization and similarity, then k-means, mean-shift, k-modes, and k-prototypes. Covers choosing the number of clusters (visual inspection, elbow/SSE, silhouette) and profiling segments for marketing use.
  5. 05
    Supervised regression: predicting revenue and CLV — Builds linear, lasso, and tree-based regression to predict continuous outcomes. Evaluates with MAE and RMSE, and uses regularization for feature selection and engineering.
  6. 06
    Supervised classification: churn and customer choice — Moves to logistic regression, SVMs, decision trees, and random forests to predict categorical outcomes. Illustrates logistic regression visually and with predict_proba for probabilities versus classes.
  7. 07
    Model evaluation, tuning, and imbalanced data — Covers choosing the right metric, hyperparameter tuning, validating on held-out test sets, and handling class imbalance with undersampling, oversampling, and SMOTE.
  8. 08
    Capstone: the OSEMN pipeline on telecom/bank churn — Frames the whole workflow as Obtain, Scrub, Explore, Model, iNterpret. Applies it in an end-to-end churn exercise: load data, check shape (4708, 15), rename columns, fix types, impute missing values (mode), explore Target_Churn, correlations, and uni/bivariate plots. Ties results back to a marketing decision.

What it leaves unsolved

How do you decide which of several clustering approaches and which cluster count is actually right for a business?

The book presents visual inspection, elbow/SSE, and silhouette as options with tradeoffs, but no definitive rule. The answer depends on judgment and on whether the segments are actionable.

How should missing values be imputed when the mode or mean may distort the data or bias the result?

The exercises fill categorical gaps with the most frequent value (e.g. 'Billing Problem', handset condition = 1) and give no analysis of how this affects downstream models or why data is missing.

Do the predictive models identify the causes of churn, or only correlates?

The bank scenario asks for the reasons behind churn, but the techniques shown (correlation, classification) produce associations and predictions, not causal explanations.

How can model outputs be translated into specific, cost-effective retention or targeting actions?

The book stresses actionable insight, but the excerpts stop at classification and metrics, without costs of intervention, uplift, or campaign design.

How well do the models hold up over time and on new data?

Validation is on a held-out test set from the same dataset. Drift in customer behavior and deployment or monitoring are not addressed.

Which imbalance technique (undersampling, oversampling, SMOTE) works best for a given churn problem?

They are presented as options with appropriate metrics, but no general guidance on choosing among them is given.

Where it falls short — a fair critique

incomplete

The pipeline stops at 'interpret'. Deployment, monitoring, A/B testing of interventions, and measuring business ROI are not covered, so the link from model to marketing decision stays thin.

incomplete

Imputation is limited to most-frequent or mean replacement with little discussion of missingness mechanisms, imputing after the train/test split, or sensitivity checks, which are central to the 'data quality matters most' thesis.

misinformed

Hard-coding fill values such as 'Billing Problem' and handset condition = 1 from the full dataset, and flipping data types back and forth (object to int64), looks like a data-leakage and hygiene risk. It teaches a questionable habit, since statistics are computed before splitting.

illogical

The logistic regression plot shows 'most' points classified correctly and concludes the model works, with no quantitative metric or baseline. This sits poorly with the book's own claim that the right metric matters, especially on imbalanced churn data where accuracy misleads.

uninformed

Correlation among continuous variables is used to explain relationships with a categorical churn target. Correlation on the continuous subset alone does not capture associations with categorical predictors or nonlinear effects.

incomplete

The claim that feature engineering and cleaning matter more than algorithm choice is asserted rather than demonstrated with side-by-side comparisons, and the statistical depth for model assumptions and interpretation (e.g. inference, calibration) is light.

incomplete

The audience is assumed to have little statistics background, yet ethical and privacy concerns of customer profiling, as well as interpretability of segments and bias in the data, are not evident in the material.

Before you apply it

Using it well

Where the method fits, who it’s for, and the honest case for and against — so you apply it where it works.

Is this book for you?

For you if

  • You are a marketing analyst or developer who wants to move beyond Excel or basic reporting to Python-based modeling
  • You learn best by working through exercises and business-scenario activities
  • You need to segment customers, predict revenue or CLV, or reduce churn
  • You want a full pipeline from cleaning through modeling to interpretation

Skip it if

  • You are already fluent in scikit-learn and want advanced methods such as deep learning, causal inference, or uplift modeling
  • You need production deployment, MLOps, or big-data tooling guidance
  • You want deep statistical theory behind the algorithms rather than applied recipes

Need first

  • Prior experience coding in Python
  • High school level mathematics
  • A working Conda Python 3.x environment with pandas, Matplotlib, seaborn, and scikit-learn
  • Helpful but optional: some exposure to databases, Excel, statistics, or Tableau

When it applies — and when it doesn’t

Use it
  • Segmenting customers with no predefined labels using k-means on variables like age and income — the book teaches unsupervised clustering for exactly this, using standardization plus elbow, silhouette and visual checks to pick the cluster count
  • Predicting customer revenue or lifetime value with linear, lasso, or tree-based regression — the book builds these models and evaluates them with MAE and RMSE, with lasso for feature selection
  • Predicting churn (e.g., the telecom and bank scenarios) with logistic regression, SVM, decision trees, or random forests — this is the book's central classification use case, supported by exercises on tuning and metric choice
  • Starting from raw, siloed, messy marketing data — the OSEMN pipeline (obtain, scrub, explore) and the cleaning steps are the book's foundation; expect most of the effort to go here
Adapt it
  • Clustering features measured on very different scales (e.g., income vs. age) — you must standardize first or the large-scale variable dominates the distance; the book treats this as essential
  • Clustering data that mixes categorical and numeric attributes — plain k-means is poorly suited here, so use the k-modes or k-prototypes variants the book covers
  • Churn datasets where churners are a small minority — accuracy misleads, so use undersampling, oversampling or SMOTE and metrics suited to imbalance
  • Imputing missing values with the mode or mean, as the exercises do — a simple fill is fine for teaching but can bias results when missingness is large or non-random; check the percentage missing first
  • Very large-scale, real-time, or production-deployed scoring systems — the book covers analysis on modest datasets in notebooks, not deployment, pipelines at scale, or monitoring
Not here
  • Reporting performance from the same data the model was trained on — the book stresses validating on a held-out test set to check generalization
  • Causal questions such as whether a campaign caused churn to fall — the techniques are predictive and descriptive, and correlation plots and classifiers do not establish causation
  • Unstructured text, images, or deep-learning problems — the scope is tabular data with classical scikit-learn methods

The honest case

Strongest case for

  • Most real marketing analytics effort is spent on cleaning and structuring data, and a pipeline-first approach (OSEMN) matches that reality
  • Feature engineering and data quality drive model quality more than algorithm choice, so teaching them first gives readers the highest-leverage skills
  • Pairing each method with a marketing problem (segmentation, CLV, churn) ties technique to business decisions, which makes the output actionable
  • Covering evaluation discipline (the right metric, tuning, a held-out test set, imbalance handling) guards against the most common beginner mistakes, such as misleading accuracy and overfitting
  • Several ways to choose and check clusters (visual, elbow, silhouette) show that judgment is required, not just one number

Strongest objection

  • Simple imputation (filling with the most common value) and quick exploratory plots can give a false sense of rigor and may bias results
  • Clean textbook-style datasets and step-by-step exercises can understate how ambiguous real marketing data and goals are
  • Predictive accuracy on churn or CLV does not tell you which interventions work, so the link to actual marketing decisions is thin without causal or experimental methods
  • Cluster solutions are partly subjective, and statistical segments may not be stable, interpretable, or actionable for a business
  • Focusing on classical algorithms in notebooks leaves out deployment, monitoring, data drift, and ethical or privacy concerns that matter in practice
Source notes

The model's constructs are drawn from the source element(s); load-bearing constructs are corroborated across the shelf, emerging ones are flagged.

Ideas covered by the source notes

  • Data Quality and Structure
  • Feature Engineering Quality
  • Feature Selection
  • Data Standardization and Scaling
  • Algorithm and Model Choice
  • Hyperparameter Tuning

Movement V

Measure

Use available assessments to reflect on what you have learned.

In this part

A way to gauge yourself against the book's model, and the instruments it gives you.

  • — A self-check built from the book
  • — Instruments and what you'd measure next

Learning curriculum

After this book, you can…

The book's learning objectives, classified by Bloom's taxonomy and ordered so each builds on the ones before it.

01Foundational — know & understand
  1. explain
    After this book you can explain why data preparation dominates marketing analytics work and describe an end-to-end pipeline (such as OSEMN: obtain, scrub, explore, model, interpret) for framing a marketing problem.
    Check: Short written response mapping a given marketing problem (e.g., bank customer churn) onto each pipeline stage and justifying why 'garbage in, garbage out' applies.
02Working — apply
  1. clean
    After this book you can clean and structure raw, messy marketing data in pandas by reading files, renaming columns, correcting data types, imputing or removing missing values, and enforcing correct values in correct attributes.
    Check: Practical exercise: given a raw CSV (e.g., telco churn data), produce a cleaned DataFrame and show checks (shape, info, missing-value counts, dtypes) confirming quality.
  2. visualize
    After this book you can explore and visualize data with pandas, Matplotlib, and seaborn (descriptive statistics, correlations, univariate and bivariate plots) to identify KPIs and generate targeted business insights.
    Check: Given a cleaned dataset, produce a set of plots and summary statistics and write interpretations highlighting relationships with the outcome (e.g., churn by plan type or complaint code).
  3. engineer
    After this book you can engineer meaningful features from raw or transactional data, combining domain knowledge with data expertise, so that they capture aspects relevant to the outcome.
    Check: Transform a transactional dataset into customer-level features (e.g., recency, frequency, revenue aggregates) and justify how each relates to the prediction target.
  4. build
    After this book you can build linear, lasso, and tree-based regression models to predict continuous outcomes such as customer revenue and lifetime value, matching the algorithm to the data's linearity and complexity.
    Check: Train and compare linear and tree-based regressors on a revenue/CLV dataset and justify which fits the relationships in the data.
  5. select
    After this book you can select a minimal set of meaningful features using lasso regularization and tree-based importance to improve interpretability and reduce overfitting.
    Check: Use lasso coefficients and tree feature importances to choose features, retrain, and show comparable or better test performance with fewer features.
  6. standardize
    After this book you can standardize and scale variables (z-scores, min-max, normalization) and explain why this is necessary before similarity-based methods such as clustering.
    Check: Apply scaling to variables on different scales, then compare clustering results with and without scaling and explain the difference.
  7. segment
    After this book you can segment customers with unsupervised algorithms (k-means, mean-shift, k-modes, k-prototypes), choosing the algorithm that matches the data types and structure.
    Check: Given numeric, categorical, and mixed datasets, select and run an appropriate clustering algorithm and justify the choice.
  8. build
    After this book you can build classification models (logistic regression, SVM, decision tree, random forest) to predict churn and customer choice.
    Check: Train several classifiers on a churn dataset, generate class predictions and probabilities, and compare them.
  9. apply
    After this book you can handle imbalanced data using undersampling, oversampling, SMOTE, or class weighting and assess their impact on model bias and performance.
    Check: Apply each balancing technique to an imbalanced dataset and compare recall/precision for the minority class before and after.
  10. tune
    After this book you can tune hyperparameters (e.g., tree max depth, SVM penalty and kernel) with grid search and cross-validation to optimize classifiers.
    Check: Run a grid search over a specified parameter grid, report the best parameters, and show the improved test metric.
03Advanced — analyze & judge
  1. evaluate
    After this book you can determine the number of clusters and evaluate clustering quality using visual inspection, the elbow/SSE method, and silhouette score, and describe the tradeoffs of each.
    Check: Compute SSE and silhouette scores across candidate k values, pick a k, and defend the choice against alternatives.
  2. interpret
    After this book you can interpret and profile customer segments, translating cluster characteristics into targeted marketing actions.
    Check: Given clustering output, write segment profiles (e.g., by mean attribute values) and recommend a distinct marketing strategy for each segment.
  3. diagnose
    After this book you can validate models on held-out test data and diagnose overfitting or underfitting using appropriate metrics such as MAE and RMSE for regression.
    Check: Split data into train/test, compute metrics on both, and explain whether a given model overfits and what to change.
04Mastery — synthesize & create
  1. choose
    After this book you can choose and compute classification metrics (accuracy, precision, recall, F1, confusion matrix) appropriate to the business problem, especially when classes are imbalanced.
    Check: Given a churn scenario with costs of errors, select the right metric, compute it, and justify why accuracy alone would be misleading.
  2. justify
    After this book you can compare tuned models, justify a final model choice, and communicate predicted customer value and churn drivers as actionable marketing recommendations.
    Check: Capstone case (e.g., bank churn): deliver a report comparing models on suitable metrics, identifying churn drivers, and recommending retention actions.

How to measure it

Turning each idea into a measure

For each construct: how to operationalize it, the observable signals to look for, and how well it holds up.

Data Quality and Structure

Assessed by the presence/absence of missing values, outliers, consistent data types, and a flat structured table after cleaning steps in pandas.

Observable signals
  • No null values remaining
  • Values aligned to correct attributes
  • Outliers removed (e.g., >3 SD above median)
  • Correct dtypes per column
Scale

Categorical/ordinal judgment (unstructured, semi-structured, structured) plus counts of missing values and outliers.

Holds up?

Face-valid given explicit cleaning steps; depends on domain knowledge of expected values. · Reproducible through scripted cleaning pipelines.

Feature Engineering Quality

Evaluated by how strongly created features relate to the outcome via correlations, visualizations, or measured impact on model performance.

Observable signals
  • Non-trivial correlations with target
  • Improved model accuracy when included
  • Features grounded in transactional/behavioral data
Scale

Continuous correlation values and metric improvements; not a single scale.

Holds up?

Validity tied to whether features generalize to future periods. · Depends on consistency of transformation logic across datasets.

Feature Selection

Determined by selection methods (lasso non-zero coefficients, tree-based importance, univariate/recursive selection) and the retained feature set.

Observable signals
  • Set of non-zero coefficient features
  • Ranked feature importances
  • Change in RMSE/accuracy on removal
Scale

Binary inclusion per feature plus importance/coefficient magnitudes.

Holds up?

Valid when selection improves or maintains test performance while simplifying the model. · Method-dependent; can vary with random state and data subset.

Data Standardization and Scaling

Observed through application of z-scoring, min-max scaling, or normalization producing zero mean/unit variance or bounded ranges.

Observable signals
  • Standardized columns with mean ~0, std ~1
  • Scaled values in [0,1]
  • Unit-norm samples
Scale

Transformation applied (yes/no) and resulting statistical properties.

Holds up?

Valid for distance-based and gradient-based algorithms. · Deterministic given fit parameters from training data.

Algorithm and Model Choice

Observed by which algorithm is applied (e.g., k-means, mean-shift, linear regression, random forest, SVM) relative to data linearity and dimensionality.

Observable signals
  • Algorithm identifier used
  • Fit between algorithm and data relationship type
  • Comparative metric outcomes across algorithms
Scale

Categorical choice among available algorithms.

Holds up?

Best judged by out-of-sample performance across candidate algorithms. · Choice is explicit; outcomes reproducible with fixed random states.

Hyperparameter Tuning

Observed through selected hyperparameter values via grid/randomized search and cross-validated scores.

Observable signals
  • Best_params from grid search
  • Cross-validation score changes
  • Elbow/silhouette-driven k choices
Scale

Discrete/continuous parameter values plus associated validation metrics.

Holds up?

Valid when tuning is evaluated on held-out data to avoid leakage. · Reproducible with fixed folds and random seeds.

Class Imbalance Handling

Observed by whether undersampling, oversampling, SMOTE, or class weighting was applied and resulting class balance.

Observable signals
  • Balanced class counts after resampling
  • Improved minority-class recall
  • class_weight parameter set
Scale

Categorical technique choice plus class distribution counts.

Holds up?

Valid when minority-class metrics improve without severe overfitting. · SMOTE/undersampling reproducible with fixed random state.

Model Fit and Generalization

Assessed by comparing training vs test performance and cross-validation stability.

Observable signals
  • Small gap between train and test scores
  • Consistent cross-validation folds
  • Reasonable predictions on unseen data
Scale

Indirectly measured via performance-metric comparisons across data splits.

Holds up?

Valid only when a proper held-out test set is used. · Depends on data split stability; small datasets are sensitive.

Predictive Performance

Quantified by task-appropriate metrics: silhouette for clustering, RMSE/MAE for regression, precision/recall/F1/AUC for classification.

Observable signals
  • Computed metric values on test set
  • ROC curve area
  • Confusion matrix outcomes
Scale

Continuous metric values on defined ranges (e.g., silhouette -1 to 1, AUC 0 to 1).

Holds up?

Valid when metric matches the problem and class balance. · Reproducible given fixed data splits and seeds.

Actionable Marketing Insight and Decisions

Assessed by interpretability of results, adoption by marketing teams, and downstream retention/ROI improvements.

Observable signals
  • Clear cluster characteristics
  • Coefficient-based interpretation
  • Identified churn features
  • Marketing team adoption/ROI
Scale

Mixed qualitative interpretability and quantitative business KPIs (ROI, retention).

Holds up?

Valid to the extent insights are correct and acted upon; correlation is not causation. · Business outcomes influenced by external factors beyond the model.

Self-assessment

Where would you like to improve?

This is a structured self-diagnostic built from the model — a mirror for reflection, not a validated psychometric scale. For validated measurement, see the instruments below.

1 = Strongly Disagree · 7 = Strongly Agree

Capabilitythe practices and skills you deploy
  • Before I build any model, I clean my marketing data into a tabular format and deal with missing values and outliers.
  • I mostly feed raw or transactional marketing data into models as it is, without creating new features that capture what drives the outcome.
  • I train my models only on features related to the outcome, using methods such as lasso regularization or tree-based importance to choose them.
  • I put variables on comparable scales, such as by z-scoring or min-max scaling, before running models that depend on distances or coefficient sizes.
  • I choose a learning algorithm by comparing it with alternatives against the characteristics of my data and the business question.
Alignmentthe outcomes you steer toward
  • I measure my models' accuracy with metrics suited to the task, such as RMSE, silhouette score, or F1.
  • The results of my analyses regularly lead to concrete marketing decisions, such as targeting specific customer segments or acting on churn drivers.
Motivationthe states you cultivate in others
  • I check that my models generalize beyond the training data by using cross-validation or held-out test data to catch overfitting.
0 of 8 answered

Proposed measures — starter instruments where no validated one was found

Marketing Data Readiness Index (Proposed)

proposed · not validated

Rated for your team or hiring process — not a personal self-check.

  1. Raw marketing data is stored in tabular form with each attribute holding only values of its intended type and meaning, as confirmed by documented schema checks.
  2. Missing, duplicate, and invalid values are identified through a documented, repeatable cleaning procedure before data is released for modeling.
  3. Each data source has an assigned data quality report showing completeness and error rates that are reviewed against defined thresholds before use.

Scale: 1–7 (Strongly Disagree → Strongly Agree), rated by an evaluator or the team. Average the items; treat ≤3 as a gap to close in the process.

Feature Engineering Rigor Index (Proposed)

proposed · not validated

Rated for your team or hiring process — not a personal self-check.

  1. Transactional and raw data are transformed into outcome-relevant features (e.g., recency, frequency, monetary value) that are documented with their business rationale.
  2. Each engineered feature is built using only information available at prediction time, and a leakage check is recorded in the project documentation.
  3. Feature construction code is version-controlled and reproducible, so the same inputs consistently produce the same feature values.

Scale: 1–7 (Strongly Disagree → Strongly Agree), rated by an evaluator or the team. Average the items; treat ≤3 as a gap to close in the process.

Feature Selection Discipline Index (Proposed)

proposed · not validated

Rated for your team or hiring process — not a personal self-check.

  1. A documented, systematic method (e.g., lasso regularization or tree-based importance) is applied to determine which features enter the final model.
  2. Features retained in the final model are shown to relate to the outcome through recorded evidence such as coefficients, importance scores, or validation performance.
  3. Selection is performed using training or cross-validation data only, and the list of removed features with reasons for exclusion is archived.

Scale: 1–7 (Strongly Disagree → Strongly Agree), rated by an evaluator or the team. Average the items; treat ≤3 as a gap to close in the process.

Sources

  • Data Science for Marketing Analytics — Tommy Blanchard · A hands-on, end-to-end guide to applying Python data science techniques—from cleaning raw data to clustering, regression, and classification—to solve real marketing problems like segmentation, customer value prediction, and churn.

The cheat sheet

Everything, on one page

One key takeaway from each section, with links to read more.

  • Data Quality and StructureTreat missing values and outliers as information about how the data was generated, and decide case by case whether to impute, flag, or drop them.
  • Feature Engineering QualityBuild features that encode behavior over time, such as recency, trend, and cadence, because raw totals hide the change that predicts outcomes.
  • Feature SelectionPerform feature selection inside cross-validation folds, or your performance estimate is optimistic by construction.
  • Data Standardization and ScalingScale features for clustering, SVM, KNN, and lasso, where magnitude changes the result, and not for tree-based models.
  • Algorithm and Model ChoiceAlways benchmark against a simple baseline, because the complex model must earn its added opacity.
  • Hyperparameter TuningTune with cross-validation and touch the test set once, or your final metric overstates real performance.
  • Class Imbalance HandlingResample only inside training data and keep the test set at the true class ratio.
  • Model Fit and GeneralizationJudge a model by the gap between training and held-out performance, not by training fit.
  • Predictive PerformanceSelect metrics by the business cost of each error type, then evaluate against a naive baseline.
  • Actionable Marketing Insight and DecisionsDefine the action each segment or score triggers before presenting results, or the analysis will not change spend.

Publication details

Consult the sources listed in this guide for further reading. Edition 1 · Updated 2026-10-03.

Explore related books and profiles in the library.

Take it with you

The main guide above is free to read. This purchase includes 36 additional tools and examples — 9 frameworks, 9 checklists, 9 case studies and 9 templates — plus the full sections and the ebook itself: an epub and a PDF covering all 10 sections. Every format, yours to keep — permanently, including every future update. When this guide is deepened, you get the new edition at no cost.

One payment. The main guide stays free to read.

Get one letter a month: the new guides worth your time, and where the books disagree.

One letter a month from Leading With Data, plus a short welcome. Your address is used for this letter only. Unsubscribe any time.