☰ Machine Learning Tutorial Menu

The Machine Learning Workflow (CRISP-DM)

Written by CSA mentors · Updated 26 Sept 2026 · 5 min read


The first ML project I watched die had a perfectly good model. It died because nobody had agreed what "success" meant, the finance team never trusted the data, and the scores sat in a folder nobody opened. CRISP-DM (Cross-Industry Standard Process for Data Mining) is a 25-year-old checklist that still describes how good teams avoid that ending. We'll walk its six stages with one concrete churn project so you can run the same loop on your own work.

The six stages

Six CRISP-DM stages arranged in a loop with arrows back from evaluation to business understanding
StageQuestion it answersConcrete output
1. Business understandingWhich decision will change, and how will we measure the gain?One-page brief: decision, metric, baseline, constraints
2. Data understandingWhat data exists, how good is it, does it contain the target?Data dictionary, missing-value report, first plots
3. Data preparationHow do we make it model-ready and repeatable?Cleaning + feature script that runs end to end
4. ModellingWhich algorithm and settings work best?Baseline plus two or three candidates with CV scores
5. EvaluationDoes it beat the baseline on unseen data and does the business agree?Test-set metrics translated into rupees or hours
6. DeploymentHow does the prediction reach the person who acts on it?Scheduled scoring job or API, monitoring, retraining plan

Stage 1 is the one beginners skip

"Predict churn" is not a business goal, and in our batches it's the line students write most often. A brief that can actually be signed off looks like this:

  • Decision: each Monday the retention team calls 500 customers. Which 500?
  • Metric: customers retained per 500 calls (today: 40 using the agents' own picks).
  • Baseline: the current manual list, or a simple rule such as "longest since last purchase".
  • Constraints: scores must be ready by 8 a.m. Monday; no use of gender or religion features.

Now "good enough" has a number. The model must beat 40 retained per 500 calls, and everyone knows it on day one.

How each stage goes wrong

StageTypical failureCheap prevention
Business understanding"Build a churn model" with no owner for the callsName the person who will act on the output and ask what they need
Data understandingThe label column is filled in by a process that already uses the featuresTrace where every column comes from and when it is written
Data preparationManual fixes in Excel that cannot be repeated next monthEvery transformation is a script from day one
ModellingWeeks spent tuning a fancy model before a baseline existsBaseline first, ship it to a dashboard, then improve
EvaluationReporting accuracy on a random split of time-ordered dataSplit by time and by entity; report the business metric
DeploymentModel lives in one analyst's laptopScheduled job, versioned model file, a monitoring query

Where the weeks actually go

Bar showing roughly half of project time goes to data understanding and preparation, with modelling only a fifth

Plan for half the calendar to go on data. Joining the CRM to the billing system and the complaints log is slow, and every join turns up a surprise. Customer IDs that changed format in 2022. Timestamps in local time on one server and UTC on another. A "status" column that three departments fill in differently. None of it is glamorous, and all of it decides whether the model works.

Stage 5 in numbers

Say stage 5 of the churn project produced these results on a held-out month of 10,000 customers, of whom 800 actually churned.

ApproachChurners in top 500Precision of the listRetained (assume 25% of contacted churners stay)
Random 500500 x 8% = 408%10
Rule: longest since purchase16032%40
Logistic regression23046%57.5
Gradient boosting26553%66.25

Put it in rupees. If an average retained customer is worth PKR 6,000 a year, gradient boosting retains about 26 more customers per week than the rule (66.25 - 40 = 26.25), roughly PKR 157,000 per week. That is the sentence a manager needs, not "F1 improved from 0.41 to 0.52". Evaluation is where metrics turn into a decision, and where you choose between going back to stage 2 for better features or moving on to deployment.

A skeleton you can reuse

# run locally: the shape of a CRISP-DM project in one script
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import precision_score

df = pd.read_csv("customers.csv")                 # 2. data understanding
df = df.dropna(subset=["tenure_months"])           # 3. preparation (simplified)
X = df[["tenure_months", "orders_90d", "complaints"]]
y = df["churned"]
X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=0.2, random_state=42)

model = LogisticRegression(max_iter=1000).fit(X_tr, y_tr)   # 4. modelling
scores = model.predict_proba(X_te)[:, 1]
top500 = scores.argsort()[::-1][:500]                        # 5. evaluation
print("precision of top 500:", y_te.iloc[top500].mean())

What stage 1 uncovered at a Karachi bank: The fraud team asked for "a model". In stage 1 the analyst found the real bottleneck. Investigators could review 300 alerts a day and the existing rules produced 1,100. So the goal was rewritten from "detect fraud" to "rank alerts so the 300 we review contain the most fraud". Stage 2 then showed that the "confirmed fraud" label lagged by 45 days, so training data had to stop 45 days before the cut-off. Those two findings shaped everything that followed, and neither one involved an algorithm.

Before you move on

CRISP-DM is a loop, not a line: business, data, preparation, modelling, evaluation, deployment, then round again. Write down the decision, the metric, the baseline and the constraints before you open a single table. Budget half the effort for data work. Always compare against a simple baseline on unseen data, and translate the result into business units so a non-technical owner can decide. If your SQL is shaky, the data-understanding stage is where it shows, and our SQL track is the fastest fix.

Three things to try

  1. Write a stage-1 brief (decision, metric, baseline, constraints) for a Rawalpindi private school that wants to predict which students need extra tutoring before board exams.
  2. Using the evaluation table, compute the rupee gain per week of logistic regression over the rule, with the same assumptions.
  3. List three data-understanding checks you would run on a billing table before modelling (for example, "are there negative amounts?").

Lesson 3 of 18

Sign in to track your progress and earn learning points for every lesson you finish.