# VC dimension

In statistical learning theory and computational learning theory, the VC dimension (for Vapnik–Chervonenkis dimension) is a measure of the capacity (complexity, expressive power, richness, or flexibility) of a space of functions that can be learned by a statistical classification algorithm. It is defined as the cardinality of the largest set of points that the algorithm can shatter. It is a core concept in Vapnik–Chervonenkis theory, and was originally defined by Vladimir Vapnik and Alexey Chervonenkis.

Informally, the capacity of a classification model is related to how complicated it can be. For example, consider the thresholding of a high-degree polynomial: if the polynomial evaluates above zero, that point is classified as positive, otherwise as negative. A high-degree polynomial can be wiggly, so it can fit a given set of training points well. But one can expect that the classifier will make errors on other points, because it is too wiggly. Such a polynomial has a high capacity. A much simpler alternative is to threshold a linear function. This function may not fit the training set well, because it has a low capacity. This notion of capacity is made rigorous below.

## Shattering

A classification model ${\displaystyle f}$ with some parameter vector ${\displaystyle \theta }$ is said to shatter a set of data points ${\displaystyle (x_{1},x_{2},\ldots ,x_{n})}$ if, for all assignments of labels to those points, there exists a ${\displaystyle \theta }$ such that the model ${\displaystyle f}$ makes no errors when evaluating that set of data points.

The VC dimension of a model ${\displaystyle f}$ is the maximum number of points that can be arranged so that ${\displaystyle f}$ shatters them. More formally, it is the maximum integer ${\displaystyle D}$ such that some data point set of cardinality ${\displaystyle D}$ can be shattered by ${\displaystyle f}$.

For example, consider a straight line as the classification model: the model used by a perceptron. The line should separate positive data points from negative data points. There exist sets of 3 points that can indeed be shattered using this model (any 3 points that are not collinear can be shattered). However, no set of 4 points can be shattered: by Radon's theorem, any four points can be partitioned into two subsets with intersecting convex hulls, so it is not possible to separate one of these two subsets from the other. Thus, the VC dimension of this particular classifier is 3. It is important to remember that while one can choose any arrangement of points, the arrangement of those points cannot change when attempting to shatter for some label assignment. Note, only 3 of the 23 = 8 possible label assignments are shown for the three points.

 3 points shattered 4 points impossible

## Uses

### In statistical learning theory

The VC dimension can predict a probabilistic upper bound on the test error of a classification model. Vapnik [1] proved that the probability of the test error distancing from an upper bound (on data that is drawn i.i.d. from the same distribution as the training set) is given by:

${\displaystyle \Pr \left({\text{test error}}\leqslant {\text{training error}}+{\sqrt {{\frac {1}{N}}\left[D\left(\log \left({\tfrac {2N}{D}}\right)+1\right)-\log \left({\tfrac {\eta }{4}}\right)\right]}}\right)=1-\eta ,}$

where ${\displaystyle D}$ is the VC dimension of the classification model, ${\displaystyle 0\leqslant \eta \leqslant 1}$, and ${\displaystyle N}$ is the size of the training set (restriction: this formula is valid when ${\displaystyle D\ll N}$. When ${\displaystyle D}$ is larger, the test-error may be much higher than the training-error. This is due to overfitting).

The VC dimension also appears in sample complexity#bounds. A space of binary functions with VC dimension D can be learned with:

${\displaystyle N=\Theta \left({\frac {D+\ln {1 \over \delta }}{\epsilon }}\right)}$

samples, where ${\displaystyle \epsilon }$ is the learning error and ${\displaystyle \delta }$ is the failure probability. Thus, the sample-complexity is a linear function of the VC dimension of the hypothesis space.

### In computational geometry

The VC dimension is one of the critical parameters in the size of ε-nets, which determines the complexity of approximation algorithms based on them; range sets without finite VC dimension may not have finite ε-nets at all.

## Generalizations

The VC dimension is defined for spaces of binary functions (functions to {0,1}). Several generalizations have been suggested for spaces of non-binary functions.

• For multi-valued functions (functions to {0,...,n}), the Natarajan dimension[2] can be used. Ben David et al[3] present a generalization of this concept.
• For real-valued functions (e.g. functions to a real interval, [0,1]), Pollard's pseudo-dimension[4][5][6] can be used.
• The Rademacher complexity provides similar bounds to the VC, and can sometimes provide more insight than VC dimension calculations into such statistical methods such as those using kernels.

## References

1. ^ Vapnik, Vladimir. The nature of statistical learning theory. springer, 2000.
2. ^ Natarajan, B. K. (1989). "On learning sets and functions". Machine Learning. 4: 67. doi:10.1007/BF00114804.
3. ^ Ben-David, Shai; Cesa-Bianchi, Nicolò; Long, Philip M. (1992). "Characterizations of learnability for classes of {O, …, n}-valued functions". Proceedings of the fifth annual workshop on Computational learning theory - COLT '92. p. 333. doi:10.1145/130385.130423. ISBN 089791497X.
4. ^ . ISBN 9781461252542. Missing or empty |title= (help)
5. ^ . ISBN 9780521118620. Missing or empty |title= (help)
6. ^
• Andrew Moore's VC dimension tutorial
• Vapnik, Vladimir. "The nature of statistical learning theory". springer, 2000.
• V. Vapnik and A. Chervonenkis. "On the uniform convergence of relative frequencies of events to their probabilities." Theory of Probability and its Applications, 16(2):264–280, 1971.
• A. Blumer, A. Ehrenfeucht, D. Haussler, and M. K. Warmuth. "Learnability and the Vapnik–Chervonenkis dimension." Journal of the ACM, 36(4):929–865, 1989.
• Christopher Burges Tutorial on SVMs for Pattern Recognition (containing information also for VC dimension) [1]
• Bernard Chazelle. "The Discrepancy Method." [2]
• B.K. Natarajan. "On Learning sets and functions." Machine Learning, 4, 67-97, 1989. [3]