Semi-Supervised Learning
Cluster, smoothness and manifold assumptions that make unlabeled data useful.
Unlabeled data are cheap, but they carry information about the inputs only, never directly about the labels. Semi-supervised learning works exactly when the shape of constrains . This lesson makes that link precise: the assumptions that create it, the algorithms that exploit it, and the theorems that say how much it can and cannot buy.
What you’ll learn
- State the smoothness, cluster, low-density and manifold assumptions, and prove that with independent priors on and unlabeled data leave the posterior over the classifier unchanged.
- Derive the harmonic solution of label propagation, , and its random-walk interpretation.
- Explain transductive SVMs, entropy minimization, pseudo-labeling and consistency regularization (FixMatch) as implementations of low-density separation.
- State what Castelli & Cover, Blum & Mitchell, Balcan & Blum and Ben-David, Lu & Pál proved about the value of unlabeled data, and where the theory is still open.
When can unlabeled data help at all?
The learner receives labeled examples and unlabeled inputs , usually with , all drawn from the same distribution . An inductive learner outputs a classifier for any future input; a transductive one only labels the points of . Either way, the unlabeled points are samples from the marginal and say nothing about labels by themselves. They can help only if carries information about , and a two-line Bayesian computation shows exactly what goes wrong when it does not.
Model the inputs with parameters and the labels given inputs with , so . The likelihood of all the data factorizes:
If the prior is independent, , the posterior splits into a factor in and a factor in :
Integrating out leaves a posterior over the classifier that does not involve at all. Every semi-supervised method therefore assumes, explicitly or not, a dependence between and :
| Assumption | What it says | Methods that use it |
|---|---|---|
| Smoothness | two points close together in a high-density region have similar labels | graph methods, consistency regularization |
| Cluster | points in the same cluster tend to share a label | cluster-then-label, mixture models with EM |
| Low-density separation | the decision boundary passes through regions where is small (the cluster assumption restated) | transductive SVMs, entropy minimization, pseudo-labels |
| Manifold | the inputs lie near a low-dimensional manifold, and labels vary smoothly along it | Laplacian regularization, manifold regularization |
A model uses a Gaussian mixture with parameters for and a separate logistic regression with weights for , with independent priors on and . You add 100,000 unlabeled points. What happens to the posterior over ?
- It concentrates faster, as with more labeled data
- It shifts the boundary toward low-density regions of the mixture
- Nothing: it equals the posterior given the labeled data alone
- It becomes improper, because the unlabeled points have no likelihood under
Show the answer
C. Nothing: it equals the posterior given the labeled data alone
The likelihood and the prior both factorize into a part and a part, so the unlabeled points only sharpen the posterior over , which the classifier does not use. To benefit, the model must tie to , for instance a generative classifier where each mixture component is a class, or a penalty on boundaries through dense regions.
Graphs: label propagation is a harmonic function
Build a weighted graph on all points, for instance with for the nearest neighbors and otherwise, and let with . The graph Laplacian measures how much a labeling varies across edges. Zhu, Ghahramani & Lafferty (2003) clamp the labeled values, for , and choose the smoothest completion.
Expand the sum over ordered pairs; the two squared terms each give :
Order the points labeled first and split into blocks. Only is free, and the energy is a convex quadratic in it:
Set the gradient to zero. is positive definite, hence invertible, whenever every connected component of the graph contains a labeled point; and because is diagonal:
Row of the optimality condition says each unlabeled value is the weighted average of its neighbors: is harmonic on , so by the maximum principle . The hitting probability of a random walk that moves from to with probability satisfies the same equations with the same boundary values, so the two coincide:
Four points on a path, , with unit edge weights. Point 1 is labeled 1 and point 4 is labeled 0. What is the harmonic value ?
Show the answer
0.67
The harmonic equations are and , so and : on a path, the harmonic function interpolates linearly. As a random walk, this is gambler's ruin: starting one step from the label-1 end of a path with three steps, the walk reaches that end first with probability .
The graph is where the assumptions live. If no edge crosses the gap between the two moons, each moon is a connected component, and one labeled point per moon labels all of it perfectly, exactly where k-means failed. A few edges across the gap leak label mass between the moons, so the choice of or matters as much as the algorithm.
The harmonic solution is transductive. Manifold regularization (Belkin, Niyogi & Sindhwani, 2006) makes it inductive: minimize over a reproducing kernel Hilbert space, where collects at all points; a representer theorem reduces it to kernel coefficients. One known weakness: with a fixed number of labels and ever more unlabeled points in dimension two or more, the Laplacian penalty on a neighborhood graph can degenerate toward a nearly constant function with sharp spikes at the labeled points, which has motivated higher-order and -Laplacian variants.
Low-density separation: TSVMs, entropy and pseudo-labels
Another family puts the decision boundary where the unlabeled points are not. The transductive SVM (Joachims, 1999, building on Vapnik) treats the unknown labels of the unlabeled points as variables and maximizes the margin over all points:
Entropy minimization (Grandvalet & Bengio, 2005) does the same for probabilistic classifiers: add , the entropy of the predicted class distribution, to the training loss. A boundary through a dense cloud of unlabeled points leaves many of them uncertain and is penalized; a boundary through a gap lets every prediction be confident.
Self-training (pseudo-labeling) is the hard-label version: fit on , predict , add the confident predictions as labels, refit. Training on its own hard predictions pushes a model toward confident outputs, which is why pseudo-labeling behaves like entropy minimization. Its failure mode is confirmation bias: an early mistake becomes a training label and reinforces itself.
Consistency regularization adds domain knowledge: the prediction should not change under perturbations that preserve the label, such as crops, flips and color changes of an image. FixMatch (Sohn et al., 2020) combines the two ideas. For each unlabeled image in a batch, a weakly augmented copy gives a prediction ; if its top probability clears a threshold , the hard label becomes the target for a strongly augmented copy :
Think first Why does adding the entropy of the predictions on unlabeled points to the loss push a classifier's decision boundary into low-density regions, and what stops it from simply predicting one class everywhere?
Predicted probabilities pass through at the boundary, so unlabeled points near it have high entropy. With the scale of the weights held in check, by weight decay as in practice, the penalty is smallest when few unlabeled points lie near the boundary, that is, when the boundary runs through a gap. The check matters: without it, scaling up the weights would make every prediction confident wherever the boundary lies, so the norm penalty is what turns "confident" into "far from the boundary," as the margin does for the transductive SVM. Predicting one class everywhere would also be confident, but the labeled loss forbids it, which is why entropy minimization needs labeled data and, in practice, a class-balance term. The cluster assumption is what makes the gap the right place for the boundary.
What theory says unlabeled data are worth
That is the optimistic case: the model is right. When it is wrong, unlabeled data can hurt. Cozman, Cohen & Cirelo (2003) showed that semi-supervised maximum likelihood for mixture models can end up with higher classification error than the labeled data alone, even in settings where more labeled data would lower it: thousands of unlabeled points dominate the likelihood, and a misspecified model fits them at the expense of the boundary.
A PAC model for assumptions. Balcan & Blum (2010) formalize an assumption as a compatibility function : the margin of at for low-density separation, agreement of the two views for co-training. The unlabeled error can be estimated from unlabeled data alone, so unlabeled data shrink the search to the hypotheses that are nearly compatible. If the target is compatible, the number of labeled examples then scales with the complexity of that compatible subclass instead of the whole class , while the number of unlabeled examples scales with and .
Without an assumption. Ben-David, Lu & Pál (2008) gave the learner more than any unlabeled sample can: exact knowledge of . For thresholds on the real line in the realizable case, with any absolutely continuous , supervised ERM needs at most labels, and no semi-supervised algorithm can get by with fewer than about half as many: knowing is worth at most a factor of about 2. In the agnostic case, for thresholds and for unions of intervals, the semi-supervised sample complexity is of the same order as the supervised one, for the intervals. They conjectured a constant-factor gap for every class. Darnstädt, Simon & Szörényi (2013) showed the conjecture fails in general: the gap can be arbitrarily large for classes of infinite VC dimension, while for finite classes containing both constant functions it is at most of order .
Key takeaways
- Unlabeled data reveal only . With independent priors on and , the posterior over the classifier ignores them; every method relies on a link such as smoothness, clusters, low-density separation or a manifold, plausibly present when causes .
- Label propagation minimizes with the labels clamped. The harmonic solution averages neighbors and equals a random walk's probability of reaching a label-1 point first.
- Transductive SVMs, entropy minimization, pseudo-labels and consistency regularization (FixMatch: confident weak-augmentation labels as targets for strong augmentations) all push the boundary into low-density regions.
- With a correct, identifiable mixture, labels are exponentially valuable once unlabeled data have found the regions (Castelli–Cover); with a wrong one, unlabeled data can hurt. Without assumptions, knowing buys at most a constant factor for thresholds (Ben-David–Lu–Pál), though not for every class.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
In label propagation with the harmonic solution, what is the value of an unlabeled point?
- The label of the nearest labeled point
- The weighted average of its neighbors' values, equal to the probability that a random walk from hits a label-1 point before a label-0 point
- The majority label among its nearest neighbors in the input space
- until enough labeled points are nearby
Show the answer
B. The weighted average of its neighbors' values, equal to the probability that a random walk from hits a label-1 point before a label-0 point
Minimizing with clamped labels gives , whose rows say . Random-walk hitting probabilities solve the same equations with the same boundary values, so they are equal. Values flow along the graph, so a point far from every label in input space can still be confidently labeled if a dense path connects it to one.
Ben-David, Lu & Pál (2008) let a semi-supervised learner know the input distribution exactly. For thresholds on the line in the realizable case, with absolutely continuous, what did they prove?
- Exact knowledge of reduces the labels needed from order to order
- Knowing saves at most a factor of about 2 in labeled examples
- Knowing never helps at all, by any factor
- Semi-supervised learning is impossible for thresholds
Show the answer
B. Knowing saves at most a factor of about 2 in labeled examples
Supervised ERM needs at most labels, while any semi-supervised algorithm needs about . Since any absolutely continuous distribution can be stretched into the uniform one, knowing its shape carries no label information; only an assumption tying labels to can buy more.
A generative classifier (one Gaussian per class) is fitted by EM to 100 labeled and 100,000 unlabeled points. The true class densities are far from Gaussian. What can happen to its test error compared with fitting on the 100 labeled points alone?
- It can increase: the unlabeled points dominate the likelihood and pull a misspecified model away from a good boundary
- It must decrease, because more data always reduce variance
- It stays the same, because unlabeled points carry no information
- It converges to the Bayes error, by the Castelli–Cover theorem
Show the answer
A. It can increase: the unlabeled points dominate the likelihood and pull a misspecified model away from a good boundary
Cozman, Cohen & Cirelo (2003) showed exactly this: with a wrong model, semi-supervised maximum likelihood can be worse than supervised training. The likelihood rewards fitting the shape of , and with 1,000 times more unlabeled points, the fit to the inputs overrides the fit to the boundary.
Which assumption lets co-training boost a weakly useful view-1 classifier into an accurate view-2 classifier using unlabeled data alone?
- The two views are uncorrelated
- View 1 is more informative than view 2
- The data are linearly separable in the concatenated views
- Each view suffices to predict the label, and the views are conditionally independent given the label
Show the answer
D. Each view suffices to predict the label, and the views are conditionally independent given the label
Conditional independence makes the view-1 classifier's mistakes, seen from view 2, depend on the true class only, a form of random classification noise; a noise-tolerant learner for view 2 then recovers the target. Real views are rarely conditionally independent, and later work studied weaker conditions.
Further reading
- O. Chapelle, B. Schölkopf & A. Zien (eds.), Semi-Supervised Learning (MIT Press, 2006).
- X. Zhu, Z. Ghahramani & J. Lafferty, "Semi-supervised learning using Gaussian fields and harmonic functions," Proceedings of ICML, 912–919 (2003).
- S. Ben-David, T. Lu & D. Pál, "Does unlabeled data provably help? Worst-case analysis of the sample complexity of semi-supervised learning," Proceedings of COLT, 33–44 (2008).
- K. Sohn, D. Berthelot, C.-L. Li, Z. Zhang, N. Carlini, E. D. Cubuk, A. Kurakin, H. Zhang & C. Raffel, "FixMatch: simplifying semi-supervised learning with consistency and confidence," NeurIPS (2020).
- J. E. van Engelen & H. H. Hoos, "A survey on semi-supervised learning," Machine Learning 109, 373–440 (2020).