Artificial Neural Network's input NORMALIZATION

4 views (last 30 days)
hi every one,
I have a question regarding the normalization of kind of data I have. I have two sets of data to the ANN, training data and testing data. Both of them are having 5 data points at each input.
Training data looks like:
4.04174435161 0.00572348 -0.0153630110827 0.602838009364 -2.36559733245
3.03056109866 0.0662695 -0.0533391771878 0.55923481044 -1.91116449019
2.52071323312 0.121233 0.260306969065 0.467349509343 -1.70735726533
Testing set looks like:
2.33842672041 -0.137656 -0.0597465187944 0.448352030836 -1.00431677993
3.96620615784 0.0438668 0.219515113659 0.596424503954 -2.0851352013
1.99407739363 0.100512 0.360384341206 0.385154801184 -1.18594026984
I would like to know the way to normalize these inputs before feeding to the ANN.
Cheers Mahdi

Answers (1)

Hoda abuzied
Hoda abuzied on 25 Sep 2011
hi, mahdi you can normalize any data before feeding them to the network by using mapminmax command...it normalizes data so that they would fall in the range of -1 & 1(defaults values)...to do this follow the steps below:
>> i_p_data=[4.04174435161 0.00572348 -0.0153630110827 0.602838009364 -2.36559733245;
3.03056109866 0.0662695 -0.0533391771878 0.55923481044 -1.91116449019;
2.52071323312 0.121233 0.260306969065 0.467349509343 -1.70735726533]; % i just put your data in a vector and gave it a name for simplicity.
>> [nomalized_i_p,ps1]=mapminmax(i_p_data);
>> test_data=[2.33842672041 -0.137656 -0.0597465187944 0.448352030836 -1.00431677993;
3.96620615784 0.0438668 0.219515113659 0.596424503954 -2.0851352013;
1.99407739363 0.100512 0.360384341206 0.385154801184 -1.18594026984];
>>[normalized_test,ps2]=mapminmax(test_data);
>> however, if you want to set them back to their original values i.e. denormalize them :
>> training_data=mapminmax('reverse',normalized_i_p,'ps1');
>> test_data1=mapminmax('reverse',normalized_test,'ps2');
you might also, want to check this for further details
i hope this was helpful.
yours,
hoda
  2 Comments
Walter Roberson
Walter Roberson on 25 Sep 2011
The documentation suggests that 'ps1' and 'ps2' should not be quoted in the reverse mapping call ?
primrose khaleed
primrose khaleed on 18 Jun 2014
hi ...i used this method to normlization the input and testing data in neural network...but when apply this method the testing data dont change..why??? plz help me

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!