I have problem in min and max normalization

59 次查看(过去 30 天)
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 个评论
Guillaume
Guillaume 2016-8-25
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
Adam 2016-8-25
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.

请先登录,再进行评论。

回答(2 个)

KSSV
KSSV 2016-8-25
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 个评论
abduall hassn
abduall hassn 2016-8-25
Dear Guillaume
Please, can you suggest me and another approach which we can show the normalization value in positive. Thank u
Adam
Adam 2016-8-25
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
KSSV 2016-8-25
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...

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

尚未输入任何标签。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by