Capstone progress
0%
What you'll build
- A full ML solution to a real business question
- Clean, reproducible pipeline (not a notebook mess)
- A FastAPI endpoint serving predictions
- A non-technical presentation of results
What this demonstrates
- End-to-end ML project ownership
- Business problem → ML framing ability
- Production-minded coding habits
- Communication to non-technical stakeholders
10.1
Problem Framing — Translating a Business Question into an ML Task
The most important skill that courses skip. "We want to reduce churn" → what is the prediction task? What's the label? What's the positive class? What's the cost of a false positive vs false negative? What data do we have, and when? Worked examples: fraud detection, churn prediction, demand forecasting. A framing template you can reuse on any project.
The framing template
- Task type: classification / regression / ranking / clustering?
- Label definition: what exactly are we predicting? (churn in 30 days? next purchase?)
- Positive class: which outcome is "positive"? Does that align with business priority?
- Cost asymmetry: FP cost vs FN cost → determines threshold, metric, and class weighting
- Data availability: what do we have at prediction time? (no future leakage allowed)
- Prediction horizon: predict for next week? next quarter? Is the label observable then?
- Baseline: what does the business do today without ML? (naive rule = your floor)
- Success metric: what business KPI does a better model actually move?
10.2
Full Pipeline: EDA → Feature Engineering → Modeling → Evaluation
Structured approach to each stage. EDA checklist (distributions, missing values, correlations, outliers). Feature engineering from domain knowledge. Model selection with cross-validation — no peeking at test set. Evaluation with the right metric for the business problem. Comparing at least 3 algorithms and justifying your final choice.
Pipeline checklist
- EDA: shape, dtypes, missing %, distribution plots, target balance, top correlations
- Hold out test set first — lock it in a box, never look at it until final evaluation
- Feature engineering: apply domain knowledge + techniques from Module 06
- Preprocessing pipeline: ColumnTransformer with StandardScaler + encoders wrapped in Pipeline
- Model comparison: Logistic Regression, Random Forest, XGBoost — CV on training set only
- Hyperparameter tuning on the winner (Module 07 techniques)
- Final evaluation: run once on test set, report metric with confidence interval
- Code structure: functions, not notebook cells — reproducible from top-to-bottom run
10.3
Model Deployment Basics — A FastAPI Prediction Endpoint
Load a saved joblib Pipeline. Build a POST /predict endpoint that accepts JSON, runs the pipeline, returns a prediction with probability. Input validation with Pydantic. A simple health check endpoint. Testing with curl and the FastAPI docs page. This is the minimum viable deployment that demonstrates "I can ship this."
Key concepts & code patterns
- Save pipeline: joblib.dump(pipeline, 'model.joblib') — includes all preprocessing steps
- Load at startup: model = joblib.load('model.joblib') at module level (not per-request)
- Pydantic schema: class PredictRequest(BaseModel): age: float; income: float; ...
- Endpoint: @app.post("/predict") → run pd.DataFrame([request.dict()]) through model
- Return: {"prediction": int(pred), "probability": float(proba[0][1])}
- Health check: @app.get("/health") → {"status": "ok", "model_loaded": True}
- Test: curl -X POST http://localhost:8000/predict -H "Content-Type: application/json" -d '{...}'
- Interactive docs: http://localhost:8000/docs — FastAPI generates these automatically
10.4
Presenting Results to a Non-Technical Audience
The difference between an ML evaluation report and a business recommendation. Translating RMSE into business impact ("this means our forecasts are off by ±$12k per week on average"). Visualizations that work for executives (not ROC curves). Confidence and uncertainty — how to say "I'm not sure" honestly without losing credibility. Template for a 5-slide results deck.
The 5-slide results deck template
- Slide 1 — Problem: "We currently lose $X to churn. Can we predict who's at risk?"
- Slide 2 — Approach: one sentence on the method, one sentence on the data, no jargon
- Slide 3 — Results: business metric, not ML metric. "We can identify 70% of churners before they leave, with 1 in 4 alerts being a false alarm."
- Slide 4 — Recommended action: what should the business do with these predictions?
- Slide 5 — Limitations & next steps: where the model fails, what would make it better
- Exec-friendly visuals: bar charts, ranked lists, confusion matrix as 2×2 business table
- Translate every metric: "AUC 0.87" → "Our model ranks a real churner above a non-churner 87% of the time"
- State uncertainty honestly: "predictions are most reliable for customers with 6+ months of history"
// Tier 2 Complete
You can now build, evaluate, and deploy classical ML models across the problem types that run most of real-world production ML. You're ready for Tier 3 — Deep Learning & Neural Networks — where everything gets rebuilt from first principles using PyTorch.