Error using adapt in Neural Networks
4 次查看(过去 30 天)
显示 更早的评论
I am trying to use Haar Wavelet Decomposition and feed it into a Neural Network(NARX) in order to predict the coefficients. I have tried the same code with simple inputs and it works just fine. However, when I enter the coefficients from the 'Haar' wavelet, it gives an error saying "Performance PERF is not finite". Below is the code and the corresponding error.
Code
=====
clc CSV_PATH=''; CSV_FILE = 'test2.csv'; ROWS = 931;
%Reading Input Data
[numData,textData,row] = xlsread(strcat(CSV_PATH,CSV_FILE));
for i=3:ROWS
data(i-2) = (row(i,1)) ;
end
CV = cell2mat(data);
%Wavelet Decomposition
[C,L] = wavedec(CV,1,'haar');
%Neural Networks
inputSeries = tonndata((1:465),true,false);
targetSeries = tonndata(C(1:465),true,false);
% Create a Nonlinear Autoregressive Network with External Input
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = [4 4 4];
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
[Xs,Xi,Ai,Ts] = preparets(net,inputSeries,{},targetSeries);
[net,a,e,pf] = adapt(net,Xs,Ts,Xi,Ai);
Error
=====
??? Error using ==> mse at 238
Performance PERF is not finite.
Error in ==> adaptwb>adapt_network at 94
gE(net.outputConnect,:) = feval(net.performFcn,'dperf_de',net,T(:,ts),
...
Error in ==> adaptwb at 39
[out1,out2,out3] = adapt_network(in1,in2,in3,in4);
Error in ==> network.adapt at 121
[net,Ac,tr] = feval(adaptFcn,net,Pd,T,Ai);
Error in ==> test_haar at 36
[net,a,e,pf] = adapt(net,Xs,Ts,Xi,Ai);
Can someone help me to identify the problem?
0 个评论
采纳的回答
Greg Heath
2014-10-20
One hidden layer is sufficient
What were your simple inputs ?
Why not test with a MATLAB data set so that we can compare answers ?
What happens when you use train instead of adapt ?
help nndatasets
help narxnet
close all, clear all, clc
[X,T] = simplenarx_dataset;
net = narxnet(1:2,1:2,10);
[ Xs , Xi ,Ai ,Ts ] = preparets(net, X,{},T);
ts = cell2mat(Ts);
MSE00s = mean(var(ts',1)) %0.0992 Reference MSE
rng('default')
[net tr Ys Es Xf Af ] = train( net, Xs, Ts, Xi, Ai);
NMSEs = mse(cell2mat(Es))/MSE00s % 1.4394e-07
rng('default')
[net Ys Es Xf Af tr ] = adapt( net, Xs, Ts, Xi, Ai);
NMSEs = mse(cell2mat(Es))/MSE00s % 1.5749e-07
Hope this helps.
Thank you for formally accepting my answer
Greg
PS The default H = 10 can be reduced
2 个评论
Greg Heath
2014-10-20
I don't understand.
input = 1:500
target = ?
Again, use a MATLAB timeseries data set
help nndatsets
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 AI for Signals and Images 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!