Supervised learning
Intermediate
What you need first. Nothing else on this path comes first. This page is part of Statistical learning.
In statistical learning, supervised learning is the fitting of a rule that predicts an observed outcome from features, using cases in which both were recorded. When each recorded case carries both the measurements and the outcome, the outcome can be used to score a proposed rule. Supervised learning is that use: fit a rule that predicts the outcome from the measurements, on cases where the outcome was observed.[1][2]
Supervised learning
| Fact | Value |
|---|---|
| Topic | Statistical learning |
| Listed on | Statistical learning |
| Worked example | 1 |
Motivating example
Three training cases sit on a line: a feature with label , a feature with label , and a feature with label . A one-nearest-neighbour rule, asked about a new feature , finds the training feature as the nearest and returns the label . Asked about a new feature , it finds the training feature and returns the label . The labels on the three training cases are what make those two answers possible. Without the labels, the distances would still be defined and the prediction would not.[2][1]
Definition
Supervised learning, or learning with a teacher, starts from inputs and one or more outputs , observed together on a training sample . The fitted rule predicts from on a new case. If has a joint distribution, the target is a property of the conditional distribution of given , often the value that minimises the expected loss at that . The marginal distribution of is not the object. A squared loss is the usual example of the teacher’s score.[1]
In the usual division, each observation has predictors and a response . The fit aims at prediction of a future response, or at inference about how the response is associated with the predictors. Linear regression, binary logistic regression, generalised additive models, boosting, and support vector machines are supervised methods. So is linear discriminant analysis.[2]
The inputs are also called predictors or features. The outputs are responses. A quantitative output is a regression problem. A qualitative output is a classification. Logistic regression is typically used with a binary response, so it is a classification method, and because it estimates class probabilities it is also a regression for that probability.[1][2]
Under squared error the rule with the smallest expected prediction error is the conditional mean. Under absolute error it is the conditional median. One-nearest neighbour tries to estimate a local conditional mean, or a local class, by using the closest training cases.[1]
Properties
For the three training pairs , and , the nearest training feature to a query determines the one-nearest-neighbour label. The distances from are , and , so the label is . The distances from are , and , so the nearest training feature is and the label is . The distances from are , and , so the label is .
On the training points themselves, each point is at distance from itself and at a positive distance from the others. The one-nearest-neighbour label of each training point is the label that was recorded there, and the training error is . That identity uses the labels twice: once to store them, and once to score them.[1]
A partial version of the same structure is semi-supervised learning: responses are observed for of the cases and missing for the rest, and a method may use both parts. That extension is named as a separate case, outside the basic split into fully labelled and fully unlabelled samples.[2]
The conditional-risk target assumes future cases come from the same joint distribution as the training pairs, and that the loss used in fitting is the loss of the decision. A sample of labels that were assigned by a different process supervises a different problem. One-nearest neighbour stores the whole training sample and treats the closest label as the truth. In a region where the two classes overlap, that rule has a larger error than a rule based on the conditional probabilities. The training error of does not measure that overlap.[1]
Statistical use
Use a supervised method when the response on future cases is the decision and a sample of past responses exists. A binary clinical outcome is a setting for binary logistic regression or linear discriminant analysis. A local rule, with no global formula, is a setting for nearest neighbours or a decision tree. The training cases estimate the rule. A later case, or a cross-validation fold, estimates the loss of the rule.[2][1]
The loss should match the decision. Squared error fits a conditional mean. A misclassification count fits a class label. Estimating the conditional probabilities and then choosing the most probable class is the Bayes classifier when those probabilities are known, and it is the target of many fitted classifiers when they are not.[1]
Worked example
Training pairs , and define a one-nearest-neighbour rule. At a new feature the distances to the training features are , and . The nearest training feature is , so the predicted label is . At a new feature the distances are , and . The nearest training feature is , so the predicted label is . At each training feature the nearest neighbour is the point itself, so all three training labels are reproduced and the training error is .
Your turn. What label does this rule return at the feature ?
The distances from to , and are , and . The nearest training feature is , so the label is .
Common misconceptions
A supervised analysis is not any analysis that uses a computer, and it is not a clustering of the features. Clustering does not have a response to predict. If the labels in the example are thrown away, the distances remain and the predicted label does not.[2][1]
Logistic regression is supervised classification. The response is qualitative. The fitted probability is a means to a class, and also a regression for that probability. The name “regression” in the method does not turn the problem into an unlabelled one.[2]
A training error of , as in the one-nearest-neighbour calculation above, is not an estimate of the error on a feature that was not in the training set. The query at is a different question from the query at .[1]
Connections
Classification is supervised learning with a qualitative response. Simple linear regression is supervised learning with a quantitative response. Unsupervised learning drops the response. Inside classification, linear discriminant analysis, binary logistic regression, nearest neighbours and decision trees are different supervised rules for the same kind of . The training set is the collection of pairs the rule may use.[2][1]
Check yourself
Try these questions before opening an answer.
Training error of zero
One-nearest neighbour reproduces every training label, so the training error is zero. Why is that not an estimate of the error at a new feature?
Each training point is its own nearest neighbour, so the score uses the labels twice. A new feature is a different query, and the training error does not measure overlap between the classes.
Logistic regression
Why is logistic regression supervised learning even though the method has regression in its name?
The training cases carry a qualitative response. The fitted probability is a means to a class, so the response supervises the fit.
Labels removed
If the labels on a supervised training sample are thrown away, what remains and what is lost?
The distances among the features remain. The predicted label does not, because there is no response left to return.
History
The organised division into learning with a teacher and learning without one is the framework of the modern statistical-learning texts. Most of the early development is supervised: a response is present, a loss scores the rule, and squared error picks out the conditional mean. Linear regression, logistic regression, generalised additive models, boosting, and support vector machines are placed in that supervised class. One-nearest neighbour is the simple local rule against which more structured fits are compared. The texts then gather the unsupervised methods, which have no response, in a later chapter.[2][1]
See also
Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability
References
- ^ a b c d e f g h i j k l m a. (pp. 485–486, §14.1) b. (pp. 9–11, the nearest-neighbour rule in the overview; pp. 485–486, §14.1) c. (pp. 485–486, §14.1, (14.1)) d. (pp. 9–10) e. (pp. 18–20, §2.4) f. (pp. 9–11) g. (pp. 18–20, §2.4; pp. 485–486) h. (pp. 485–486) i. (pp. 18–20, §2.4; pp. 485–486) j. (pp. 485–486) k. (pp. 9–11 and 18–20) l. (pp. 9–10 and 485–486) m. (pp. 18–20, §2.4; pp. 485–486, §14.1) Hastie, T., Tibshirani, R. & Friedman, J. (2009). The Elements of Statistical Learning. Springer. https://doi.org/10.1007/978-0-387-84858-7
- ^ a b c d e f g h i j a. (Ch. 2, §2.1.4, pp. 26–27) b. (Ch. 2, §2.1.4, p. 26) c. (Ch. 2, §2.1.4, pp. 26–27) d. (Ch. 2, §2.1.5, pp. 28–29) e. (Ch. 2, §2.1.4, p. 28) f. (Ch. 2, §2.1.4, pp. 26–27; Ch. 12, §12.1, p. 496) g. (Ch. 2, §2.1.4, pp. 26–28) h. (Ch. 2, §2.1.5, pp. 28–29) i. (Ch. 2, pp. 26–29) j. (Ch. 2, §2.1.4–§2.1.5, pp. 26–29) James, G., Witten, D., Hastie, T. & Tibshirani, R. (2021). An Introduction to Statistical Learning: with Applications in R (2nd ed.). Springer, New York. https://doi.org/10.1007/978-1-0716-1418-1
Cite this page
StatWiki (2026). "Supervised learning." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/supervised-learning.html
@misc{statwiki_supervised_learning,
author = {{StatWiki}},
title = {{Supervised learning}},
year = {2026},
url = {https://www.statwiki.io/articles/supervised-learning.html},
urldate = {2026-12-02},
note = {StatWiki, last updated 2 December 2026}
}