Foundations to Frontier
Tests
D. Classical Machine Learning › D15 Semi-Supervised Learning

Transductive SVM

A transductive SVM (Vapnik, 1998; Joachims, 1999) chooses both a separating hyperplane and labels for the unlabelled points, so that the margin is wide for labelled and unlabelled points alike. The boundary is pushed away from dense groups of unlabelled points and into low-density gaps, which is the low-density separation assumption made concrete. The optimisation is combinatorial and non-convex: Joachims' algorithm labels the unlabelled points with a fixed share of positives, then raises their cost gradually and swaps pairs of labels that violate the margin. This page covers the objective, the hat loss on unlabelled points, the class-balance constraint, label switching and continuation methods, gradient and convex relaxations (S3VM, ∇S3VM, semidefinite relaxations), local minima, and when TSVMs help. In the exercises you implement a linear TSVM, then test it on clean gaps, long thin clusters, overlapping classes and a wrong class-balance assumption.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Draw the line through empty space

An SVM draws the boundary with the widest possible margin around the labelled points. With only two labelled points that boundary can be badly tilted. A transductive SVM also looks at the unlabelled points: it wants a wide margin around all of them, so it swings the boundary into the empty corridor between groups of data.

Transductive SVM: put the margin where the unlabelled points are not
test accuracy: SVM on 2 labels 0.891 → TSVM 0.995 · 11 label swaps · 5 unlabelled points end with the wrong label
Colours show the TSVM's final labels for the unlabelled points. With a clear gap the solid line swings into it, far from the dashed line set by two points. Lengthen the clusters and the first, tilted guess can be self-consistent, so swapping never escapes it. TSVM also keeps exactly a share r of positives: set the assumed share away from the true share and that many points must be labelled wrongly.
Why engineers care

In text and signal classification, unlabelled data often fall into groups separated by gaps: documents by topic, or operating regimes of a machine. A TSVM was the classic way to exploit this, and it shows two practical lessons that apply to all semi-supervised methods: non-convex objectives depend on their starting point, and an assumed class balance is a strong, sometimes wrong, assumption.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A transductive SVM wants a wide margin around…
  2. 2. The boundary is pushed into…
  3. 3. A TSVM also outputs…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

The objective by hand

SVM recap. The slack of a point is ξ = max(0, 1 − y f(x)). It is 0 outside the margin, between 0 and 1 inside it on the correct side, and above 1 on the wrong side. For labels (1, 1, −1, −1) and outputs (2, 0.5, 0.3, −1.5), the slacks are (0, 0.5, 1.3, 0).

TSVM objective.

min over w, b and ŷ_U of ½‖w‖² + C Σ_L ξᵢ + C* Σ_U ξⱼ(ŷⱼ),

subject to a fraction r of the unlabelled labels ŷ being positive. With the best ŷⱼ for each point, the unlabelled loss becomes the hat loss max(0, 1 − |f|): unlabelled points are penalised for sitting inside the margin, whichever side they are on. f = 0.4 costs 0.6, and f = 1.2 costs 0.

Margin width. The margin is 2/‖w‖. For w = (3, 4) it is 2/5 = 0.4.

Balance. Without the constraint, a trivial solution puts all unlabelled points on one side, far from the boundary. So the share r of positives is fixed, usually to the share among the labelled points. To label outputs (0.3, −0.2, 1.5, −0.1, 0.05) with r = 0.4, the top 2 (1.5 and 0.3) become positive.

📝 Quick check (Level 1)
0/3 answered
  1. 1. The hat loss of an unlabelled point with f = −0.3 is…
  2. 2. The balance constraint prevents…
  3. 3. Margin width for w = (6, 8)?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.

Joachims’ label-switching algorithm

  1. Train an SVM on the labelled points. Label the unlabelled points by its outputs, making the top fraction r positive.
  2. Set the unlabelled cost C* very small.
  3. Retrain the SVM on all points. Find a positive and a negative unlabelled point whose slacks are both positive and sum to more than 2. If they exist, swap their labels and retrain. Repeat until no such pair remains.
  4. Increase C* (for example ×10) and go to step 3, until C* reaches its final value.

Why the swap rule works. Swapping a pair changes their slacks from (ξᵢ, ξⱼ) to roughly (2 − ξᵢ, 2 − ξⱼ) at the current w. This lowers their total exactly when ξᵢ + ξⱼ > 2. Swapping a pair keeps the number of positives fixed, so the balance constraint holds throughout.

Why raise C slowly.* At first the labelled points dominate, so the unlabelled labels change only where they are very inconsistent. Raising C* gradually (“continuation”) follows a path of solutions rather than jumping into an arbitrary local minimum.

Exercise 1 (two Gaussian clusters with a gap, 1 label per class and 398 unlabelled points, 10 datasets). Test accuracy:

method mean worst
SVM on the 2 labels 0.922 0.765
transductive SVM 0.984 0.963
SVM on all labels 0.993 –

There were 1–27 label swaps per run. The TSVM nearly matched full supervision. Its small shortfall partly comes from forcing exactly 50% positives, while each sample’s true share varies slightly around 0.5.

🐍 Exercise 1: transductive SVM
Implement a linear squared-hinge SVM by gradient descent and Joachims' TSVM (balanced initial labelling, gradually increased unlabelled cost, pairwise label swaps), and compare it with the SVM on two labels and on all labels.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Joachims swaps a positive and a negative label when…
  2. 2. Swapping a pair preserves…
  3. 3. C* is raised gradually to…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory and other solvers

Vapnik’s transduction. Vapnik (1998) argued that when only specific test points need labels, one should solve that problem directly, rather than first estimating a general function. Bounds on the error over the given test points can be tighter than inductive bounds.

Non-convexity. The hat loss is non-convex, and the problem over labels is combinatorial (NP-hard in general). Practical solvers find local minima:

  • Joachims’ label switching (SVMlight, 1999).
  • ∇S3VM: gradient descent on a smooth hat loss exp(−3f²) with continuation (Chapelle and Zien, 2005).
  • Concave–convex procedure, CCCP (Collobert et al., 2006).
  • Deterministic annealing.
  • Branch and bound for exact small-scale solutions.

Chapelle, Sindhwani and Keerthi (2008) compared them and found large differences, with the global optimum often much better than local solvers.

Convex relaxations. Semidefinite relaxations (De Bie and Cristianini, 2004) and mean-label methods (Li et al., 2009) give convex problems at higher cost.

Interview questions.

  • When does a TSVM help? When the unlabelled data have a low-density gap where the true boundary lies, the class balance is known, and the inductive SVM starts reasonably near the right solution.
  • How do you set r? Use domain knowledge or a held-out labelled sample. The share among a handful of labels is very noisy.
📝 Quick check (Level 3)
0/3 answered
  1. 1. The TSVM problem is…
  2. 2. ∇S3VM replaces the hat loss by…
  3. 3. Chapelle et al. (2008) found that solvers…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

When does a TSVM help or hurt?

History.

  • V. Vapnik and A. Sterin (1977) proposed the transductive principle, developed further in Vapnik (1998).
  • T. Joachims (1999) introduced TSVMs for text classification.
  • O. Chapelle and A. Zien (2005) introduced low-density separation with ∇S3VM.
  • R. Collobert et al. (2006) introduced CCCP TSVMs.

Exercise 2. One label per class and 398 unlabelled points, 10 datasets per setting.

setting SVM on 2 labels TSVM SVM on all labels worst TSVM runs where TSVM was worse
well separated 0.922 0.984 0.993 0.963 0 of 10
long thin clusters 0.803 0.783 0.998 0.537 5 of 10
overlapping 0.761 0.794 0.934 0.561 2 of 10
30% positive, r = 0.5 0.884 0.736 0.994 0.497 9 of 10
30% positive, r = 0.3 0.884 0.936 0.994 0.612 0 of 10
  • Clean gap: large gains, never worse.
  • Long thin clusters trapped it. When the clusters are long along the gap, a badly tilted first guess from two labels splits each cluster across its length. That labelling is self-consistent: no pair has both slacks large enough to swap. The TSVM got worse in half the runs, although a perfect separator existed (0.998 with all labels). A gradient S3VM with the same start behaved similarly in tests. This is the local-minimum problem.
  • A wrong class balance costs accuracy directly. With 30% positives but r = 0.5 (what one label per class implies), 20% of the unlabelled points had to be labelled wrongly. The TSVM was worse than the plain SVM in 9 of 10 runs. With the correct r = 0.3 it gained 5 points.
  • Overlap gave modest, unreliable gains: the mean improved, but 2 of 10 runs got worse.
🐍 Exercise 2 (research): where TSVMs break
For a clean gap, long thin clusters, overlapping clusters, and imbalanced classes with a wrong or correct assumed share r, compare the SVM on two labels, the TSVM and the SVM on all labels, and count the runs where the TSVM was worse.

TSVMs in AI, robotics and aerospace

  • Text classification of reports: the original TSVM success, sorting maintenance or incident reports from a few labelled ones.
  • Remote-sensing classification: TSVMs were widely used for hyperspectral image classification with few ground-truth pixels (Bruzzone, Chi and Marconcini, 2006).
  • Lesson for any pseudo-labelling system: state the class balance you assume, and check it.

References

  1. V. Vapnik (1998). Statistical Learning Theory. Wiley.
  2. T. Joachims (1999). “Transductive inference for text classification using support vector machines.” Proc. ICML.
  3. O. Chapelle, A. Zien (2005). “Semi-supervised classification by low density separation.” Proc. AISTATS.
  4. R. Collobert, F. Sinz, J. Weston, L. Bottou (2006). “Large scale transductive SVMs.” JMLR 7.
  5. O. Chapelle, V. Sindhwani, S. S. Keerthi (2008). “Optimization techniques for semi-supervised support vector machines.” JMLR 9.
  6. L. Bruzzone, M. Chi, M. Marconcini (2006). “A novel transductive SVM for semisupervised classification of remote-sensing images.” IEEE TGRS 44(11).