MATLAB Answers

normalisation and reverse process _Forecasting _mean standard deviation

17 views (last 30 days)
NN
NN on 8 Dec 2020
Answered: Karan Nandankar on 28 Dec 2020
I am getting different rmse value for forecasted value for almost similar look plots.
please check the attached plot .
First one is plotted with standardised data(rmse= 0.2) and second one is plotted with reversed values(rmse=190).
Please help as i dont understand where i did mistake ..
Below is the code which i have used :
pn=normalize(XTrain);
tn=normalize(YTrain);
rn=normalize(XTest);
qn=normalize(YTest);
[Z,gpamean,gpastdev] = zscore(XTrain);
[Z,gpamean1,gpastdev1] = zscore(XTest);
net = trainNetwork(pn,tn,layers,options);
YPred=predict(net,rn);
YPred1 = gpastdev1.*YPred + gpamean1;
figure
plot(YPred1)
hold on
plot(YTest,'.-')
hold off
legend(["Observed" "Predicted"])
ylabel("SolarIrradiance")
title("Forecast with Updates")
rmse = sqrt(mean((YPred1-YTest).^2))
figure
plot(YPred)
hold on
plot(qn,'.-')
hold off
legend(["Observed" "Predicted"])
ylabel("SolarIrradiance")
title("Forecast with Updates")
rmse = sqrt(mean((YPred-qn).^2))

Answers (1)

Karan Nandankar
Karan Nandankar on 28 Dec 2020
Hi,
As I can see you're trying to map z-score parameters of XTest to calculate inverse of normalized YPred. You may try the following code to compute normalized dependent variable and its inverse.
[qn, mean1, stdev1] = zscore(YTest); %Normalization
%
%
YPred = predict(net, rn);
YPred1 = stdev1*qn + mean1; % Inverse
However, it is expected to obtain higher values of RMSE on unscaled data (having higher range) with respect to Normalized data. The idea is to calculate performance measures in the same order of magnitude, i.e. order of your initial unscaled response variable.

Community Treasure Hunt

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

Start Hunting!

Translated by