Error using adapt in Neural Networks
4 views (last 30 days)
Show older comments
Koustubh Gaikwad
on 20 Oct 2014
Commented: Greg Heath
on 20 Oct 2014
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 Comments
Accepted Answer
Greg Heath
on 20 Oct 2014
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 Comments
Greg Heath
on 20 Oct 2014
I don't understand.
input = 1:500
target = ?
Again, use a MATLAB timeseries data set
help nndatsets
More Answers (0)
See Also
Categories
Find more on AI for Signals and Images 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!