How can I denormalize the equation in Matlab automatically ?
5 views (last 30 days)
Show older comments
Actually, I have normalized my data before run the software that I have automatically (works in excel sheet and the data used is attached).The data scaled from [0 to 1] and getting an equation. My question is how can I re-normalize the equation to be written with actual data automatically? As I am doing that manually like this.
X = (Xi - Xmin)/(Xmax - Xmin).
Y = (Yi- Ymin)/(Ymax -Ymin)
Many thanks
2 Comments
jgg
on 12 Jan 2016
I'm not clear what you're asking here. If you've loaded the data, what variables are you working with? If you haven't loaded it, I don't see how you can recover non-normalized values from normalized data.
Answers (2)
Walter Roberson
on 13 Jan 2016
denormalized_X = normalized_X * (Xmax - Xmin) + Xmin;
3 Comments
Walter Roberson
on 14 Jan 2016
If that Y is the result of operating on the normalized data, then:
More generally, Y = C3*nx^3+C2*nx^2+C1*nx+C0 where nx is your normalized x. Then since your normalized x is nx = (x-xmin)/(xmax-xmin) you can substitute that into the Y equation, and clean up the answer a bit, to get
Y = (C3 * x^3 + (xmax * C2 - (C2 + 3*C3) * xmin) * x^2 + (xmax^2 * C1 - 2*(C1+C2) * xmin * xmax + (C1 + 2*C2 + 3*C3) * xmin^2) * x + C0 * xmax^3 -(3*C0+C1) * xmin * xmax^2 + (3*C0+2*C1+C2) * xmin^2 * xmax -(C0+C1+C2+C3) * xmin^3 ) / (xmax - xmin)^3
and now your Y is expressed in terms of the unnormalized x.
Here, xmin and xmax should be the minimum and maximum value normalized against, which might possibly be fixed values (depending on the setup), or might be min(x) and max(x) (in other setups.)
Greg Heath
on 17 Jan 2016
Since both X and Y are normalized, Walters equation gives you Yn. Then use his other equation
Y = Ymin + (Ymax-Ymin)*Yn
Hope this helps.
Greg
Greg Heath
on 13 Jan 2016
No.
If you are using MATLAB NN training functions, you don't have to do anything because the defaults are
1. Automatic normalization of inputs and targets to [-1,1]
2. Automatic denormalization of outputs from [-1,1] to the original target scale.
However, before training I do use ZSCORE (standardize to zero-mean/unit-variance) to check for, modify and/or delete outliers.
However, inputs and targets are trained using the original scaling.
Hope this helps.
Thank you for formally accepting my answer
See Also
Categories
Find more on Classification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!