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

06Semi-supervised learning: why unlabeled data can help

6.1The setting

In semi-supervised learning we have a small labeled set \D_L=\{(x_i,y_i)\}_{i=1}^{n} and a much larger unlabeled set \D_U=\{x_j\}_{j=1}^{m}, with m\gg n. The goal is a better classifier than the labeled data alone would give. Two variants are distinguished (van Engelen and Hoos, 2020): inductive methods produce a model that can label new inputs, like ordinary supervised learning; transductive methods only label the given unlabeled points.

6.2Intuition: a few graded problems

Suppose you know the political leaning of only two people in a social network. If people mostly befriend like-minded people, you can guess everyone else’s by following chains of friendship outward from those two; the unlabeled people are useful because they tell you who is connected to whom. Likewise in the two moons of Figure 5: with one label per moon, a purely supervised rule draws a straight boundary that cuts both moons, but once you see the unlabeled points, the shape of the moons makes the answer obvious.

6.3When can unlabeled data help?

Unlabeled points tell us only about p(x), so they can help only if p(x) carries information about p(y\mid x) (van Engelen and Hoos, 2020); if the label were the parity of a random customer ID, no amount of unlabeled data would help. The standard assumptions name the links that methods exploit (Chapelle et al., 2006; van Engelen and Hoos, 2020):

  • Smoothness: if two inputs are close, their labels are probably the same. Applied transitively through chains of unlabeled points, this lets labels travel far from the labeled examples.
  • Low-density separation (the cluster assumption): the decision boundary should pass through regions where there are few data points, not through the middle of a dense cluster.
  • Manifold: high-dimensional data often lie near a lower-dimensional surface, and points on the same surface share a label. Distances should then be measured along the surface, not straight through space.

When these assumptions fail, unlabeled data can make a model worse (Section 8).

6.4The general recipe

Most semi-supervised methods minimize a supervised loss on the labeled data plus an unsupervised penalty R on the unlabeled data, weighted by \lambda:

\min_\theta\ \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). \tag{9}

The penalty is where the assumption enters. A graph penalty \sum_{j,k}W_{jk}\big(f(x_j)-f(x_k)\big)^2 with large weights W_{jk} for nearby points encodes smoothness and the manifold assumption (Section 7). An entropy penalty pushes predictions on unlabeled points to be confident, which moves the boundary out of dense regions (low-density separation). A consistency penalty asks for the same prediction on two slightly perturbed versions of an input, a local form of smoothness (Section 8). The weight \lambda decides how much we trust the assumption relative to the labels.

Pause and think. Why is the graph penalty \sum_{j,k}W_{jk}(f_j-f_k)^2 small for a classifier whose boundary passes through an empty region, and large for one whose boundary cuts a dense cluster?

Show the answer

The penalty is paid only along edges whose two end points get different predictions. Near an empty region there are few edges, and they are weak; a boundary through a dense cluster cuts many strong edges.