Search

Search papers and lessons

Transductive Learning

Level 2 · 11 min read

Transductive learning predicts labels for a fixed set of unlabelled inputs that are already in hand, using them during training, instead of learning a rule for any future input.

On this page

  • Colour = topic mix
  • Discrete math
  • Calculus
  • Probability
  • Learning basics
  • Losses & regularization
  • Neural network basics
  • ReadReady to readNot yet

TL;DR

Transductive learning is a way of setting up a prediction problem. You already hold a fixed set of inputs that have no labels, and you want labels for exactly those inputs. The model is allowed to look at those unlabelled inputs during training, and it is judged only on them. It does not have to learn a rule that works for any future input. Its counterpart, inductive learning, does have to. The distinction matters most in semi-supervised learning, where labelled and unlabelled data are both available.

Builds on: Semi-Supervised Learning · Leads to: Inductive Learning

Where it's used

Labelling a fixed archive. A library holds 50,000 scanned documents and has labelled 500 of them by topic. The job is to label the remaining 49,500 in one batch, and no new documents will arrive. A transductive method can use the structure of the whole archive, including the documents it will label, to spread the known labels across it.

Node classification in a graph. A company has a graph of customer accounts. Some accounts are known to be fraudulent. The task is to score the other accounts already in the graph. Methods such as the graph convolutional network, a kind of graph neural network, are often run in this semi-supervised, transductive way: the whole graph, including the unlabelled accounts, is present during training, and the predictions are made for the nodes that were held out. A citation graph of papers, where a few papers have a known topic, is set up the same way.

A competition with a hidden test set. Some machine-learning contests publish the test inputs in advance and ask for one prediction per input. The test set is fixed and known. Using it in training, without its labels, is a transductive setup.

How it works

We use a tiny problem on a line. Four points sit at positions 1, 2, 3 and 4. Point 1 is labelled red and point 4 is labelled blue. Points 2 and 3 have no labels, and they are the points we must label. Points that are next to each other on the line are neighbours.

We encode the labels as numbers: red is 1 and blue is 0. Each point gets a value, and the value tells us how red it looks. Labelled points keep their values. The unlabelled points start at 0.5, meaning we know nothing yet.

  1. Set up the Graph. Point 2 has neighbours 1 and 3. Point 3 has neighbours 2 and 4. Check: points 1 and 4 each have one neighbour, and points 2 and 3 each have two. All four points are present during training, including the two unlabelled ones.
  2. Average the neighbours. Each unlabelled point takes the average value of its neighbours. Round 1, using the starting values: point 2 becomes (1 + 0.5) / 2 = 0.75, and point 3 becomes (0.5 + 0) / 2 = 0.25. Check: point 2 moved toward the red neighbour, and point 3 moved toward the blue one.
  3. Repeat. Round 2 uses the new values: point 2 becomes (1 + 0.25) / 2 = 0.625, and point 3 becomes (0.75 + 0) / 2 = 0.375. Check: point 2 fell and point 3 rose, so the two unlabelled values are closing in on each other, while points 1 and 4 still hold 1 and 0.
  4. Let it settle. After many rounds the values approach 2/3 for point 2 and 1/3 for point 3. Check: point 2 should equal (1 + point 3) / 2, which is (1 + 1/3) / 2 = 2/3, and point 3 should equal point 2 / 2, which is (2/3) / 2 = 1/3. Both rules hold.
  5. Label the unlabelled points. A value above 0.5 means red, below 0.5 means blue. Point 2 has 2/3, so it is red. Point 3 has 1/3, so it is blue. Check: the labels are read off the final values only for the points we were asked about.
flowchart LR
  L["Labelled points keep their labels"] --> A["Each unlabelled point averages its neighbours"]
  A --> R["Repeat until values stop changing"]
  R --> P["Read off labels for the unlabelled points"]

The math

Definition: Transductive prediction
Given labelled inputs {(xi,yi)}i∈L\{(\mathbf{x}_i, y_i)\}_{i \in L} and a fixed set of unlabelled inputs {xj}j∈U\{\mathbf{x}_j\}_{j \in U}, a transductive method outputs labels y^j\hat{y}_j for j∈Uj \in U only. It may use all the inputs xi\mathbf{x}_i for i∈L∪Ui \in L \cup U during training. It is not required to define a rule that could be applied to a new input.

Here LL is the set of labelled indices, UU is the set of unlabelled indices, and yiy_i is a label. The contrast with inductive learning is that an inductive method learns a function ff from the labelled data alone, and then applies ff to any input, including ones it has never seen.

Step 2 in symbols: the averaging rule

Give each point a value fif_i, with fi=yif_i = y_i for labelled points. Let N(i)\mathcal{N}(i) be the neighbours of point ii. For an unlabelled point the update is

fi←1∣N(i)∣∑j∈N(i)fj.f_i \leftarrow \frac{1}{|\mathcal{N}(i)|} \sum_{j \in \mathcal{N}(i)} f_j.

Here ∣N(i)∣|\mathcal{N}(i)| is the number of neighbours of point ii. For point 2, N(2)={1,3}\mathcal{N}(2) = \{1, 3\}, so f2←(f1+f3)/2f_2 \leftarrow (f_1 + f_3)/2. Round 1 gives f2=(1+0.5)/2=0.75f_2 = (1 + 0.5)/2 = 0.75, as in the walkthrough.

Steps 3 and 4 in symbols: the fixed point

Let fUf_U be the vector of values for the unlabelled points, yLy_L the vector of labels of the labelled points, and II the identity matrix (ones on the diagonal, zeros elsewhere). Write the rule in matrix form with PUUP_{UU} for the averaging weights between unlabelled points and PULP_{UL} for the weights from unlabelled points to labelled ones. At a fixed point,

fU=(I−PUU)−1PUL yL.f_U = (I - P_{UU})^{-1} P_{UL}\, y_L.

For this example the averaging weights are one half for each neighbour, so

PUU=(012120),PUL=(120012),yL=(10).P_{UU} = \begin{pmatrix} 0 & \tfrac{1}{2} \\ \tfrac{1}{2} & 0 \end{pmatrix}, \qquad P_{UL} = \begin{pmatrix} \tfrac{1}{2} & 0 \\ 0 & \tfrac{1}{2} \end{pmatrix}, \qquad y_L = \begin{pmatrix} 1 \\ 0 \end{pmatrix}.

Then I−PUU=(1−12−121)I - P_{UU} = \begin{pmatrix} 1 & -\tfrac{1}{2} \\ -\tfrac{1}{2} & 1 \end{pmatrix}, whose inverse is 43(112121)\tfrac{4}{3}\begin{pmatrix} 1 & \tfrac{1}{2} \\ \tfrac{1}{2} & 1 \end{pmatrix}. Multiplying by PULyL=(12,0)P_{UL} y_L = (\tfrac{1}{2}, 0) gives f2=23f_2 = \tfrac{2}{3} and f3=13f_3 = \tfrac{1}{3}. This is the same answer the repeated averaging approaches, so the iteration is a way of solving a linear system.

Step 5 in symbols: the labels

y^j={redfj>12bluefj<12\hat{y}_j = \begin{cases} \text{red} & f_j > \tfrac{1}{2} \\ \text{blue} & f_j < \tfrac{1}{2} \end{cases}

With f2=23f_2 = \tfrac{2}{3} and f3=13f_3 = \tfrac{1}{3}, the labels are red and blue.

Worked examples

Example
Example 1: a midpoint with no information
  1. Three points on a line: point 1 is red (value 1), point 3 is blue (value 0), and point 2 is unlabelled.
  2. Averaging rule for point 2: f2=(1+0)/2=0.5f_2 = (1 + 0)/2 = 0.5.
  3. The value is exactly 0.5, so neither label is preferred.

Interpretation: the method is sound but undecided. With symmetric evidence on both sides, the average cannot choose, so a tie-breaking rule or more information is needed.

Example
Example 2: a standard line of six points

Point 1 is red (value 1), point 6 is blue (value 0), and points 2 to 5 are unlabelled. Each interior point has two neighbours.

  1. Guess the pattern: the values fall in equal steps from 1 to 0, so fk=1−(k−1)/5f_k = 1 - (k - 1)/5. That gives f2=0.8f_2 = 0.8, f3=0.6f_3 = 0.6, f4=0.4f_4 = 0.4, and f5=0.2f_5 = 0.2.
  2. Check point 2: (f1+f3)/2=(1+0.6)/2=0.8(f_1 + f_3)/2 = (1 + 0.6)/2 = 0.8. It matches.
  3. Check point 3: (f2+f4)/2=(0.8+0.4)/2=0.6(f_2 + f_4)/2 = (0.8 + 0.4)/2 = 0.6. It matches.
  4. Check point 4: (f3+f5)/2=(0.6+0.2)/2=0.4(f_3 + f_5)/2 = (0.6 + 0.2)/2 = 0.4. It matches.
  5. Check point 5: (f4+f6)/2=(0.4+0)/2=0.2(f_4 + f_6)/2 = (0.4 + 0)/2 = 0.2. It matches.
  6. Labels: points 2 and 3 are above 0.5 and are red, points 4 and 5 are below 0.5 and are blue.

Interpretation: the labels change where the values cross one half. The transductive method has used the chain of neighbours to decide the boundary, using no labels for the points in between.

Example
Example 3: a paper in a citation graph

A paper P is unlabelled. Its neighbours are three papers A, B and C, with labels already known, and a fourth neighbour Q that is unlabelled and currently has value 0.6. Labelled values are 1 for the vision class and 0 for the language class. A and B are vision, so their values are 1. C is language, so its value is 0.

  1. Average of the four neighbour values: (1+1+0+0.6)/4=2.6/4=0.65(1 + 1 + 0 + 0.6)/4 = 2.6/4 = 0.65.
  2. Compare with one half: 0.65 is above 0.5.
  3. The label of P is vision.
  4. Try it: the same paper P has neighbours A and B with value 0, the labelled paper C with value 1, and the unlabelled neighbour Q at 0.6. Which class does P get? Answer: (0+0+1+0.6)/4=1.6/4=0.4(0 + 0 + 1 + 0.6)/4 = 1.6/4 = 0.4. That is below one half, so P is labelled language (value 0).

Interpretation: P is decided by its neighbourhood. Flipping the labels of its three labelled neighbours changes the answer, which shows how strongly transductive methods depend on the graph.

Common mistakes and tradeoffs

It is tempting to think that a transductive method uses the test labels, which would be cheating. In fact it uses only the unlabelled inputs, their features and their connections. The labels of the points being predicted are never given to the method.

It is tempting to think that a transductive prediction is a rule that can be reused. In fact it is only a set of labels for the points in hand. If a new paper arrives, the averaging has to be run again on the enlarged graph, and the earlier answers may change. An inductive method, which is usually trained to minimise error on the labelled data through Empirical Risk Minimization, would apply its learned rule to the new point directly.

It is tempting to think that the averaging always gives a useful answer. In fact it depends on two things. First, the graph: a group of points with no path to any labelled point receives no information at all. Second, the choice of neighbours and weights: if the neighbours are chosen badly, the labels spread across the wrong boundaries. A tie such as the value 0.5 in Example 1 has to be broken by some other rule.

Transductive learning suits problems where the set of inputs to label is fixed and known, and where the structure linking them is reliable, such as a citation graph or a similarity graph. It is the wrong choice when new inputs arrive continually and must be labelled as they come, because then an inductive model is needed. Alternatives include inductive semi-supervised methods, which learn a rule from both labelled and unlabelled data, and fully supervised learning when labels are plentiful. Validation still matters: a held-out set of labelled points, with their labels hidden during training, is the usual way to check that the method works and that it is not Overfitting the labels it sees, as with a validation split.

History

Vladimir Vapnik emphasised the difference between transductive and inductive inference in the 1990s, when he discussed learning a general rule versus making predictions for a specific set of inputs. The idea of spreading labels over a graph came later, from work on semi-supervised learning. In 2002, Zhu and Ghahramani proposed label propagation on graphs, and in 2003 Zhu, Ghahramani and Lafferty proposed harmonic functions on graphs, which compute values like the ones in this lesson by averaging over neighbours. Their work made graph-based transductive methods common in practice.

Later, graph neural networks trained in a semi-supervised way, such as the graph convolutional network of 2016, made the setting standard for node classification, where the whole graph is available during training.

Recap

  • Transductive learning predicts labels for a fixed set of unlabelled inputs, and it may use those inputs during training.
  • It does not need a rule for future inputs, which is the difference from inductive learning.
  • A common method repeatedly averages neighbour values, with labelled values held fixed, until the values settle.
  • The settled values solve a linear system, and a threshold such as one half turns them into labels.
  • Read next: Inductive Learning for the setting that must generalise to new inputs.

Check yourself

QuestionRecall: what is the key difference between transductive and inductive learning?Show answer
A transductive method predicts labels for a fixed set of unlabelled inputs and may use them during training. An inductive method learns a rule from the labelled data that applies to any new input.
QuestionComputation: an unlabelled point has two labelled neighbours with values 1 and 0, and one unlabelled neighbour with value 0.8. Using the average of all three neighbour values, what is the value of the point, and which label does it get?Show answer
The average is (1+0+0.8)/3=1.8/3=0.6(1 + 0 + 0.8)/3 = 1.8/3 = 0.6. Since 0.6 is above one half, the point gets the label with value 1.
QuestionWhy: why must a transductive method be rerun when a new unlabelled point arrives?Show answer
A transductive prediction is computed from the whole set of points present, including their connections. A new point changes the neighbourhoods and the averaging, so the values of the earlier points may change too. The method gives no learned rule that could be applied to the new point alone.
QuestionApplied: a fraud team has a fixed graph of 10,000 accounts, of which 200 are confirmed fraudulent, and it wants scores for the other 9,800 accounts this week. Is a transductive method appropriate, and what should it check?Show answer
Yes, if the 9,800 accounts are fixed for this scoring run. The team should check that the graph links are reliable, that accounts with no path to a labelled account are flagged as uninformed, and that scores are validated on held-out labelled accounts whose labels are hidden during training. If accounts keep arriving, an inductive model would be more suitable.

Sources