Borrar filtros
Borrar filtros

Error using adapt in Neural Networks

4 visualizaciones (últimos 30 días)
Koustubh  Gaikwad
Koustubh Gaikwad el 20 de Oct. de 2014
Comentada: Greg Heath el 20 de Oct. de 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?

Respuesta aceptada

Greg Heath
Greg Heath el 20 de Oct. de 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 comentarios
Koustubh  Gaikwad
Koustubh Gaikwad el 20 de Oct. de 2014
Thanks for the reply Greg.
What were your simple inputs ?
--> I tried it with simple inputs like (1:500) and it worked. However, when I tried (1:1000) it somehow gave me the same error. I also tried with a more realistic dataset and it happened to work for that as well. However, only for certain inputs I get this error.
Why not test with a MATLAB data set so that we can compare answers ?
-->As I mentioned, it works on certain inputs
What happens when you use train instead of adapt ?
-->train works instead of adapt.
Also, I managed to run it for the same set of inputs by first dividing the entire dataset by 10 and then after prediction I multiple by 10. It may not be a good way to do this.
Greg Heath
Greg Heath el 20 de Oct. de 2014
I don't understand.
input = 1:500
target = ?
Again, use a MATLAB timeseries data set
help nndatsets

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre AI for Signals and Images en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by