# How do I standarize input data for a neural network?

Currently, I designed a neural network with one hidden layer, with cross entropy cost function and softmax activation function to predict the outcome of a tennis game.

The input is a matrix, where each row is a training data, each column is a variable.

These features are having very different units. For numerical, we have ages, weight, height, international ranking, historical head-to-head winning ratio.

We have indicator variable: Injury

We have categorical variable (one hot encoding): Fatigue, nationalities.

I haven't tried to feed the neural my input data yet. I'm still processing my data.

Now, it comes to me that my input data for each training case having very different variables; I'm wondering what is a good way of standardizing this input?

You should always standarize all your training data the same way. You have to treat the data equally. The one hot encoding for fatigue and nationalities is fine.

For numerical values like ages, weight and height you have to choose a maximum. You can either take the maximum age/weight/height of your training data, or you can choose a number that you think will never be reached but is not too big in comparison to the training data (e.g. max height: 2,50m).

Then you divide every age/weight/height by that value:

normalizedWeight = weight / maximumWeight; // returns number between 0 and 1


To answer your comment: Well the reason you are normalizing your data is just to get it between the range of 0 and 1. Binary data is already normalised. And one-hot-encoding, you also normalise it.

Also, I do not recommend using the difference. I know, this creates less inputs, but it also throws away crucial data. For example

• The age difference between 15-21 = 6
• The age difference between 21-27 = 6

But you will know that someone who is 15 years old has a higher chance of losing from someone who is 6 years olders than a 21 year old (due to lacking experience). Although the weight and length of a 15 year old might be similar to a 21 year old.

You should input the data of both players, and let the network figure out how to use that data. Don't prepocess the data too much.

• thanks for the reply; so right now; since I have two player A and B in a match; I'm thinking using the stats differences; for example; for age variable, I use the age difference between A and B, for international ranking, I use the ranking difference between A and B; So I use the difference divided by the max value of that variable. But can you explain why for injury(binary 0 and 1), and other one-hot-encoding, we can simply have them unchanged? – ElleryL May 15 '17 at 15:04
• @ElleryL I updated my answer – Thomas W May 15 '17 at 15:31