I have problem in min and max normalization
46 views (last 30 days)
Show older comments
p=[148
249
357
547
854
1
1184
996
966
679
586
503
281
1
110
89
58
68
28
19
16
6
13
7
4
2
1
12]
I used min and max normalization this code
mindata = min(min(P));
maxdata = max(max(P));
normalised = ((P-mindata)/((maxdata)-mindata));
display(normalised);
In my data i has value of 1 when i applied this approach the value of one normalized as 0 idnt like to be 0. idnt know this code is correct. I want the normalization between 0 and 1
How i can solve this problem?
2 Comments
Guillaume
on 25 Aug 2016
min/max normalisation is rescaling the values in your array so that the minimum value (1 in your case) becomes 0 and the maximum becomes 1.
If you don't like it, then don't do it or do something else (or come up with your own maths: that's math for you, if you subtract 1 from 1, you get 0).
Adam
on 25 Aug 2016
If you want 1 to map to something positive then you can just get rid of the min part of the maths and assume the min of your data is 0. But on arbitrary data that will potentially leave a significant portion of your 0-1 output range unused and the data squashed into the rest of it.
Answers (2)
KSSV
on 25 Aug 2016
clc; clear all ;
p=[148 249 357 547 854 1 1184 996 966 679 586 503 281 1 110 89 58 68 28 19 16 6 13 7 4 2 1 12] ;
n = (p-min(p))./(max(p)-min(p)) ; % normalizing the data p
I have used:
ni = (pi-min(p))/(max(p)-min(p))
4 Comments
Adam
on 25 Aug 2016
What do you want 1 to be? It is easy to come up with a mathematical formula if you know what you want your min and max values to map to and you know you want a linear scaling.
KSSV
on 25 Aug 2016
Dear friend....
Just think... minimum value in p is 1...if you subtract p with min(p), wont it be zero?
By the way ni = (pi-min(p))/(max(p)-min(p)) is to show up for one element...and n = (p-min(p))/(max(p)-min(p)) this is for complete array...
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!