TExcelTAD
Home › Data Science › DS Workflow (CRISP-DM)

DS Workflow (CRISP-DM)

So far you've learned individual tools. Real projects need a process that strings them together, so that you don't build a perfect model for the wrong question or skip the step that would have revealed a data problem. The most widely used process is CRISP-DM — the Cross-Industry Standard Process for Data Mining, published in 1999 and still the backbone of most data science projects.

The six phases

Phase Key question Riverside Bikes example
1. Business understanding What decision will the result support? How will we measure success? "Put the right number of bikes on the street; fewer than 5 % of days with empty stations."
2. Data understanding What data exists? Is it good enough? Daily rental logs, weather station feed, holiday calendar. Explore, find gaps.
3. Data preparation How must the data be cleaned and shaped? Fix types, fill rain gaps with 0, add a weekend flag, drop the duplicate export.
4. Modeling Which technique answers the question? Linear regression of rides on temperature, rain and weekend.
5. Evaluation Does the model meet the business goal? Test on held-out days: are forecasts within ±60 rides?
6. Deployment How is the result used day to day? A morning script reads the weather forecast and emails the expected rides.

The phases form a cycle, not a straight line. Data understanding often sends you back to rephrase the business question; evaluation often sends you back to preparation. Arrows go both ways.

text
     ┌──────────────► Business understanding ◄──────────────┐
     │                      ▲    │                           │
     │                      │    ▼                           │
 Deployment            Data understanding                    │
     ▲                      ▲    │                           │
     │                      │    ▼                           │
 Evaluation ◄──── Modeling ◄──► Data preparation ────────────┘

Phase 1 in practice: make the question precise

A vague question ("can data help our bikes?") can't be answered. A good question names a target, a decision, and a success measure. Writing this down as data makes it testable later:

python · try it yourself
project = {
    "question": "How many rides will tomorrow have?",
    "target": "rides (count per day)",
    "decision": "how many bikes to distribute each morning",
    "success": "forecast error within +-60 rides on at least 90% of days",
    "inputs": ["temperature forecast", "rain forecast", "day of week"],
}
for key, value in project.items():
    print(f"{key:>9}: {value}")
 question: How many rides will tomorrow have?
   target: rides (count per day)
 decision: how many bikes to distribute each morning
  success: forecast error within +-60 rides on at least 90% of days
   inputs: ['temperature forecast', 'rain forecast', 'day of week']

Phases 2–5 in miniature

The whole cycle can be sketched in a few lines. Each comment marks a phase; later lessons expand each one.

python · try it yourself
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf

# 2. Data understanding: load and inspect
rng = np.random.default_rng(42)
dates = pd.date_range("2024-04-01", periods=60)
temp = rng.uniform(4, 30, 60).round(1)
rain = np.where(rng.random(60) < 0.3, rng.uniform(1, 15, 60), 0).round(1)
humidity = rng.integers(35, 95, 60)
weekend = (dates.dayofweek >= 5).astype(int)
rides = (150 + 12 * temp - 8 * rain + 60 * weekend + rng.normal(0, 30, 60)).round().astype(int)
bikes = pd.DataFrame({"date": dates, "temp_c": temp, "rain_mm": rain,
                      "humidity": humidity, "weekend": weekend, "rides": rides})
print("rows:", len(bikes), "| missing values:", int(bikes.isna().sum().sum()))

# 3. Preparation: split by time - fit on the first 45 days, keep 15 for evaluation
train, test = bikes.iloc[:45], bikes.iloc[45:]

# 4. Modeling
model = smf.ols("rides ~ temp_c + rain_mm + weekend", data=train).fit()
print("coefficients:", model.params.round(1).to_dict())

# 5. Evaluation against the success measure from phase 1
errors = test["rides"] - model.predict(test)
within = (errors.abs() <= 60).mean()
print(f"test days within +-60 rides: {within:.0%}")
print("goal met!" if within >= 0.9 else "goal not met - back to an earlier phase")
rows: 60 | missing values: 0
coefficients: {'Intercept': 147.1, 'temp_c': 11.8, 'rain_mm': -8.3, 'weekend': 71.0}
test days within +-60 rides: 100%
goal met!

The success measure decides whether we're done — not R², and not how clever the model is.

Phase 6: deployment

Deployment can be as small as a function that someone runs every morning:

python · try it yourself
def morning_forecast(temp_c, rain_mm, is_weekend):
    # coefficients copied from the evaluated model
    expected = 157 + 11.5 * temp_c - 9.1 * rain_mm + 64 * is_weekend
    plan = expected + 60                  # buffer from the success measure
    return round(expected), round(plan)

expected, plan = morning_forecast(temp_c=19, rain_mm=2, is_weekend=False)
print(f"Expected rides: {expected}. Distribute bikes for: {plan}.")
Expected rides: 357. Distribute bikes for: 417.

Deployed models also need monitoring: in summer, temperatures climb above anything in our spring data, and the model may drift. Plan when to re-check and retrain it — which starts the cycle again.

Other process models

Model Emphasis
OSEMN (Obtain, Scrub, Explore, Model, iNterpret) A compact, data-focused version of the same idea
TDSP (Microsoft Team Data Science Process) Adds roles, repositories and project templates
"Ask–Get–Explore–Model–Communicate" Common in teaching, close to this course's structure

They differ in vocabulary, not in spirit: understand the question, understand the data, prepare, model, evaluate against the real goal, and put it to use.

Test yourself

Which CRISP-DM phase defines how success will be measured?

  1. Data preparation
  2. Business understanding
  3. Modeling
  4. Deployment

Evaluation shows the model misses the success target. What does CRISP-DM suggest?

  1. Deploy it anyway
  2. Go back to an earlier phase (e.g. preparation or business understanding)
  3. Delete the data
  4. Raise the target

Why does a deployed model need monitoring?

  1. Python code expires
  2. Conditions can drift outside the data the model was built on
  3. Monitoring makes R² higher
  4. It doesn't