Effacer les filtres
Effacer les filtres

How do i denormalize the data after i have used the "normalize" function?

108 vues (au cours des 30 derniers jours)
CLHE
CLHE le 7 Mar 2020
Commenté : CLHE le 8 Mar 2020
Hi,
I have normalized my data using the formula given and now i need to renormalize it to the original version, not (0,1) or (-1,1). What function do i use? Pls help! i couldnt find a "denormalize" function anywhere!
%Data needs to be normalized
inputs = normalize(inputs);
targets = normalize(targets);
inputs2020 = normalize(inputs2020);
targets2020 = normalize(targets2020);
  7 commentaires
Star Strider
Star Strider le 7 Mar 2020
@CLHE —
The neural network information is new. To denormalise the results of the neural network, multiply them by the standard deviation and then add the mean.
dpb
dpb le 7 Mar 2020
Isn't the output rescaled back to the same units as the original? I've not used the ML NN models/don't have the TB so not sure how they actually work in that regards...

Connectez-vous pour commenter.

Réponse acceptée

John D'Errico
John D'Errico le 7 Mar 2020
Modifié(e) : John D'Errico le 7 Mar 2020
You can't. Well, you can, but only if you do what you need in advance.
X = 1:5
X =
1 2 3 4 5
normalize(X)
ans =
-1.2649 -0.63246 0 0.63246 1.2649
normalize(2*X)
ans =
-1.2649 -0.63246 0 0.63246 1.2649
Can you see that normaize produces exactly the same result for both X and 2*X? If so, then you must surely understand that merely from the normalized data, you can never recover the original data.
You absolutely need to save the transformation parameters for how the data was normalized. Otherwise, denormalization is impossible.
However, if we store the normalization parameters, then recovery is possible.
mu = mean(X);
S = std(X);
Xnorm = (X - mu)/S
Xnorm =
-1.2649 -0.63246 0 0.63246 1.2649
Xnorm*S + mu
ans =
1 2 3 4 5
As you see, Xnorm is the same thing as what normalize produced, but now we can recover X from Xnorm.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by