A telecom company wants to predict which customers will churn — so they can intervene before losing revenue. You'll handle real-world tabular data, clean it, train three classifiers, compare them, tune the decision threshold against business value, and wrap the result as a callable production function. All of this runs in your browser using real scikit-learn. No notebooks, no setup, just the work.
Begin the capstoneYou're a data scientist at NorthWind Telecom. The retention team comes to you with a clear problem: every month, roughly 27% of new customers cancel within their first year. Acquiring a new customer costs ~$500 in marketing. Retaining one is almost free — if you can identify them in time.
They give you a snapshot of 1,000 historical customers and ask you to build a system that flags who's likely to churn next month — so retention specialists can call those customers first.
That's the whole brief. The rest is up to you. Below: five stages, each with real Python code running scikit-learn in your browser. By the end you'll have a callable predict_churn() function — the final deliverable.
Run them one at a time, or click "Run all stages" to watch the entire pipeline execute top to bottom. Each stage builds on the previous one — variables persist across stages, so you can\u2019t skip ahead. The code is editable: tweak things if you\u2019re curious.
Generate the customer dataset and inspect it. Real-world projects start here: load the data, look at its shape, check the target distribution, eyeball a few features. You can\u2019t model what you haven\u2019t looked at.
Turn the raw dataframe into something a model can ingest. One-hot encode the categorical columns, stratified split into train/test to preserve class balance, then standardize numerical features so the linear model converges quickly.
Don\u2019t fall in love with the first model that works. Try multiple algorithms on the same data and let the metrics decide. Here: a linear baseline (Logistic Regression), a bagged tree ensemble (Random Forest), and a boosted tree ensemble (Gradient Boosting). Bonus: extract feature importance so we know what the model learned.
A model isn\u2019t done when training finishes. Pick the right metric for the business problem. Here, missing a churn (FN) costs us $500 in lost revenue. A false alarm (FP) costs us $30 in unnecessary retention effort. We tune the classification threshold to maximize expected dollars saved — not accuracy.
A trained model in a notebook helps nobody. Wrap it as a callable function that takes a customer record and returns a decision. This is the exact shape a FastAPI endpoint would take (Module 11). Test it on three customer profiles spanning low/medium/high risk.
predict_churn() function is the actual deliverable. Drop it into a FastAPI app (Module 11), deploy to Railway or Hugging Face Spaces, expose /predict as an HTTP endpoint, and you\u2019re live. Every modern ML system on the planet — from Netflix recommendations to fraud detection at your bank — follows this exact 5-stage shape.
Every skill you learned across Course 2 appears somewhere in the capstone. Not as concepts — as code that just ran in your browser.
Type your name, download the certificate. It\u2019s yours — generated client-side, no signup required.
From model.predict() in a notebook to a live, business-tuned, deployable function. You can do this. You just did.