Classification

Intermediate

What you need first. Nothing else on this path comes first. This page is part of Statistical learning.

In statistical learning, classification is the prediction of a qualitative response from features, by assigning each case to a class. A digit on an envelope, a decision to treat, or a message marked as junk ends as a label. The features that lead to the label are measured; the label itself is one of a finite list. Classification is the statistical problem of using those features to assign the label, and of saying how often a new case will be assigned the wrong one.[1] [2]

Classification

Classification
Fact Value
Topic Statistical learning
Listed on Statistical learning
Worked example 1

Motivating example

A mailbox study records, for each message, how often selected words appear, together with the label email or spam. The label is known for the messages already filed. The working rule has to give a label to a message that has not been filed yet. One candidate looks at two frequencies. Another uses a weighted difference of the same two shares and compares it with zero. Both rules are classifiers. They differ in which messages they will mark, and the comparison that matters is the mark on a later message, not the mark on a message that was used to invent the rule.[2] [1]

At one feature value the three class probabilities might be 7/107/10, 1/51/5 and 1/101/10. They sum to 11. Any rule announced at that value is wrong with the probability of the classes it does not name. The overlap is already in the probabilities. A cleverer threshold cannot remove it.

Intuition

Given the features, each class has a conditional probability. When every mistake counts the same, the class with the largest probability is the best single guess. The probability of being wrong is then whatever probability is left over. Estimating those probabilities, or estimating a boundary that picks the same class, is the practical problem. A rule that only rearranges the cases already labelled has not yet faced that leftover probability.[2] [1]

Definition

A response is qualitative, or categorical, when it takes values in a finite set of classes. Classification is the task of predicting that response from features. Assigning the predicted class is called classifying the case. Many classifiers first estimate the probability of each class and only then pick a label. In that respect they also behave like regression methods.[1]

The naming follows the response, not the features. A quantitative response is a regression problem. A qualitative response is a classification problem. Logistic regression is the usual model for a binary qualitative response: despite the word regression in its name, it is a classification method, because the quantity it models is a class probability. The same method can be read as a regression for that probability. Features may themselves be quantitative or qualitative. After qualitative features are coded, most of the same fitting ideas apply.[1]

Write GG for the class and pk(x)=Pr⁡(G=k∣X=x)p_k(x)=\Pr(G=k\mid X=x). A classifier is a map from xx to a class. Under equal misclassification costs the Bayes classifier selects

k⋆(x)=argmax⁡kpk(x).k^\star(x)=\operatorname{argmax}_k p_k(x).

With the 00–11 loss, that choice minimises the conditional expected loss, which is 1−pk⋆(x)1-p_{k^\star}(x). Every other class ℓ\ell has conditional expected loss 1−pℓ(x)1-p_\ell(x), which is at least as large, because pk⋆(x)≥pℓ(x)p_{k^\star}(x)\ge p_\ell(x).[2]

At probabilities 7/107/10, 1/51/5 and 1/101/10, the maximum is 7/107/10 and the Bayes error is 3/103/10. Announcing the class whose probability is 1/51/5 has error 4/54/5. At probabilities 11/2011/20 and 9/209/20, the Bayes error is 9/209/20. The probabilities in each example sum to 11, so these errors are the overlap of the classes at that xx.

A wider traditional use of the same word covers any grouping of similar objects, and it splits that activity into a description of groups and a prediction that leads to an action. The grouping methods that do not use a response are cluster analysis. The prediction case is the problem above.[3]

Statistical use

Binary logistic regression models the log odds of a binary class and classifies by the estimated probability. Linear discriminant analysis classifies with class means and a shared within-class covariance, which yields linear boundaries. Nearest neighbours classifies by the labels of nearby cases, and a decision tree classifies by a sequence of splits. Logistic regression, linear and quadratic discriminant analysis, naive Bayes, and nearest neighbours are the usual first list of classifiers.[1]

The probabilities are often the object of interest, not only the label. A screening rule can report the estimated chance of the event and let a later threshold reflect the cost of a false alarm. When one mistake is more costly than another, the probability ordering is no longer the right ordering: the 00–11 loss that produces the Bayes classifier has been replaced. Squared error on a coded label is a poor substitute for the class probability, because a good ranking of classes can coexist with badly calibrated probabilities.[2] [1]

The cases used to build the rule are the training set. A low error there does not answer the question asked of a new case. Cross-validation and a held-out sample estimate that later error. When the largest probability is 7/107/10, every classifier has conditional error at least 3/103/10 at that xx. A larger sample can improve the estimate of 7/107/10. It cannot make the overlap itself disappear.[1] [2]

Worked example

At one feature value the three class probabilities are 7/107/10, 1/51/5 and 1/101/10. They sum to 11. The largest is 7/107/10, so the Bayes classifier returns the first class, and the conditional error is 1−7/10=3/101-7/10=3/10. Returning the second class instead has conditional error 1−1/5=4/51-1/5=4/5. The gap 4/5−3/10=1/24/5-3/10=1/2 is the extra error from ignoring the ordering of the probabilities.

Your turn. Two classes have probabilities 11/2011/20 and 9/209/20. What is the conditional error of the Bayes classifier?

The larger probability is 11/2011/20, so the conditional error is 1−11/20=9/201-11/20=9/20.

Common misconceptions

Grouping unlabelled points into similar bundles is not this problem. That activity is cluster analysis. A tradition that uses one word for both activities still separates a prediction case, in which the grouping is supposed to support an action, from a description of the groups.[3]

The name logistic regression does not move the binary problem out of classification. The fitted object is a class probability, and the label is read off that probability.[1]

A rule that matches every training label can still have conditional error 3/103/10 at a new xx whose class probabilities are 7/107/10, 1/51/5 and 1/101/10. The training match and the conditional error are answers to different questions.[2]

Predicting a qualitative survival, or a rise and fall, was approached by linear discriminant analysis and by logistic regression well before trees and nearest neighbours became practical. Those later rules are further classifiers. They do not change the definition: the response is still a class.[1]

Connections

Classification is the qualitative half of supervised learning. The quantitative half is regression, as in simple linear regression. The Bayes classifier is the probability rule above, and it is the rule that minimises 00–11 conditional risk. Unsupervised learning has the features and no class label. Cluster analysis is the grouping task that is often confused with classification when the labels are absent.[1] [2] [3]

The wider language of grouping similar objects is much older than the qualitative-response problem, and its probability-based branch was already called discriminating analysis. The prediction case, as against a mere description of groups, is the line that runs into the qualitative-response problem: a finite label, features, and an error that is the probability left over after the best label.[3]

Check yourself

Try these questions before opening an answer.

Equal costs

The Bayes classifier picks the class with the largest conditional probability when every mistake has the same cost. If missing one class is much more costly than missing another, does that same ordering still pick the action?

No. The probability ordering is the right ordering only under equal misclassification costs. A higher cost on one mistake can make a less probable class the better announcement.

Training match

A rule labels every training case correctly. What does that match say about the conditional error at a new feature value where the classes still overlap?

Nothing that removes the overlap. The conditional error at the new value is the probability left over after the best label, and a perfect training match is an answer to a different question.

Logistic regression

Why is logistic regression a classification method even though its name says regression?

The response is qualitative. The fitted object is a class probability, and the label is read off that probability.

See also

Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability

Glossary and index

References

  1. ^ a b c d e f g h i j k a. (Ch. 4, p. 129) b. (Ch. 2, pp. 28–29) c. (Ch. 2, pp. 28–29) d. (Ch. 4, p. 129) e. (Ch. 2, pp. 28–29) f. (Ch. 4, p. 129) g. (Ch. 4, p. 129) h. (Ch. 2, pp. 28–29) i. (Ch. 2, pp. 28–29) j. (Ch. 4, p. 129) k. (Ch. 2, 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
  2. ^ a b c d e f g h a. (pp. 21–22, (2.23)) b. (pp. 21–22) c. (pp. 21–22, (2.23)) d. (pp. 21–22, (2.22)–(2.23)) e. (pp. 21–22) f. (pp. 21–22, (2.23)) g. (pp. 21–22, (2.23)) h. (pp. 21–22) Hastie, T., Tibshirani, R. & Friedman, J. (2009). The Elements of Statistical Learning. Springer. https://doi.org/10.1007/978-0-387-84858-7
  3. ^ a b c d a. (pp. 82–83) b. (pp. 82–83) c. (pp. 82–83) d. (pp. 82–83) Dodge, Yadolah (2008). The Concise Encyclopedia of Statistics. Springer. https://doi.org/10.1007/978-0-387-32833-1
Cite this page
Plain text
StatWiki (2026). "Classification." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/classification.html
BibTeX
@misc{statwiki_classification,
  author = {{StatWiki}},
  title = {{Classification}},
  year = {2026},
  url = {https://www.statwiki.io/articles/classification.html},
  urldate = {2026-12-02},
  note = {StatWiki, last updated 2 December 2026}
}