Course 5 of 9

Machine Learning

After this course you can train, evaluate and choose a model for a table of data.

23 lessons, 8 labs and a project. About 2 h 35 min of video.

Start with lesson 1
  1. What machine learning isMachine learning is a computer finding the rule in examples, instead of a person writing it; what the examples' label is decides the kind of job.7 min
  2. Training, validation and test dataA model is judged only on data it never learned from, so keep a test set aside, choose with a validation set, and open the test set once.6 min
  3. Linear regressionLinear regression sets one weight for each input so the squared misses are as small as they can be, and you judge it on new data by its misses, next to always guessing the average.7 min
  4. Lab 1A first model, judged on new penguinsYou will write the rule by hand in pandas and let a tree find its own, watch a score on the training rows fool you, deal three piles, then fit a line for the mass and judge it next to the average.40 min
  5. Logistic regressionLogistic regression puts a line's score through an S-curve, so every penguin gets a chance between 0 and 1, and it says yes where that chance passes one half.8 min
  6. Overfitting and regularizationA model that bends too much learns its own examples and misses new ones, a model too simple misses both, and a penalty on big weights keeps it smooth, with its strength chosen on the validation set.7 min
  7. Cross-validation and tuningOne validation set's score is partly luck, so give every row a turn in it, average the turns, and choose a setting by that average while the test set stays closed.6 min
  8. Lab 2Tune a penguin model on foldsYou will give each penguin its chance of being a Chinstrap and find the bill where it crosses one half, bend a curve of degree 9 through twenty penguins and tame it with a penalty, choose the penalty's strength on five folds, and open the test set once.45 min
  9. Precision, recall and the confusion matrixWhen one answer is rare, a model can be right almost every time and still miss most of what you want, so count its four kinds of answer and ask two questions: how many of its picks are right, and how many of the real yeses it finds.7 min
  10. Thresholds, ROC and PR curvesA model gives every case a chance, and you choose the line above which it says yes: lower it and it finds more yeses with more wasted picks, so set it from your budget or your costs, and judge the model by its curves.7 min
  11. Preparing featuresA model reads only numbers, so each column is prepared in its own way (words become columns of 0 and 1, numbers go on one ruler, codes for a gap are filled and flagged) inside one pipeline that learns from the training rows only.8 min
  12. Data leakageData leakage is something the model won't have when it really predicts getting into its training or its test, so the score is better than the model will ever be; ask of every column, every step and every row it learns from whether the model would have it then.7 min
  13. Lab 3A call list the bank can trustYou will put the bank's columns through one pipeline and score it on folds, catch the call's length as a leak, read the four counts on calls kept aside, and choose the line for a budget and for the costs.40 min
  14. k-nearest neighborsA new penguin gets the kind most of its nearest examples have, and "nearest" only means something when every measurement is on one ruler.7 min
  15. Decision treesA tree asks one question at a time, and it picks each question by trying every cut and keeping the one whose two piles are least mixed.7 min
  16. Random forestsTrees grown on different draws of the rows, each asking from a random few columns, make their mistakes in different places, so their vote makes fewer mistakes than one tree does.6 min
  17. Lab 4Neighbors, a tree and a forestYou will put the penguins on one ruler for their nearest neighbors, choose a tree's depth and read it, score a forest beside one tree on the same folds, open the test set once for the winner, then race a tree and a forest on the bank's calls.40 min
  18. Gradient boostingStart from the average; each new small tree learns what the guesses still miss and adds a share of its answer, until new rows stop getting better.7 min
  19. Tabular foundation modelsA model trained in advance on millions of made-up tables reads your rows and answers at once, with no training: on small tables it often beats boosted trees.7 min
  20. Lab 5Boosted trees or a pretrained model?You will watch boosted trees stop early on the bank's calls, then race TabICL against boosted trees tuned on folds at 1,000, 5,000 and 10,000 calls, with the seconds each takes, and catch a pretrained model leaking.45 min
  21. Clustering with k-meansWith no labels, k-means finds groups by moving each centre to the middle of its nearest things, and you choose how many.7 min
  22. PCABecause measurements move together, a few directions hold most of how things differ: PCA keeps those directions and drops the rest.8 min
  23. Lab 6The penguins' kinds, with the names hiddenYou will find three groups in the penguins' four measurements with the kinds hidden, read the total for every k, flatten the penguins to two numbers with PCA and draw the groups there, then score how close the groups come to the kinds and draw the digits on a flat map of their own.40 min
  24. Time series and forecastingTest a forecast the way you will use it, week after week on hours it has not seen, and keep it only if it beats copying last week.7 min
  25. Feature importance and SHAPShuffle a column to see how much a model depends on it, and use SHAP to see how each fact pushed one customer's chance; both say what the model uses, not what causes.7 min
  26. Lab 7Next week's bikes, and what the forecast leans onYou will forecast the bikes a week ahead, test every forecast by walking forward against a copy of last week, see hours dealt at random flatter a model, then shuffle each input to find what the forecast leans on, and how two inputs share the credit.45 min
  27. Bias and fairnessA model can be right as often for two groups and still treat them differently, so count every kind of mistake for each group, and choose which one to make equal.7 min
  28. DriftA saved model meets a world that keeps moving, so watch each input against its own past every month, watch the score when the answers come, and learn again from recent data.7 min
  29. Lab 8A check-up for a model in useYou will count a model's mistakes for each age group and see one score hide a gap, give one group its own line and see what it costs, then follow the bank's model month by month, catch its inputs moving past their lines, learn it again, and score it for each age group.45 min
  30. Cleaning a tableBefore any model, look at the table: fix what is broken, keep what is rare but true, and check that the label means what you want to predict.8 min
  31. ReviewQuestions from the whole course10 questions from 10 lessons, in a mixed order. See what you still remember.
  32. EndingWhat can you build with machine learning?The course's project: build a machine learning model that tells a bank who will miss next month's payment, and beat a rule written by hand.1 min
  33. ProjectWill 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.4 h