Lesson 1.2 · 7 min read · about 50 min to master at a very slow pace

Types of Machine Learning

Regression, classification, clustering and forecasting; supervised vs unsupervised learning; parametric vs non-parametric models. How to tell which kind of problem you are looking at.

Not startedJump to quiz

Four common tasks

The first question for any ML problem is: what kind of thing are we predicting?

TaskWhat is predictedExampleIn this course
RegressionA numberHouse price, CO concentrationSection 3
ClassificationA categorySpam or not; diabetic or notSections 4 and 6
ClusteringGroups, with no labels givenCustomer segmentsSection 6
Time-series forecastingFuture values in time orderElectricity demand next monthTime leakage, 2.8

A quick test: if the answer is a quantity you could average (price, temperature), it is regression. If it is a name from a fixed list (yes/no, cat/dog), it is classification.

Features and labels

Every row of a dataset is one observation. The columns you use as inputs are features (). The column you want to predict is the label or target (), the "answer" for that row.

PatientGene G1Gene G2Gene G3Cancer (label )
P11011
P20100

G1 to G3 are features; the cancer column is the label. The model's job is to learn how features relate to the label so it can predict the label for a new patient.

Supervised vs unsupervised learning

  • Supervised learning: every training example has inputs and a known output . We learn a mapping from to . Regression and classification are supervised (linear and logistic regression, SVMs).
  • Unsupervised learning: we only have , no labels. We look for structure: groups (clustering), or a compressed representation. K-means is unsupervised.

Rule of thumb

If the dataset has a column you want to predict, it's supervised. If you're asking "what natural groups are in here?", it's unsupervised.

Parametric vs non-parametric models

A parametric model has a fixed shape described by a finite list of numbers (parameters). Linear regression is a straight line (or plane) defined by its coefficients . A non-parametric model assumes much less about the shape and lets the data decide; K-nearest neighbours predicts by averaging the closest training points.

ParametricNon-parametric
ExamplesLinear and logistic regressionK-nearest neighbours, decision trees
Data neededModestLots
InterpretabilityHigh: read the coefficientsOften lower
Main riskWrong assumed shape (bias)Instability, overfitting (variance)

Generative vs discriminative (in brief)

Some approaches model how the data are generated, including the inputs themselves; others focus only on the boundary or relationship needed to predict from . Logistic regression and SVMs are discriminative: they go straight for the decision.

Stuck? Common doubts

Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.

Going deeperWhat exactly does "label" mean?

The label is the actual answer for a training row: the value of the target that the model is trying to predict. Features are the input information; the label is the known outcome. In the gene table above, G1, G2 and G3 are features and the cancer column (1 or 0) is the label.

This distinction matters for data leakage later: "validation labels influenced feature selection" means the answers of validation rows were used to make a decision, which is not allowed.

First passDoes non-parametric mean the model has no parameters?

No. It means there is no fixed, finite set of parameters that defines the model. Linear regression is parametric: whatever the amount of data, it is defined by its coefficients. K-nearest neighbours is non-parametric: it keeps every training point and predicts from the closest ones, so what it must store grows with the data. It still has settings, such as and the distance measure, but those are hyperparameters you choose.

Cheatsheet

Supervised vs unsupervised

Supervised: have and ; learn (regression, classification). Unsupervised: only ; find structure (clustering).

Parametric vs non-parametric

Parametric (linear/logistic regression): fixed shape, few parameters, less data, interpretable, risk of bias. Non-parametric (K-NN): flexible, needs more data, risk of variance.

Regression vs classification

Regression predicts a number. Classification predicts a category.

See every cheatsheet by category →

Check your understanding

Score 75% or more to master this lesson and earn XP. Answer first, then check.

Q1applyA streaming service has viewing histories for 2 million users and no labels. It wants to discover groups of users with similar tastes. What kind of task is this?
Q2applyA hospital predicts each patient's length of stay, in whole days, from their admission record. What kind of task is this?
Q3conceptA loan dataset has columns age, income, postcode and "defaulted (yes/no)". For a default-prediction model, which are the features and which is the label?
Q4applyYou have 200 observations and expect a roughly straight-line relationship between and . Why might linear regression beat K-nearest neighbours here?
Q5diagnoseA team codes product colour as red = 1, green = 2, blue = 3 and fits linear regression to predict colour. What's the main problem?