Skip to main content
PProfileMatch

Supervised Learning Tutorial

Regression, classification, cross-validation and the mistakes that fake good results

Intermediate4 lessonsabout 23 min of reading

This course picks up where the basics stop. It is for people who already know what a training set and a test set are (if not, start with Machine Learning Fundamentals) and want to understand how supervised models really learn, how to choose between them fairly, and how results get faked by accident. You need Python and a little comfort with averages and slopes; no calculus beyond "the gradient points uphill" is assumed.

You will build linear regression with gradient descent and watch the loss fall, train a logistic regression and a small decision tree from scratch, use k-fold cross-validation to choose a model's complexity, and then confront the traps that make a model look better than it is: class imbalance, the wrong metric, and data leakage. Each trap is reproduced in code so you can see the symptom instead of taking it on trust.

The four lessons move from the mechanics of learning (regression, classification) to the discipline of judging (selection, then failure modes). Everything runs in plain Python with no dependencies, and every output shown was produced by running the code. Libraries like scikit-learn wrap the same ideas, so what you learn here transfers directly.

Supervised Learning lessons

  1. 1Linear Regression and Gradient Descent From Scratch in PythonLearn how supervised regression works: fit a line with gradient descent in pure Python, compare it with least squares and see what a bad learning rate does.6 min read
  2. 2Classification: Logistic Regression and Decision Trees ExplainedUnderstand supervised classification by building logistic regression and a decision tree from scratch in Python, and learn how they differ and when to use each.6 min read
  3. 3Model Selection and Cross-Validation: Pick the Right Model FairlyLearn k-fold cross-validation and model selection in Python: compare polynomial models, read the train versus CV gap and choose complexity without cheating.5 min read
  4. 4Class Imbalance, Metric Choice and Data Leakage: Why Results Look Too GoodSee how class imbalance, the wrong metric and data leakage fake good supervised learning results, with runnable Python demonstrations and practical fixes.6 min read

Preparing for an interview? Practise Machine Learning interview questions

Learning Supervised Learning to land a job? Browse open roles or check which skills are trending.