The curse of dimensionality
10 questions on exponential growth of grid cells, polynomial coefficients, empty cells, shells of volume in high dimensions and where more dimensions help.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
A grid divides each input variable into 10 intervals. How many cells are there for 3 input variables?
- 30
- 100
- 1,000
Sample 2
The number of coefficients of a polynomial model of order 3 grows roughly with the cube of the number of variables. About how many times more coefficients would you expect if the number of variables doubles?
- About eight times as many
- About twice as many
- About the same number
How it works
- One question per screen. An answer is final once sent.
- You see right away whether you were right, with a short explanation.
- The stopwatch runs: on equal scores, the faster player ranks first.
- Only your best attempt counts, so replaying is never risky.
About this quiz
A data scientist who has built a model on two or three input variables often feels that adding more can only help: more information, more accuracy. For some methods the opposite happens. The number of cases needed to support the model explodes, simple pictures of how data are arranged stop working, and the method that was a joy with three variables becomes unusable with thirty. Richard Bellman called this the curse of dimensionality, and it is one of the main reasons that machine learning needed new ideas, and in particular neural networks, to handle realistic data such as images and text.
This quiz makes the curse concrete with two simple examples. The first is a polynomial model: as the number of input variables grows, the number of coefficients grows with it, and much faster for higher orders. The second is a cell-based classifier that cuts the input space into a regular grid and takes a vote in the cell of a new point. You will count the cells, see what happens when most of them contain no data at all, and work out how much more data you would need for every additional variable. The numbers are chosen so that you can calculate them in your head.
The second half goes deeper, into the geometry of spaces with many dimensions, where everyday intuition fails. In such spaces, nearly all the volume of a ball lies in a thin skin near its surface, and the probability mass of a bell-shaped Gaussian sits in a thin shell far away from its centre and not around the peak. You will see what those facts imply, and you will also see the other side of the coin: extra dimensions can make a problem easier, because classes that overlap along a single variable can be cleanly separable once a second one is added.
Typical misconceptions are that more variables are always better, that the problem is only about computing time and not about data, and that three-dimensional intuition is a reliable guide. The cure, as the next quiz in this series explains, is to stop choosing the building blocks of the model without looking at the data. A useful habit that follows from the quiz is to ask, whenever a method claims to work with hundreds of features, how it avoids having to cover the whole space, and how much data it would really need. Methods that have a convincing answer to that question are the ones that scale.
The quiz suits students and practitioners who work with many features. It needs only simple arithmetic. There are 10 questions, each with an explanation shown after you answer, and the quiz takes about four minutes.
Questions and answers
›How long does the quiz take?
About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation appears after every answer.
›Do I need to know geometry in many dimensions?
No. The quiz asks you to reason from the counting examples and from the statement of a few geometric facts. The explanations use words and small numbers, never formulas, and you aren't expected to picture more than three dimensions.
›What is the curse of dimensionality?
It is the collective name for the difficulties that arise as the number of variables in a problem grows. Methods that treat every region of the input space separately need an amount of data that grows exponentially, and geometric intuitions from two and three dimensions mislead. It is a general problem, not specific to one algorithm.
›Why does the number of cells in a grid grow so quickly?
Each new variable multiplies the number of cells by the number of divisions along that variable. Ten divisions in each of two variables give a hundred cells, and in each of six variables they give a million. Having at least a few data points in each cell would then need an enormous data set.
›How do polynomial models suffer from it?
A polynomial of a given order has a number of coefficients that grows as the number of variables raised to the power of that order. Moderate orders and a few dozen variables already produce huge numbers of coefficients, which are costly to store and need a great deal of data to fit.
›Why does most of the volume of a high-dimensional ball lie near its surface?
Volume grows with the radius raised to the power of the number of dimensions. In many dimensions even a small reduction of the radius removes most of the volume, which means that most of it must lie in a thin outer layer. The same effect makes typical points of a Gaussian lie far from its centre.
›Are extra dimensions always bad?
No. Extra variables can make a problem easier when they carry information that separates the classes, for example when two classes overlap along one variable but are cleanly apart along two. The curse applies to methods that must cover the whole space, not to the extra information itself.
›How is the curse overcome in practice?
By not trying to cover the whole space. Real data usually occupy a small part of it, so methods that adapt their building blocks to the data, such as neural networks, can work well in thousands or millions of dimensions. That is the theme of the next quizzes in this series. A rule of thumb that comes from all this is that the amount of data should grow much faster than the number of variables. If you must add variables, add ones that carry new information, and consider reducing the number of dimensions before modelling.