Input normalisation: putting features on the same scale
10 questions on rescaling inputs to zero mean and unit variance, why different ranges slow training, and how to treat validation and test data.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
An input has a mean of 50 and a standard deviation of 10 over the training data. What is the normalised value of a raw value of 70?
- 2
- 20
- 7
Sample 2
A team normalises its training set with the training set's mean and standard deviation, then normalises the test set using the test set's own mean and standard deviation. What is wrong?
- The test inputs end up scaled differently from the data the model learned on; the same training constants should be used
- Nothing, since each set should be standardised separately
- The test set is too small to have a mean
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 model that predicts whether a loan will be repaid is given two numbers for each applicant: their age, somewhere between twenty and eighty, and their annual income, somewhere between twenty thousand and a few hundred thousand. Nothing in the data is wrong, yet training such a model tends to be slow and fussy. The reason is not mysterious. A tiny change to the weight that multiplies income moves the prediction a great deal, while the same change to the weight for age barely registers. The error surface becomes a canyon, and gradient descent, as other quizzes show, struggles in canyons.
Input normalisation is the simplest cure, and arguably the cheapest piece of engineering in the whole field. Before training starts, each input variable is shifted and rescaled so that all of them occupy similar ranges. This quiz walks through what that means, why it helps and how to do it properly. You will convert a raw value into its standardised form, work out what happens when the recipe is applied carelessly, and compare this one-off step with the more elaborate normalisation applied to the hidden layers of a deep network.
The questions are practical. Which statistics have to be computed and from which data? When are they computed? What should be done with the validation and test sets, which a team may hold back and look at only later? What exactly changes on the error surface when the scales match? The answers are short, but getting any of them wrong quietly damages results, often without an error message.
Frequent mistakes include treating the held-back data differently from the training data, and forgetting that the same transformation has to be applied whenever the model is later used on new cases. Another is to assume the network can simply learn to cope with the scale, which it can in principle but not necessarily in the time you have. In practice, normalisation can be the difference between a model that trains smoothly and one that needs endless tuning. It is also a good illustration of a wider lesson: a bit of care in preparing the data often delivers more than a more sophisticated optimiser, and it costs almost nothing to do.
The quiz suits beginners who are about to train their first model on real tabular data, and experienced practitioners who want to tidy up their mental model. There are 10 questions, each with an explanation, and it 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. After every answer you see an explanation, so you can learn from each question.
›Do I need to know any statistics?
Only what a mean and a standard deviation are, and the quiz recalls them in the questions. If you can subtract a number and divide by another, you can do all the arithmetic involved. Knowing roughly what gradient descent does is useful, since the benefit of normalisation shows up in how well it behaves, but it is not required to answer the questions.
›What is input normalisation?
It is a preprocessing step in which each input variable is rescaled so that, over the training data, it has an average of zero and a variance of one. You subtract the variable's average and divide by its standard deviation. After that, a variable measured in tiny units and one measured in huge units are expressed on a comparable footing, and no single input dominates the early steps of training.
›Why do different input ranges make training harder?
Because the weight attached to a large-valued input has a much bigger effect on the output, and so on the error, than the weight attached to a small-valued one. That gives the error surface very different curvature along different weight directions, which is exactly the elongated valley in which gradient descent zig-zags and a safe learning rate is dictated by the steepest direction.
›When are the mean and standard deviation computed?
They are computed once, before any training begins, from the data you are training on. They are not changed afterwards, and they are not learnt by the network. This is one of the main differences from the normalisation applied inside the network between layers, which has to be repeated as the weights change.
›Does it apply to every kind of input?
It is designed for continuous variables, such as measurements, amounts or durations, whose values can live on very different scales. Categorical inputs are usually represented differently, and images or text have their own conventions, so the discussion here concerns numerical features. A variable that is already small and centred gains little from the step, though applying it does no harm, which is why many practitioners simply standardise every numerical column as a routine habit.
›Is input normalisation the same as batch normalisation?
No. They share the idea of rescaling to zero mean and unit variance, but input normalisation is a single fixed transformation of the data, while batch normalisation acts on hidden layers, is repeated during training for every mini-batch and has adjustable parameters. Each has its own quiz, and the contrast between them is a useful thing to understand.
›Can the network just learn to compensate for badly scaled inputs?
In principle the weights can adapt to whatever ranges the inputs have. In practice the adaptation is slow and the optimisation is far more delicate, so rescaling can make the difference between a run that works and one that doesn't. Since the preparation is so cheap, there is little reason to skip it.