I have problem in min and max normalization

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 commentaires

Guillaume
Guillaume le 25 Août 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
Adam le 25 Août 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.

Connectez-vous pour commenter.

Réponses (2)

KSSV
KSSV le 25 Août 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 commentaires

ni = (pi-min(p))/(max(p)-min(p))
and
n = (p-min(p))./(max(p)-min(p)) ;
It is giving same results
My problem! why the value of 1 after normalization it become 0?
I dnt like to be 0
Thank u
if true
% code
end
Guillaume
Guillaume le 25 Août 2016
@Siva, Since the division is with a scalar, using / or ./ won't make a iota of difference.
@Abduall, if you don't like 1 to become 0, then don't do min/max normalisation!
You are asking to rescale the values in your array so that the minimum value (1 in your case) becomes 0 and the maximum becomes 1, so don't be surprised when that's what happen. If you don't like it, then ask for something else.
abduall hassn
abduall hassn le 25 Août 2016
Dear Guillaume
Please, can you suggest me and another approach which we can show the normalization value in positive. Thank u
Adam
Adam le 25 Août 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.

Connectez-vous pour commenter.

KSSV
KSSV le 25 Août 2016

0 votes

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...

Produits

Tags

Aucun tag saisi pour le moment.

Commenté :

le 25 Août 2016

Community Treasure Hunt

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

Start Hunting!

Translated by