Projectabout 4 hours
Project: a model for a table, end to end
After this project you can go from a CSV to a saved, evaluated model with a baseline to beat.
Project
Will this client miss next month's payment?
You build a model for 30,000 credit card clients that says which of them will miss next month's payment, from the CSV to a model that beats two baselines on five folds, a line set by what each mistake costs, a test pile opened once, and the model saved with its card. Then the same build runs on a table of your own.
You build it in the starter, one step at a time. The finished project is there to read when you are stuck.
git clone https://github.com/FaydenAI/learn-machine-learning.git
cd learn-machine-learning/project/starter
uv syncGet the starterRead the finished project
Part 1
The clients, a closed test pile, and two baselines
A bank in Taiwan wants to call the clients who are about to miss a payment, before they miss it. You have 30,000 of its clients from 2005: each one's credit limit, age and education, and six months of bills, payments and late payments. This part gets the table, splits it once, and scores the two answers every model has to beat.
UsesWhat machine learning isTraining, validation and test dataPrecision, recall and the confusion matrixTime series and forecasting
- Get the clients, and run the testsRun it
- Split once, before anything elseYour turn
- The inputs and the labelYour turn
- A rule by hand, as a modelYour turn
- The two baselinesRun it
When you have run it
The two baselines are right equally often. What share of the clients who missed October's payment does the rule by hand find?
Part 2
A pipeline, a race on folds, and the line
Now the models. Three of the course's models race on the same five folds of the training pile, each behind the same preparation, with the two baselines beside them. The race picks one, and the line comes from what each mistake costs. `train.py` saves the pick with its line, for part 3.
UsesPreparing featuresLogistic regressionOverfitting and regularizationRandom forestsGradient boostingCross-validation and tuningThresholds, ROC and PR curvesData leakage
- One preparation for every modelYour turn
- The raceYour turn
- A tie is not a winYour turn
- The cheapest lineYour turn
- Train itRun it
When you have run it
What is your cheapest line?
Part 3
The test pile, opened once, and the model's card
The choice is made. `evaluate.py` loads the saved model, as next month's job would, opens the test pile once and writes the model's card: how good it is against the baselines, how it does for each group, what it leans on, and why it picked one client.
UsesPrecision, recall and the confusion matrixThresholds, ROC and PR curvesBias and fairnessFeature importance and SHAPTraining, validation and test data
- A score on rows it never sawYour turn
- Each group on its ownYour turn
- What it leans onYour turn
- Why this clientYour turn
- Open the test pileRun it
When you have run it
On the test pile, what does the model's line cost a client?
Part 4
A table of your own
This part is yours. Find a table with a column that says yes or no, look at it before anything learns from it, describe it in `config.py`, and run the whole build on it. Only `look.py` has a frame to fill in. `solution/` does it once, on 1,000 credits of a bank in southern Germany from the 1970s.
UsesCleaning a tableWhat machine learning isData leakageThresholds, ROC and PR curvesCross-validation and tuning
- Look before you trainOn your own
- Your tableOn your own
- Your rule and your costsOn your own
- The build on your tableRun it
When you have run it
solution/runs the same build on the 1,000 South German credits, and its card issolution/reports/mine-card.md. Which model does its race pick?
Run on Python 3.12, scikit-learn 1.9.1, pandas 3.1.2, fairlearn 0.15.0, shap 0.54.1. Checked on .
