normalising and reverse normalising data

조회 수: 11 (최근 30일)
NN
NN 2020년 12월 8일
답변: Karan Nandankar 2020년 12월 28일
For forecasting , I normalised the data before training for test and train data , then when i plot the rmse , i get rmse 0.2.but when i try to reverse the normalised values to match with orginal target of test data it shows high error.
i have used below code to normalise and denormalise :
[pn,ps] = mapminmax(XTrain);
[tn,ts] = mapminmax(YTrain);
[qn,qs] = mapminmax(XTest);
[rn,rs] = mapminmax(YTest);
net = trainNetwork(pn,tn,layers,options);
YPred=predict(net,qn);
YPred1 = mapminmax('reverse',YPred,ts);
what could be the reason ?
  댓글 수: 3
NN
NN 2020년 12월 8일
i am using 2019b version.
i am doing forecasting Problem,
So i applied mapminmax function to rescale the data .
I referred below matlab documentation.
i am getting minimum rmse value with normalised output and test data .But when i reverse it to original scale , it shows different rmse..
Why is it happening .Kindly help..
i used below code:
[pn,ps] = mapminmax(XTrain);
[tn,ts] = mapminmax(YTrain);
net = trainNetwork(pn,tn,layers,options);
qn = mapminmax('apply', XTest,ps);
[rn,rs] = mapminmax(YTest);
YPred=predict(net,qn);
YPred1 = mapminmax('reverse',YPred,ts);
figure
plot(YPred1)
hold on
plot(YTest,'.-')
hold off
legend(["Observed" "Predicted"])
ylabel("SolarIrradiance")
title("Forecast with Updates")
rmse = sqrt(mean((YPred1-YTest).^2))
Star Strider
Star Strider 2020년 12월 8일
Reference: My Comment to your previous Comment.

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

답변 (1개)

Karan Nandankar
Karan Nandankar 2020년 12월 28일
Hi,
Looks like you have used the wrong Process Settings in the variable 'YPred1'. As I can see you are using XTest as your independent variable for Model Prediction, and the corresponding dependent variable YTest is normalized with Process Setting parameter 'rs'. However, for the variable YPred1 you have mapped the predictions against 'ts' (which is for YTrain).
In order to reverse the normalization, you can change the Process Setting parameter in YPred1 from 'ts' to 'rs'.
YPred1 = mapminmax('reverse',YPred,rs);
You can refer to this documentation for more information.

카테고리

Help CenterFile Exchange에서 Predictive Maintenance Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by