MoonSay /Tutorials/Machine Learning Interview #1
Contents
  1. 01Introduction
  2. 02The learning signal
  3. 03Supervised learning
  4. 04Clustering
  5. 05Dimensionality reduction
  6. 06Semi-supervised learning
  7. 07Label propagation
  8. 08Self-training, consistency and FixMatch
  9. 09Self-supervised learning
  10. 10Putting it all together
  11. 11Interview questions and model answers
  12. 12Summary
  13. References

02The learning signal: one question, four answers

2.1Four data situations

Figure 1 shows the four situations side by side. In every panel the inputs are the same kind of object; what differs is how much we know about the answer for each one, and therefore what the training loss can compare the model’s output with.

The four data situations. (a) Supervised: every input has a label (colour). (b) Unsupervised: inputs only. (c) Semi-supervised: a few labels (ringed) and many unlabeled inputs. (d) Self-supervised: no human labels; the target is cut out of the input itself, here a hidden word. Schematic illustration drawn for this tutorial; the points are a subsample of the data of Figure 2.
Figure 1. The four data situations. (a) Supervised: every input has a label (colour). (b) Unsupervised: inputs only. (c) Semi-supervised: a few labels (ringed) and many unlabeled inputs. (d) Self-supervised: no human labels; the target is cut out of the input itself, here a hidden word. Schematic illustration drawn for this tutorial; the points are a subsample of the data of Figure 2.

2.2Every paradigm minimizes an empirical risk

Here is the unifying idea of the whole tutorial. Almost every learning method chooses parameters \theta by minimizing an average loss over the training data, a principle called empirical risk minimization (Vapnik, 1991). The four paradigms differ only in what that loss compares the model with, that is, in where the target comes from (Table 1).

ParadigmTypical training objectiveWhere the target comes from
Supervised\displaystyle \frac1n\sum_{i=1}^{n} L\big(f_\theta(x_i),\,y_i\big)a person labeled every x_i
Unsupervised\displaystyle \frac1m\sum_{j=1}^{m} \big\|x_j-g_\theta(x_j)\big\|^2 or -\frac1m\sum_{j}\log p_\theta(x_j)the input itself: summarize it, then reconstruct it, or model its density
Semi-supervised\displaystyle \frac1n\sum_{i=1}^{n} L\big(f_\theta(x_i),y_i\big)+\lambda\,\frac1m\sum_{j=1}^{m} R\big(f_\theta;x_j\big)a few labels, plus a penalty R that encodes the shape of the unlabeled data
Self-supervised\displaystyle \frac1m\sum_{j=1}^{m} L\big(f_\theta(\mathrm{visible}(x_j)),\ \mathrm{hidden}(x_j)\big)a part of the input that we hid on purpose
Table 1. One recipe, four kinds of target. g_\theta is a model that compresses and reconstructs its input (K-means and PCA are both of this kind, Sections 4 and 5); R is an unsupervised penalty such as consistency or graph smoothness (Section 6).

Two consequences are worth stating now. First, self-supervised learning is trained exactly like supervised learning: it has inputs, targets and a supervised loss such as cross-entropy. It is called unsupervised only because no person produced the targets. Second, unsupervised learning also has a target, but a weaker one: reproduce or explain the input. The structure it finds, such as clusters or principal directions, is whatever lets it do that well.

2.3A probabilistic view

The same distinction can be phrased with probability distributions. Think of the data as drawn from a joint distribution p(x,y)=p(x)\,p(y\mid x). A supervised classifier estimates the conditional distribution p(y\mid x), which is what we need to predict labels. Unsupervised learning only sees samples of x, so it can only learn about the marginal distribution p(x): where the inputs lie, how they spread, where they cluster. Semi-supervised learning uses many samples of x to help estimate p(y\mid x), which can only work if p(x) carries information about p(y\mid x); Section 6 makes this precise. Self-supervised learning splits each input into two parts, x=(x_{\mathrm{vis}},x_{\mathrm{hid}}), and estimates the conditional distribution p(x_{\mathrm{hid}}\mid x_{\mathrm{vis}}) of one part of the data given another.

2.4Why the distinction matters: labels are the expensive part

Inputs are cheap and abundant: sensors, cameras, web pages and transaction logs produce them automatically. Labels need human time and often expert knowledge. ImageNet makes the cost concrete. Its images were checked on Amazon Mechanical Turk, where several workers voted on every image and fine-grained categories such as “Burmese cat” needed more votes than “cat” (Deng et al., 2009); by 2014 it held 14.2 million labeled images in 21,841 categories (Russakovsky et al., 2015). Expert labels are slower still: transcribing speech word by word takes about ten times the length of the audio, and phoneme by phoneme about 400 times (Settles, 2009).

This cost is the economic reason the other three paradigms exist. If labels were free, everyone would simply collect more of them. Unsupervised learning extracts what it can from inputs alone; semi-supervised learning stretches a small labeling budget by exploiting the unlabeled data; and self-supervised learning learns general-purpose representations from unlabeled data, so that a later supervised task needs far fewer labels.