TL;DR
Inductive learning means learning a general rule from labelled examples and then applying that rule to inputs the learner has never seen. The rule is judged by how well it works on new inputs, not by how well it fits the examples it was built from. This is the usual setting for machine learning: a spam filter is trained on past emails and must handle tomorrow's.
Builds on: Transductive Learning, Empirical Risk Minimization · Leads to: Supervised Learning, Overfitting, Bias-Variance Tradeoff
Where it's used
Spam filtering. A mail provider trains a classifier on emails that users have marked as spam or not. The classifier is then run on every new email that arrives, most of which were not in the training data. Its quality is measured on fresh mail, because the point is to catch future spam, not to re-sort the old mail.
Fraud detection on payments. A bank trains a model on past transactions labelled as fraudulent or genuine. The model is applied to each new card payment at the time it is made. A rule that only worked on last year's transactions has failed the job.
Node embeddings for growing graphs. A citation network gains a new paper every day, and each paper has a list of references. The GraphSAGE method, introduced in 2017 by William Hamilton and colleagues, learns a function that builds a node embedding from the node's features and its neighbours. Because the function is learned rather than stored per node, it can embed a paper it never saw in training. The paper contrasts this with earlier methods that learn one embedding per node of a single fixed graph; those need extra Gradient Descent training before they can place a new node.
How it works
Take a tiny example. Four fruits are labelled, and each has a weight in grams. The learner must find a rule that says apple or lemon from the weight alone. Each step adds one idea.
-
Collect labelled examples. Here are four: a 90 g lemon, a 110 g lemon, a 150 g apple and a 170 g apple. Check: each example is an input (the weight) and a label (0 for lemon, 1 for apple).
-
Choose a family of rules. Use rules of the form "label 1 if the weight is at least , otherwise 0", for some threshold . Check: the family is fixed before looking at the data. The learner only chooses which member to use. Choosing the family in advance is an Inductive Bias.
-
Score each rule on the examples. Try . The 110 g lemon is labelled 0 but the rule says apple, so that is one mistake. Try . The rule makes no mistakes on the four examples. Try . The 150 g apple is labelled 1 but the rule says lemon, so that is one mistake. Check: the threshold must lie above 110 and at most 150 to get everything right.
-
Pick a rule. Take , which sits in the middle of the safe range. Check: this choice is a guess inside a gap, and the data does not say where exactly the boundary is.
-
Apply the rule to a new fruit. A new fruit weighs 140 g. The rule says 140 is at least 130, so the label is apple. A new fruit of 120 g gets label lemon. Check: neither of these fruits was in the training set, and the rule still gives an answer.
-
Measure on new fruit. Test the rule on fruit that was not used for training, a held-out test set. If the rule gets most of them right, it has induced something useful. If it only gets the four training fruits right, it has memorised them. Check: the success that matters is on the new fruit.
flowchart LR
T["Labelled examples"] --> L["Learner picks a rule"]
L --> R["Rule"]
N["New input never seen"] --> R
R --> P["Prediction"]
Steps 3 and 6 carry the idea. The rule is chosen to fit the examples, but the reason for choosing it is that it should work beyond them.
The math
Inputs and labels come from an unknown joint distribution . A learner sees a training set of pairs drawn from and picks a rule from a hypothesis class of functions that map an input to a label. The goal is a rule with small expected risk on a new pair drawn from .
The pairs are assumed to be drawn independently from the same process; this is the assumption behind Statistical Independence in the training data. The distribution is a Joint Distribution over inputs and labels, and each new pair is a fresh draw from it. When that holds, a rule chosen from the examples can be expected to behave on new pairs in a similar way.
Step 2 in symbols: the family
The family in the example is the set of threshold rules
Here is the weight in grams. Each gives one rule. The learner's job is to choose .
Step 3 in symbols: the training error
The empirical risk of a rule is the fraction of training examples it gets wrong:
where is an Indicator Variable: 1 when the statement inside is true and 0 otherwise. For , the rule gets one of four examples wrong, so . For , . For , .
Choosing to minimise is empirical risk minimisation, covered in Empirical Risk Minimization. It is the usual way an inductive learner picks a rule.
Step 6 in symbols: the test error
Let be a separate set of new pairs that were not used to choose . Its test error is
Because is independent of , this is an unbiased estimate of the expected risk , and by the Law of Large Numbers it becomes more accurate as grows. The training error is not: was chosen to make small, so tends to be lower than . The difference is the generalisation gap, and it is the quantity that Overfitting makes large.
Worked examples
Use the four labelled fruits from "How it works": lemon 90 g and 110 g, apple 150 g and 170 g. The threshold rule is if .
- Try . The lemon at 90 g gets 0, which is correct. The lemon at 110 g gets 0, correct. The apple at 150 g gets 1, correct. The apple at 170 g gets 1, correct.
- Training error: .
- Apply the rule to a new fruit at 140 g: , so the label is 1, apple.
- Interpretation: the rule has no training mistakes, and it gives an answer for a weight it never saw.
Use the same family of threshold rules on a larger sample. The training set has six fruits with weights and labels: lemons at 90, 100 and 110 g, and apples at 150, 160 and 175 g. The test set has four new fruits: lemon 105 g, apple 125 g, apple 140 g and lemon 120 g.
- Any in the range has zero training error. Pick .
- Training error: .
- Test fruit 105 g: , the rule says lemon. The label is lemon, correct.
- Test fruit 125 g: , the rule says lemon. The label is apple, wrong.
- Test fruit 140 g: , the rule says apple. The label is apple, correct.
- Test fruit 120 g: , the rule says lemon. The label is lemon, correct.
- Test error: .
- Generalisation gap: .
- Interpretation: the rule fits the training data perfectly, yet it misses a quarter of new fruit. The 125 g apple lies in the part of the range that the examples never pinned down. The gap is large because the training data could not tell the learner where to put the boundary.
A spam filter uses one rule: "if the email contains the word free, label it spam." The rule was chosen from a family of single-keyword rules by looking at a training set of 10 emails. It gets 2 of them wrong, so the training error is . The team then tests it on a fresh set of 10 emails and it gets 4 wrong.
- Training error: .
- Test error: .
- Generalisation gap: .
- Interpretation: the keyword looked good on the training mail, because it happened to be common in the spam there. New spam uses other wording, so the rule misses it. The fresh test set is what reveals this. A filter judged on the mail it was trained on would look better than it is.
Try it: a rule makes 1 mistake on 10 training examples and 3 mistakes on 12 new examples. What are the test error and the generalisation gap? Answer: the test error is , the training error is , and the gap is .
Common mistakes and tradeoffs
It is tempting to think inductive learning is the opposite of learning from data. In fact, both inductive and transductive learners learn from data. The difference is when the answers are needed. An inductive learner must handle inputs that were not available during training; a transductive learner uses a fixed set of unlabelled inputs that are already in hand, as described in Transductive Learning.
It is tempting to think a low training error means the rule has been learned. In fact, a rule can have zero training error and still fail on new inputs, as the 125 g fruit showed. The training error only says the rule fits the examples; the test error, or a Cross-Validation estimate built from held-out folds, says whether the rule generalises.
It is tempting to think a rule learned once will work forever. In fact, the guarantee depends on new inputs coming from the same process as the training inputs. When the process changes, for example when spammers change their wording, the rule may need to be learned again.
Use the inductive setting when new inputs arrive after training and must be labelled one at a time, which covers most deployed systems. Do not confuse it with cases where all the inputs are already known and only a few labels are missing; there the transductive or semi-supervised setting may fit better. The setting also differs from the Semi-Supervised Learning case, where unlabelled inputs are available during training. Alternatives include storing a lookup table of answers for known inputs, which cannot handle anything new, and methods that learn a function from features, such as the aggregators in GraphSAGE.
History
Learning a rule from labelled examples and then applying it elsewhere is older than machine learning as a field. Early work such as Frank Rosenblatt's perceptron learned a rule of this kind from labelled examples. Later, Vladimir Vapnik and Alexey Chervonenkis developed theory on how the gap between training and test error can be bounded, which addresses why such a rule should work on new data; see VC Dimension.
The contrast between inductive and transductive settings matters most for graph data. The 2017 GraphSAGE paper by Hamilton, Ying and Leskovec states that most existing node-embedding approaches are inherently transductive: they fix one embedding per node of a single graph. It argues that many real applications need embeddings for unseen nodes, and that learned aggregation functions can produce them without additional training.
Recap
- Inductive learning chooses a rule from labelled examples and applies it to inputs that were not in the training set.
- A rule is picked from a family, usually by minimising the training error, as in Empirical Risk Minimization.
- The quality of the rule is measured on fresh data, and the gap between training error and test error shows how far it fails to generalise.
- The setting covers most deployed systems, which see new inputs after training.
Read next: Overfitting for why a small training error can mislead, Bias-Variance Tradeoff for how the choice of rule family controls that gap, and Supervised Learning for the common case where every example has a label.
Check yourself
QuestionIn one sentence, what makes a learner inductive rather than transductive?Show answer
An inductive learner must label inputs that were not available when it was trained, so it has to use a rule rather than a fixed list of inputs. A transductive learner works on a known, fixed set of unlabelled inputs.
QuestionA threshold rule has training error 0 on 5 examples and test error 2 out of 8 on new examples. What is the generalisation gap?Show answer
The test error is , the training error is , so the gap is .
QuestionFor the fruit data in the first example, why does any threshold between 110 and 150 give zero training error, and why does that not settle the choice?Show answer
Every lemon is at 110 g or below and every apple is at 150 g or above, so any in puts the boundary in the gap between them and labels all four fruits correctly. The training data does not say where in the gap the boundary belongs, so the choice inside the gap is a guess. New fruit near the gap, such as 125 g, can be labelled wrongly.
QuestionA spam filter is trained on mail from last year and then used on this year's mail. Why might its test error be higher than its training error, even with no mistakes in the code?Show answer
Its training error measures how well it fits last year's mail, which it was tuned on. This year's mail can differ in wording or in what spammers try, so the rule's fit to the training mail does not carry over. The gap between the two errors reflects that change.
QuestionA learner must label 500 new items that arrive one at a time after training. Which setting is it working in, and why?Show answer
It is working in the inductive setting. The items arrive after training, one at a time, so the learner must produce a rule that it can apply to each new input, rather than labelling a fixed set in advance.