Hi all,
I am trying to create and train an ANN to predict power output of a wind turbine based on some inputs. I have followed a helpful video on youtube on how to create the ANN and return RMSE values for the training, validation and test cycles of the ANN. The problem I am having is that when I run the code, one of my RMSE values comes back as a NaN. The data used is a numeric Matrix obtained from a simulation and contains no NaN's at all. What is more problematic is that if I run the code 3 times consecutivly, each time a differant RMSE value returns the NaN. Please see code below:
%data
x=winddata(:,[2 5 17 20]);
y=winddata(:,22);
m=length(y);
%Train ANN
xt=x';
yt=y';
hiddenlayersize=10;
net=fitnet(hiddenlayersize);
net.divideParam.trainRatio=30/100;
net.divideParam.ValRatio=30/100;
net.divideParam.testRatio=40/100;
[net,tr]=train(net, xt, yt);
yTrain=net(xt(:,tr.trainInd));
yTrainTrue=yt(tr.trainInd);
rmse_train=sqrt(mean((yTrain-yTrainTrue).^2))
yVal=net(xt(:,tr.valInd));
yValTrue=yt(tr.valInd);
rmse_val=sqrt(mean((yVal-yValTrue).^2))
yTest=net(xt(:,tr.testInd));
yTestTrue=yt(tr.testInd);
rmse_test=sqrt(mean((yTest-yTestTrue).^2))
The results obtained from running the ANN 3 times consecutivly can be seen below:
>> ANNcheck1
rmse_train = NaN
rmse_val = 292.1152
rmse_test = 290.5616
>> ANNcheck2
rmse_train = 290.6516
rmse_val = 290.7914
rmse_test = NaN
>> ANNcheck3
rmse_train = NaN
rmse_val = 289.9657
rmse_test = 293.0484
Any help would be greatly appreciated!