# normalizing data for neural network

I'm working on a neural network with back propagation for indoor localization. The input of the neural network is Received Signal Strengths (RSSs) and the output is a coordinate (x,y). I have normalized the input and output for training.

I used this equation for normalization:

normalized value = minOfNormalizedScale+(old value- minOfPreviousScale)(maxOfNewScale- minOfNormalizedScale)/(maxOfPreviousScale – minOfPreviousScale).


the new space is [0,1] the old space depends of the recorded values of RSSs , x , and y.

For localization process I need the error of the neural network to be measure in meters. How can I de-normalize the result of the neural network( the coordinates)?.

I tried using this equation:

old value= normalized value*(maxOfOldScale-minOfOldScale)+minOfOldScale +.


is it correct?

In theory, you don't need to normalise your inputs as this is anyway done by the activation function. In practice, however, it's very useful to normalise both input and output tensors for training and testing in the ranges [0,1] or [-1,1] (for regression). After normalisation, you need to back-transform your output in order to make "predictions" on unseen data.

If you want to monitor the error in metres during the training phase then you must use a function to untransform (as you did already).

• Neural networks work much better when inputs are in the range [-1, 1] though. Letting the activation function do it can lead to huge saturation if the inputs standard deviation is outside 1 Mar 22, 2016 at 22:26
• Yes it can boost training performance and it will look better in cross-validation but it is not always a good idea when you need to use that trained model on unseen data, so I would say it highly depends on the data. Jul 11, 2017 at 9:49

I don't fully understand your formulas, but you definitely should normalize your inputs; otherwise you will run into convergence and performance issues in training your neural networks.

If you want to scale inputs and observational data to the scale [0,1], you can use the following:

$$\underline y_{norm} = (\underline y - y_{min})/(y_{max}-y_{min})$$

To perform the inverse transformation, just invert that formula.

$$\underline y = \underline y_{norm}(y_{max}-y_{min})+ y_{min}$$

You can also scale to [-1,1] if you replace $$(\underline y - y_{min})$$ with $$(\underline y - \bar y)$$ in the first equation.

Not sure which language you work in, but here is an example in R for scaling the data. http://datascienceplus.com/fitting-neural-network-in-r/

Hope that helps!

• Obviously normalisation can boost performance in many cases but claiming that normalisation is necessary for the algorithm to work is plainly wrong. Also, in industrial applications, if one is planning to use the trained model on unseen data then it is much safer to avoid normalisation and use the raw data. The range of values in data is not the same in all samples so when you assume that your training set represents the entire population then you're bound to overfit and fail. Jul 11, 2017 at 9:47
• Neural network models in general tend to fail when they extrapolate for data outside of the trained range, that is not unique to normalization. The need for normalization also depends on the raw ranges of input data, and is definitely not necessary but generally good practice in my opinion.
– Rob
Jul 12, 2017 at 14:04