Skip to the workspace
Pebellslearn by building
Types of Machine Learning  ›  Lesson

Supervised Learning

Supervised Learning 14 minSupervised learning trains on examples that come with the correct answer, and the type of answer decides the task: a number means regression, a category means classification.

machine learning / Supervised Learning

Explore each scene at your own pace.

01 · The rule

The rule

Supervised Learning

Most ML in industry today is supervised: a spam filter trained on emails people marked as spam, a rent model trained on rents actually paid. The "supervisor" is the answer key that comes with every training example. Knowing this lets you name the task in one glance at the data.

The rule

Labelled examples in; numbers out means regression, categories out means classification.

Supervised learning needs every training example to carry its correct answer, the label. What kind of label it is decides the task:

  • Regression: the label is a number on a scale. Predicting monthly rent (14, 22, 26...) is regression. Errors are measured by how far off the number is, for example mean squared error.
  • Classification: the label is a category. "Rented within a week: yes or no" is binary classification; "studio, 1BHK or 2BHK" is multi-class. Classifiers often output a probability for each class, and errors are measured by how often, and how confidently, they pick the wrong class.

The same flats can support both. With a rent column you can do regression; add a "rented fast" column and you can do classification.

Common supervised methods you will meet later include linear regression, logistic regression (despite the name, a classifier), decision trees and k-nearest neighbours (k-NN). k-NN is the simplest to picture: to predict for a new flat, find the kk most similar training flats and average their rents (or take a vote for a category).

A new flat is 65 m². Using size alone, the two nearest flats are B (60 m²) and E (70 m²), both 5 away. Their rents are 22 and 22, so k-NN with k=2k = 2 predicts 22.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.