Week 1 — Lesson 2: Supervised vs unsupervised learning

3 min

The question you ask of a table decides the kind of learning, not the table itself. On the NorthPeak readings you can ask "Will this machine fail in the next seven days?" or "Which days look alike?" The first question needs a known answer in a column. The second does not. This lesson names the three tasks you will use for the rest of the course: regression, classification and clustering.

Labels and the two kinds of learning

A label is the answer we want the model to predict. It is stored in one column. When the data has a label, the learning is supervised. The model sees many examples with their answer. Then it predicts the answer for new rows.

When the data has no label, the learning is unsupervised. Nobody tells the model the right answer. The model looks for structure by itself. Most often it puts similar rows into groups.

Supervised learning has two main tasks. The task depends on the type of the label.

TaskThe label isNorthPeak example
RegressionA numberPredict power_kw from load_pct and the machine type
ClassificationA category, often yes or noPredict fault_next_7d (0 or 1) from the sensor columns

Unsupervised learning has one main task for us.

TaskThe label isNorthPeak example
ClusteringThere is no labelGroup the daily readings into operating modes: idle, normal, heavy

On the NorthPeak readings

Open data/clean/readings.csv. Each row is one machine on one day. The columns load_pct, ambient_c, temperature_c, vibration_mm_s, pressure_bar and power_kw are the sensor values.

The last column is fault_next_7d. It is 1 when the machine had a fault in the next seven days. It is 0 otherwise. This column is a label. The dataset has 14,600 rows. The label is 1 on 1,085 rows, so 7.4 % of the time. Predicting this column is a classification task. It is the main task of the course.

The column power_kw is a number. Predicting it from the load is a regression task. You will do it in Week 5.

Now forget the labels. Take the sensor columns only. Ask: "Which days look alike?" The model will find groups of similar days. That is clustering. You will do it in Week 7.

One fact helps you see why the label is learnable. On days followed by a fault, the mean temperature is 50.6 degrees. On other days it is 45.8. Vibration is 5.5 versus 4.1. The signal is there. It is weak. A model will find it.

A common mistake

The same table can be used for both kinds of learning. What changes is the question. "Will this machine fail?" needs a label, so it is supervised. "Which machines behave the same?" needs no label, so it is unsupervised. Beginners look at the data to decide. Look at the question instead.