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

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

If you used the default 'zscore', you would have to have saved the mean and standard deviation (std) of your data first in order to ‘denormalise’ it. If you did not do that, likely all hope is lost.
It is always appropriate to save all the original data so reversing a potentially irreversible process is not necessary.
i have the original files with me and can find the mean and standard deviation of the data. What should i do next?
Then do not bother with the denormalisation and just use the original data.
Sorry, am a beginner here. I am currently trying to code the ANN for my data and my lecturer mentioned to use the normalization function in the coding for the report, and then denormalize it again after the training for neural network is done. I have 1 input and 1 output, but the values are very different from each other. If i dont normalize it, will this impact the results?
If z=(x-mu)/s, then x=z*s+mu
It can make quite a bit of difference in the result if do not standardize inputs if they (the inputs) are of markedly differing amplitudes. As the "More About" section of thd documenation for normalize says, using it scales the data to a zero mean and variance of 1 for all variables, retaining shape. This can aid quite a lot in numerical calculations where otherwise differences can become insiginficant of one variable to another or apparent importance owing to magnitude alone.
It would seem to have been a convenience for the user if normalize had also the ability to return the needed parameters when called as optional additional outputs or if rescale had the option to convert back from z-scores besides just the linear scaling it does.
I'd never used either; it's so trivial an operation always just code it inline so had to go look up what each actually did as implemented...
@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.
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...

댓글을 달려면 로그인하십시오.

 채택된 답변

John D'Errico
John D'Errico 2020년 3월 7일
편집: John D'Errico 2020년 3월 7일
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.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2020년 3월 7일

댓글:

2020년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by