Path: news.mathworks.com!not-for-mail
From: "Mehdi " <mehdi_bg_53@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: NARX learning
Date: Wed, 2 Jan 2013 04:52:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 61
Message-ID: <kc0edo$s3p$1@newscl01ah.mathworks.com>
References: <kc0c6h$l2e$1@newscl01ah.mathworks.com>
Reply-To: "Mehdi " <mehdi_bg_53@yahoo.com>
NNTP-Posting-Host: www-04-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1357102328 28793 172.30.248.35 (2 Jan 2013 04:52:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 2 Jan 2013 04:52:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3362961
Xref: news.mathworks.com comp.soft-sys.matlab:785730

"Mehdi " <mehdi_bg_53@yahoo.com> wrote in message <kc0c6h$l2e$1@newscl01ah.mathworks.com>...
> How to train NARX successfully?

I trained NARX opened form successfully, Then closed it and exert the same training data to see the the Responses. The Responses are awful and bad. I dont know why?(Because I trained opened loop with enough datasets e.g 100000 and mse=10e-7)
To solve the problem I try to train closed loop using lm. But because of large training data the training speed was very very low.I decreased data up to 1000 pairs. The training starts but after some iteration it stoped with the Maximum Mu Reached. I tested the resulted network with same data set that I have used for training. But the responses was awful again.
Any comment will be so helpfull.
my code
clc;
load outputs.mat
load inputs.mat
inputDelays = 0:2;
feedbackDelays = 1:2;
hiddenLayerSize = 27;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.inputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.trainFcn = 'trainlm';  % Levenberg-Marquardt
net.trainParam.min_grad=1e-10;
net.trainParam.max_fail=11;
net.trainParam.show=1;
net.trainParam.epochs = 100;
net.trainParam.goal = 1e-3;
net.trainParam.mu_max = 1e10;
%net.efficiency.memoryReduction = 2;
InputSeries= tonndata(inputs0,false,false);
OutputSeries= tonndata(outputs0,false,false);
[Inputs,inputStates,layerStates,targets] = preparets(net,InputSeries,{},OutputSeries);
net.divideFcn = 'dividerand';  % Divide data randomly
net.divideMode = 'value';  % Divide up every value
net.divideParam.trainRatio = 90/100;
net.divideParam.valRatio = 10/100;
%net.divideParam.testRatio = 15/100;
net.plotFcns = {'plotperform','plottrainstate','plotresponse', ...
  'ploterrcorr', 'plotinerrcorr'};
[net,tr] = train(net,Inputs,targets,inputStates,layerStates);
view(net)
% Closed Loop Network
%netc = closeloop(net);
%inputSeries= tonndata(inputs,false,false);
%targetSeries= tonndata(outputs,false,false);
%netC=netc;
%netC.name = [net.name ' - Closed Loop'];
%view(netC)
%[inputsC,inputStatesC,layerStatesC,targetsC] = preparets(netC,inputSeries,{},targetSeries);
%yC = netC(inputsC,inputStatesC,layerStatesC);
%closedLoopPerformance = perform(netC,targetsC,yC);
%netC.trainFcn = 'trainlm';  % Levenberg-Marquardt
%netC.trainParam.min_grad=1e-10;
%netC.trainParam.max_fail=21;
%netC.trainParam.show=1;
%netC.trainParam.epochs = 10000;
%netC.trainParam.goal = 1e-7;
%netC.trainParam.mu_max = 1e10;
%net.trainParam.mem_reduc = 1;
%[netC,trC] = train(netC,inputsC,targetsC,inputStatesC,layerStatesC);
%gensim(netC)

I have tested many ways(e.g running up to 1000 times, different numbers of hidden units and delays but no success yet)
give me your email to send inputs and outputs.
my email:mehdi.bgh@gmail.com 
Mehdi,