Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
help me about 1-step ahead feedforward

Subject: help me about 1-step ahead feedforward

From: Jame

Date: 6 Oct, 2013 13:51:11

Message: 1 of 5

hello everybody,
I'm a newbie in both mathlab and neural network. So When I meet some trouble when I apply mathlab for feedforward, please help me.
My data divede two set: sample and test.
And My model is: y(t) = f(x(t-1),x(t-2),...x(t-d)) on the sample.
Here is my code:

[X,T] = simpleseries_dataset;
N = 20;%No.of test patterns
input_sample = X(1,1:end-N);
target_sample = T(1,1:end-N);
input_test = X(N+1:end);
target_test = T(N+1:end);
net = narxnet(1:2,[],10)
net.divideParam.trainRatio = 0.85;
net.divideParam.valRatio = 0.15;
net.divideParam.testRatio = 0;
net.divideFcn='divideblock';
[Xs,Xi,Ai,Ts] = preparets(net,input_sample,target_sample) % target here is non-feedback
[net tr] = train(net,Xs,Ts,Xi,Ai);

But I have a problem with preparet function. And I don't know what the reason. Here target is non-feedback (Tnf), but when I change it to feedback (Tf) that it works!!!!.
And I don't know how apply it to predict on my test set .Just need for 1-step ahead.
Please help me fix problems above.
Thank for your help

Subject: help me about 1-step ahead feedforward

From: Greg Heath

Date: 6 Oct, 2013 19:38:06

Message: 2 of 5

"Jame " <phuongr3k2@gmail.com> wrote in message <l2rpsf$lr6$1@newscl01ah.mathworks.com>...
> hello everybody,
> I'm a newbie in both mathlab and neural network. So When I meet some trouble when I apply mathlab for feedforward, please help me.
> My data divede two set: sample and test.
> And My model is: y(t) = f(x(t-1),x(t-2),...x(t-d)) on the sample.
> Here is my code:
>
> [X,T] = simpleseries_dataset;
> N = 20;%No.of test patterns
> input_sample = X(1,1:end-N);
> target_sample = T(1,1:end-N);
> input_test = X(N+1:end);
> target_test = T(N+1:end);
> net = narxnet(1:2,[],10)
> net.divideParam.trainRatio = 0.85;
> net.divideParam.valRatio = 0.15;
> net.divideParam.testRatio = 0;
> net.divideFcn='divideblock';
> [Xs,Xi,Ai,Ts] = preparets(net,input_sample,target_sample) % target here is non-feedback
> [net tr] = train(net,Xs,Ts,Xi,Ai);
>
> But I have a problem with preparet function. And I don't know what the reason. Here target is non-feedback (Tnf), but when I change it to feedback (Tf) that it works!!!!.
> And I don't know how apply it to predict on my test set .Just need for 1-step ahead.
> Please help me fix problems above.
> Thank for your help

You are missusing the term sample. Just use the term data, alone or with the qualifiers training(weight selection), validation(early stopping), testing(unbiased estimation of performance on unseen data).

help nndatasets

Note the difference in the preparets syntax for timedelaynetnet, narnet and narxnet.

If you have no feedback , use timedelaynet.

Stick with the train/val/test defaults. If it works, try your selection. However, beware that
it may not work if any of the 3 subsets are missing.

Hope this helps.

Greg

Subject: help me about 1-step ahead feedforward

From: Greg Heath

Date: 6 Oct, 2013 19:55:06

Message: 3 of 5

"Greg Heath" <heath@alumni.brown.edu> wrote in message <l2se6u$5gj$1@newscl01ah.mathworks.com>...
> "Jame " <phuongr3k2@gmail.com> wrote in message <l2rpsf$lr6$1@newscl01ah.mathworks.com>...

> Stick with the train/val/test defaults. If it works, try your selection. However, beware
> that it may not work if any of the 3 subsets are missing.

 http://www.mathworks.com/matlabcentral/newsreader/view_thread/327180#898961
Thread Subject: NEURAL NET DATA DIVISION BUGS
Subject: NEURAL NET DATA DIVISION BUGS
From: Greg Heath
Date: 1 Mar, 2013 06:31:06
Hope this helps.
 
 Greg

Subject: help me about 1-step ahead feedforward

From: Jame

Date: 7 Oct, 2013 06:25:06

Message: 4 of 5

"Greg Heath" <heath@alumni.brown.edu> wrote in message <l2se6u$5gj$1@newscl01ah.mathworks.com>...
> "Jame " <phuongr3k2@gmail.com> wrote in message <l2rpsf$lr6$1@newscl01ah.mathworks.com>...
> > hello everybody,
> > I'm a newbie in both mathlab and neural network. So When I meet some trouble when I apply mathlab for feedforward, please help me.
> > My data divede two set: sample and test.
> > And My model is: y(t) = f(x(t-1),x(t-2),...x(t-d)) on the sample.
> > Here is my code:
> >
> > [X,T] = simpleseries_dataset;
> > N = 20;%No.of test patterns
> > input_sample = X(1,1:end-N);
> > target_sample = T(1,1:end-N);
> > input_test = X(N+1:end);
> > target_test = T(N+1:end);
> > net = narxnet(1:2,[],10)
> > net.divideParam.trainRatio = 0.85;
> > net.divideParam.valRatio = 0.15;
> > net.divideParam.testRatio = 0;
> > net.divideFcn='divideblock';
> > [Xs,Xi,Ai,Ts] = preparets(net,input_sample,target_sample) % target here is non-feedback
> > [net tr] = train(net,Xs,Ts,Xi,Ai);
> >
> > But I have a problem with preparet function. And I don't know what the reason. Here target is non-feedback (Tnf), but when I change it to feedback (Tf) that it works!!!!.
> > And I don't know how apply it to predict on my test set .Just need for 1-step ahead.
> > Please help me fix problems above.
> > Thank for your help
>
> You are missusing the term sample. Just use the term data, alone or with the qualifiers training(weight selection), validation(early stopping), testing(unbiased estimation of performance on unseen data).
>
> help nndatasets
>
> Note the difference in the preparets syntax for timedelaynetnet, narnet and narxnet.
>
> If you have no feedback , use timedelaynet.
>
> Stick with the train/val/test defaults. If it works, try your selection. However, beware that
> it may not work if any of the 3 subsets are missing.
>
> Hope this helps.
>
> Greg
Please show me what different in preparet syntax between timedelay, nar and narx.
I really doesn't know clearly.
About division, i think i don't need test set. Because I will test for my input(divide clearly training set and test set).
Please help me
Thank you very much
Jame

Subject: help me about 1-step ahead feedforward

From: Greg Heath

Date: 8 Oct, 2013 02:20:06

Message: 5 of 5

"Jame " <phuongr3k2@gmail.com> wrote in message <l2tk42$4ds$1@newscl01ah.mathworks.com>...

% Please show me what different in preparet syntax between timedelay, nar and narx. I really doesn't know clearly.

If the following expressions from the help documentation are not sufficient, read the help documentation (Check to see if the doc documentation contains additional info). Repost if you have "specific" questions

help preparets
      [Xs,Xi,Ai,Ts,EWs,SHIFT] = preparets(net,X,T,{},EW)
      [Xs,Xi,Ai,Ts,EWs,SHIFT] = preparets(net,Xnf,Tnf,Tfb,EW),
help timedelaynet
       [Xs,Xi,Ai,Ts] = preparets(net,X,T);
help narnet
      [Xs,Xi,Ai,Ts] = preparets(net,{},{},T);
help narxnet
      [Xs,Xi,Ai,Ts] = preparets(net,X,{},T);
 
% About division, i think i don't need test set. Because I will test for my input(divide clearly training set and test set).

No. You need all three. The test set is not used for design. Therefore, it's performance is the ONLY UNBIASED estimate of performance on NONTRAINING data.

The validation set is used to stop training when there is evidence of overfitting. Therefore, it is part of the design set and it's performance is biased.

Data = Design + Test
Design = Train + Val
Nondesign = Test

Hope this helps,

Greg

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us