Decimal Point Normalization in Python
09:52 24 Oct 2018

I am trying to apply normalization to my data and I have tried the Conventional scaling techniques using sklearn packages readily available for this kind of requirement. However, I am looking to implement something called Decimal scaling.

I read about it in this research paper and looks like a technique which can improve results of a neural network regression. As per my understanding, this is what I believe needs to be done -

  • Suppose the range of attribute X is −4856 to 28. The maximum absolute value of X is 4856.
  • To normalize by decimal scaling I will need to divide each value by 10000 (c = 4). In this case, −4856 becomes −0.4856 while 28 becomes 0.0028.
  • So for all values: new value = old value/ 10^c

How can I reproduce this as a function in Python so as to normalize all the features(column by column) in my data set?

Input:
A      B    C
30    90    75
56   168    140
28    84        70
369  1107   922.5
485  1455   1212.5
4856 14568  12140
40    120   100
56    168   140
45    135   112.5
78    234   195
899  2697   2247.5

Output:
A       B       C
0.003   0.0009  0.0075
0.0056  0.00168 0.014
0.0028  0.00084 0.007
0.0369  0.01107 0.09225
0.0485  0.01455 0.12125
0.4856  0.14568 1.214
0.004   0.0012  0.01
0.0056  0.00168 0.014
0.0045  0.00135 0.01125
0.0078  0.00234 0.0195
0.0899  0.02697 0.22475
python-3.x