Supervised Learning

Methods that learn from labeled examples to predict a label or a number for new ones, with the best possible prediction as the benchmark. The setup, regression and classification, the regression function and the Bayes classifier derived, and the Bayes error rate of a simulated problem computed; k-nearest neighbors with distances, scaling, the choice of k, Cover and Hart's bound and the curse of dimensionality; naive Bayes for text and for measurements; and support vector machines from the maximal margin through the dual and soft margins to kernels. Worked on the wine data, the Wisconsin breast cancer data and a simulated two-class mixture whose Bayes error rate is known.

A supervised method studies examples whose answers are known, such as wines whose grape cultivar is recorded alongside their chemistry, and produces a rule that gives the answer for new examples. This unit covers the shared setup and three classifiers built on different ideas: nearness, probability and a separating margin. Each is measured against the best prediction any method could make, so that "how good is this classifier?" has a fixed point of reference.

The unit is the applied introduction. The methods of the Regression and Decision Trees sections of the collection are supervised learning too, and the Evaluating Model Performance section supplies the tools every comparison here uses: held-out test sets, cross-validation and the bias-variance tradeoff.

Order. The overview comes first, because it defines the benchmark the other articles use. Nearest neighbors follows as the simplest method that approaches the benchmark, then naive Bayes as the generative route, then support vector machines, which leave probabilities aside.

Running data. Three datasets recur. The wine data (178 wines, 13 measurements, three cultivars) serve naive Bayes, scaling, weighted votes and multiclass machines. The Wisconsin breast cancer data (569 masses, 30 measurements) serve the soft margin and the comparison with logistic regression. A simulated two-class problem, each class a mixture of three round normal clusters, has a curved Bayes boundary and a Bayes error rate of 0.1816 that can be computed exactly. The overview, nearest neighbors and the support vector machine test their classifiers on it with the same test set and the same training sets (the support vector machine on the first 30 of the 100).

What is proved, shown and cited. Proved on the pages: the regression function as the best prediction under squared error, the Bayes classifier and the Bayes error rate as an overlap of weighted densities, the quadratic shape of the naive Bayes boundary, the median distance to the nearest point in a ball, the two-class large-sample error $2R^*(1 - R^*) - 2\operatorname{Var}(r^*)$ and its bounds given Cover and Hart's limit, and their inversion, the margin $2/\lVert w\rVert$, the separable and soft-margin duals with their Karush-Kuhn-Tucker groups, the leave-one-out bound by the fraction of support vectors, and the validity of the radial basis function kernel in any dimension. Cited: Cover and Hart's limit (the nearest neighbor's label behaving as an independent draw at the query's class probabilities) and their bound for many classes, strong duality for convex problems, the sufficiency of Mercer's condition, and the published digit experiments. Shown by the scripts in tools/experiments/data-science/: every number, including the exact error of the best straight line on the simulated problem and the split of logistic regression's excess error into the cost of a straight line and the cost of its loss.

Articles

  • Introduction to Supervised Learning: the setup of inputs, outputs and a training set; regression and classification; the regression function and the Bayes classifier derived as the best predictions under squared error and 0-1 loss; the Bayes error rate of the simulated problem, 0.1816; two routes to approximating the ideal, Gaussian naive Bayes worked by hand on a test wine, and parametric against nonparametric methods; worked problems that show what limits naive Bayes and logistic regression on the simulated problem, including the best straight line, which errs at 0.2337.
  • K-Nearest Neighbors: prediction from the most similar known cases; Euclidean and Manhattan distances on eight points; why the wine inputs must be standardized, with proline otherwise carrying 99.77% of the squared distance; $k$ as the control of flexibility, with the best average test error 0.1987 at $k = 21$; Cover and Hart's bound of $2R^*(1 - R^*)$ derived from their cited large-sample limit and checked by simulation; the curse of dimensionality computed four ways; and distance-weighted votes, with the arithmetic of why 101 neighbors lose the smallest cultivar.
  • Naive Bayes Classification (an Academics article of the information retrieval course): the multinomial model for text derived as maximum likelihood with add-one smoothing as a posterior mean, computed in log space, shown to be a linear classifier and worked on Reuters stories. The overview above works the Gaussian version for measurements, and its companion article covers the Bernoulli model.
  • Support Vector Machines: classification by the widest margin; the maximal margin classifier solved by hand on eight points; the Lagrangian dual and its support vectors; the soft margin and the cost $C$ traced on breast cancer data; the equivalence with hinge loss plus a penalty; the kernel trick checked for polynomial and radial basis kernels; kernels on the simulated problem, where degree 3 and the radial basis function come within about two to three points of the Bayes rate; and worked problems that derive the soft-margin dual and show that the hinge loss, not the tuning, makes a linear machine beat logistic regression there.

Where the site goes deeper

The Statistics collection holds the theory beneath these pages. Statistical Learning Theory proves when a training error can be trusted, from Empirical Risk Minimization, which proves the Bayes classifier optimal and treats surrogate losses such as the hinge, through The VC Dimension to the margin bounds of Rademacher Complexity. Prediction Error and Model Choice proves what cross-validation estimates, which is how $k$, $C$ and $\gamma$ are chosen here. Multivariate Statistics derives linear and quadratic discriminant analysis, the generative classifiers with normal classes, and fits Gaussian mixture models, the model whose fit comes within 0.009 of the simulated problem's Bayes error rate.

The Academics section's Text Classification topic applies the same classifiers to documents: Vector Space Classification treats nearest neighbors with cosine similarity and the support vector machine among linear text classifiers. Vector search covers nearest-neighbor search at scale.

Several subjects these pages touch would support fuller treatment in a later collection on machine learning: convex optimization and duality, kernel methods and reproducing kernel Hilbert spaces, learning from imbalanced or noisy labels, and metric learning for nearest neighbors.

References

Each article lists its own references. The sources the unit draws on throughout: record · 4 pages

  • Cortes, C., and Vapnik, V. (1995). Support-vector networks. Machine Learning, 20(3), 273–297. record · 4 pages
  • Cover, T. M., and Hart, P. E. (1967). Nearest neighbor pattern classification. IEEE Transactions on Information Theory, 13(1), 21–27. record · 3 pages
  • Hastie, T., Tibshirani, R., and Friedman, J. (2009). The Elements of Statistical Learning: Data Mining, Inference, and Prediction (2nd ed.). Springer. Chapters 2, 12 and 13. record · 39 pages
  • James, G., Witten, D., Hastie, T., and Tibshirani, R. (2021). An Introduction to Statistical Learning with Applications in R (2nd ed.). Springer. Chapters 2, 4 and 9. record · 39 pages