Unsupervised learning

Intermediate

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

In statistical learning, unsupervised learning is the description of how features are arranged when no outcome was recorded to score a prediction. Some tables record only the measurements. There is no column that says what the row turned out to be. Unsupervised learning is the body of methods for that table: describe how the measurements are arranged, without a response to predict.[1][2]

Unsupervised learning

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

Motivating example

Four points in the plane, (2,0)(2,0), (−2,0)(-2,0), (0,1)(0,1) and (0,−1)(0,-1), have no labels. The horizontal spreads are 22 and −2-2. The vertical spreads are 11 and −1-1. The sum of squared horizontal coordinates is 88 and the sum of squared vertical coordinates is 22, out of a total of 1010. A one-number summary that keeps the horizontal coordinate keeps 4/54/5 of that sum of squares and discards 1/51/5. Nothing in the file tells us whether the horizontal direction is the scientifically important one. The calculation only says where the points vary.[1]

Definition

Unsupervised learning, or learning without a teacher, observes x1,…,xNx_1,\ldots,x_N from a random feature vector XX and tries to infer properties of the distribution of XX. No output YY is supplied, so there is no conditional distribution of YY given XX to estimate. In low dimension the density of XX itself can be estimated. In high dimension those density estimates fail, and the practical targets are coarser: a low-dimensional set on which the points concentrate, a mixture of simpler pieces, or regions of high probability described by a simple rule.[2]

The same division can be stated with a finite sample. For each observation one sees features and no response, so a regression of a response on the features cannot be fit. Principal components represent the rows by a few coordinates of large variation. Clustering looks for subgroups. In a market study that records zip code, family income, and shopping habits, and does not record who is a large spender, the groups are a guess that the measured variables separate spenders the file does not name.[1]

Principal component directions are one unsupervised reduction. Cluster analysis is the other standard summary, through Lloyd’s K-means algorithm and hierarchical clustering. Association rules describe high-probability combinations in a table of binary items, the case in which a density estimate is hopeless and a list of frequent item sets is not.[2][1]

Interpretation

For the four points (2,0)(2,0), (−2,0)(-2,0), (0,1)(0,1) and (0,−1)(0,-1), the coordinate means are zero. The sum of squares on the first coordinate is 22+(−2)2=82^2+(-2)^2=8. The sum of squares on the second is 12+(−1)2=21^2+(-1)^2=2. The total is 1010. The horizontal fraction is 8/10=4/58/10=4/5. The vertical fraction is 2/10=1/52/10=1/5. The first principal component of these four points is the horizontal direction, because no other unit direction has a larger sum of squared scores. Keeping that coordinate is a rank-1 reconstruction whose leftover sum of squares is 22.

That fraction is the proportion of variance explained, in the sense that the variance of the leading components and the residual sum of squares of the reconstruction move in opposite directions. Maximising the variance of the retained coordinates minimises the squared error of the approximation, and the proportion of variance explained is the R2R^2 of that approximation to the centred data matrix. On the four points the retained fraction is 4/54/5 and the leftover fraction is 1/51/5.[1][2]

A clustering of the same four points would ask a different question: which rows form groups, not which direction has variance 4/54/5. The two summaries can be computed from the same coordinates and they are not substitutes. There is no training error that goes to zero by memorising a label, because no label was recorded. A procedure that always returns two clusters has not been confirmed by a held-out response. It has produced a partition.[1][2]

The direction with fraction 4/54/5 is not automatically the direction that predicts a response one might collect tomorrow. Principal components ignore any response. A low-variance coordinate can be the predictive one. A hierarchy or a partition is not validated by the fact that the algorithm returned it. With a response, cross-validation of a prediction error can check the work. Without a response there is no true answer to check against, which is why the assessment is more subjective and why so many unsupervised procedures exist side by side.[1][2]

The descriptions assume that the recorded features are the variables whose arrangement matters. A distance or a variance computed from a badly scaled feature answers a question about the units. The four-point fractions 4/54/5 and 1/51/5 would change if the vertical coordinate were multiplied by ten. Density estimation in the ambient dimension is not available once the dimension is more than a few. The move to components, clusters, or association rules is a retreat to a simpler property of the distribution, and a simpler property can be the wrong property.[2][1]

Worked example

The points (2,0)(2,0), (−2,0)(-2,0), (0,1)(0,1) and (0,−1)(0,-1) are already centred. Horizontal sum of squares: 4+4=84+4=8. Vertical sum of squares: 1+1=21+1=2. Total: 1010. The leading principal component retains the fraction 4/54/5. The second component retains 1/51/5. A reconstruction that keeps only the horizontal coordinate replaces the four points by (2,0)(2,0), (−2,0)(-2,0), (0,0)(0,0) and (0,0)(0,0), and the sum of squared reconstruction errors is 22.

Your turn. What fraction of the sum of squares sits on the vertical coordinate?

The vertical sum of squares is 22 out of 1010, so the fraction is 1/51/5.

Connections

Supervised learning is the parallel enterprise with a response. Cluster analysis collects the partition and the tree, including hierarchical clustering. Dimensionality reduction is the principal-component summary and its nonlinear relatives. Classification begins only when a class label is present to be predicted. A gene-expression matrix with no outcome column, or a shopping table with no spender label, is the setting in which these summaries are the analysis rather than a preprocessor for a later supervised fit.[1][2]

Check yourself

Try these questions before opening an answer.

No training error

Why is there no training error, of the supervised kind, that goes to zero by memorising the data in an unsupervised analysis?

No response was recorded, so there is no label to memorise and no loss on a response to drive to zero. The procedure returns a description, such as a partition or a direction.

A later response

Why might the direction that carries most of the variance fail to predict a response collected later?

Principal components ignore any response. A low-variance coordinate can be the one that predicts.

A change of units

The features are measured in arbitrary units, and one coordinate is multiplied by ten before the variances are computed. What question do the new fractions answer?

They answer a question about the units. A variance or a distance from a badly scaled feature describes the scale, not the subject.

History

The organised contrast between learning with a teacher and learning without one is the framework of the statistical-learning texts. Most of the early chapters are supervised, and the unsupervised methods are gathered once the response is dropped. Principal components and clustering are the two unsupervised tools those introductions develop for a table of features. Association rules were added for the special case of very high-dimensional binary data, where a density estimate is hopeless and a list of frequent item sets is not. The difficulty of judging the result, with no held-out response to score, is why the chapter that introduces the subject treats the assessment as harder than cross-validation of a prediction.[2][1]

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 a. (Ch. 12, §12.1, pp. 495–496) b. (Ch. 12, §12.2, pp. 497–504) c. (Ch. 2, §2.1.4, pp. 26–28; Ch. 12, §12.1, pp. 495–496) d. (Ch. 12, pp. 495–496) e. (Ch. 12, §12.2, pp. 497–504) f. (Ch. 12, §12.1, pp. 495–496) g. (Ch. 12, §12.1, pp. 495–496) h. (Ch. 12, §12.2) i. (Ch. 12, §12.1, pp. 495–496) j. (Ch. 12, §12.1, pp. 495–496) 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 i a. (pp. 485–486, §14.1) b. (pp. 485–486, §14.1) c. (pp. 486–487) d. (p. 486) e. (pp. 486–487) f. (pp. 486–487) g. (pp. 485–486) h. (pp. 485–487) i. (pp. 485–487) Hastie, T., Tibshirani, R. & Friedman, J. (2009). The Elements of Statistical Learning. Springer. https://doi.org/10.1007/978-0-387-84858-7
Cite this page
Plain text
StatWiki (2026). "Unsupervised learning." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/unsupervised-learning.html
BibTeX
@misc{statwiki_unsupervised_learning,
  author = {{StatWiki}},
  title = {{Unsupervised learning}},
  year = {2026},
  url = {https://www.statwiki.io/articles/unsupervised-learning.html},
  urldate = {2026-12-02},
  note = {StatWiki, last updated 2 December 2026}
}