Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dynamic neural network

37 views
Skip to first unread message

jia

unread,
Jun 21, 2010, 3:14:22 PM6/21/10
to
Hello I am a beginner of dynamic neural network.

I have some difficulty in understanding the function of dynamic neural network.

In the document (2010a), for newfftd, it offers an example:

load laser
y = y(1:600)';
y = con2seq(y);
ftdnn_net = newfftd(y,y,[1:8],5);
ftdnn_net.trainParam.show = 10;
ftdnn_net.trainParam.epochs = 50;
p = y(9:end);
t = y(9:end);
Pi=y(1:8);
ftdnn_net = train(ftdnn_net,p,t,Pi);

My difficulty is to understand the usage of the functions of newfftd and train. For example, in newfftd, it uses "y, y, [1:8]", it includes the initial input (starting from 1st input). For some other functions, such as newnarx (see bellow), "p' and "t" do not include the initial input (starting from the 3rd).

load magdata
[u,us] = mapminmax(u);
[y,ys] = mapminmax(y);
y = con2seq(y);
u = con2seq(u);
p = u(3:end);
t = y(3:end);
d1 = [1:2];
d2 = [1:2];
narx_net = newnarxsp(p,t,d1,d2,10);
For "train" function, this example uses "pi", but for other functions such as newfftnd (not newfftd), it does not use "pi".

In addition, for "train", in the example of "newfftd", it uses "pi", but for "newnarxsp", it does not use "pi".

Is there any rule here I do not notice? Thank you very much.

Greg Heath

unread,
Jun 22, 2010, 1:19:16 AM6/22/10
to
On Jun 21, 3:14 pm, "jia " <kuku...@gmail.com> wrote:
> Hello I am a beginner of dynamic neural network.
>
> I have some difficulty in understanding the function of
> dynamic neural network.
>
> In the document (2010a), for newfftd, it offers an example:

> load laser
> y = y(1:600)';
> y = con2seq(y);
> ftdnn_net = newfftd(y,y,[1:8],5);
> ftdnn_net.trainParam.show = 10;
> ftdnn_net.trainParam.epochs = 50;
> p = y(9:end);
> t = y(9:end);
> Pi=y(1:8);
> ftdnn_net = train(ftdnn_net,p,t,Pi);
>
> My difficulty is to understand the usage of the functions
> of newfftd and train. For example, in newfftd, it uses
> "y, y, [1:8]", it includes the initial input (starting
> from 1st input).

A net is created with the number of input and output
nodes equal to

I = size(y,1)+ size([1:8],2) = 1 + 8 = 9
and
O = size(y,1) = 1

This yields the same result as

ftdnn_net = newfftd(p,t,[1:8],5);


>For some other functions, such as newnarx (see bellow),
>"p' and "t" do not include the initial input (starting
> from the 3rd).

Similar to the above that starts from the ninth.

> load magdata
> [u,us] = mapminmax(u);
> [y,ys] = mapminmax(y);
> y = con2seq(y);
> u = con2seq(u);
> p = u(3:end);
> t = y(3:end);
> d1 = [1:2];
> d2 = [1:2];
> narx_net = newnarxsp(p,t,d1,d2,10);
> For "train" function, this example uses "pi", but for
> other functions such as newfftnd (not newfftd), it
> does not use "pi".

No, it uses d1 and d2.

> In addition, for "train", in the example of "newfftd",
> it uses "pi", but for "newnarxsp", it does not use "pi".
>
> Is there any rule here I do not notice?

Yes. To try to understand how two similar algorithms
differ, compare, closely, the online help and documentation.
The latter is posted on the MATLAB website.

Hope this helps.

Greg

jia

unread,
Jun 22, 2010, 4:39:22 AM6/22/10
to
Thank you very much, Greg. Please see bellow.

Greg Heath <he...@alumni.brown.edu> wrote in message <c3bcb488-d9f4-4b26...@e5g2000yqn.googlegroups.com>...

What you mean is that the purpose of the first two arguments in NN creation function such as newfftd, newff, is to define the number of input and output? So is that right the following code will yeild the same results as the above?
ftdnn_net = newfftd(y(10:end), y(10:end), [1:8], 5)
-----------------------------


>
> >For some other functions, such as newnarx (see bellow),
> >"p' and "t" do not include the initial input (starting
> > from the 3rd).
>
> Similar to the above that starts from the ninth.
>
> > load magdata
> > [u,us] = mapminmax(u);
> > [y,ys] = mapminmax(y);
> > y = con2seq(y);
> > u = con2seq(u);
> > p = u(3:end);
> > t = y(3:end);
> > d1 = [1:2];
> > d2 = [1:2];
> > narx_net = newnarxsp(p,t,d1,d2,10);
> > For "train" function, this example uses "pi", but for
> > other functions such as newfftnd (not newfftd), it
> > does not use "pi".
>
> No, it uses d1 and d2.

Sorry for this question, I forgot to delete this before posting.
--------------------------------------


>
> > In addition, for "train", in the example of "newfftd",
> > it uses "pi", but for "newnarxsp", it does not use "pi".
> >
> > Is there any rule here I do not notice?
>
> Yes. To try to understand how two similar algorithms
> differ, compare, closely, the online help and documentation.
> The latter is posted on the MATLAB website.

If you type "help newfftd", an simple example is provided at the end of the text:
P = {1 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1};
T = {1 -1 0 1 0 -1 1 -1 0 0 0 1 0 -1 0 1};
net = newfftd(P,T,[0 1],5);
Y = sim(net,P)
net.trainParam.epochs = 50;
net = train(net,P,T);
Y = sim(net,P)
Here there is no "pi" in the "train" function, is that right the initial input is set to zero if "pi" is not defined? in other words, p{1} and {0} are used to calculate T{1},then P{2} and P{1} are input to calculate T{2}
---------------------------------------
> Hope this helps.
>
> Greg

Steven Lord

unread,
Jun 22, 2010, 1:44:09 PM6/22/10
to

"jia " <kuk...@gmail.com> wrote in message
news:hvpsrq$78p$1...@fred.mathworks.com...

> Thank you very much, Greg. Please see bellow.
>
> Greg Heath <he...@alumni.brown.edu> wrote in message
> <c3bcb488-d9f4-4b26...@e5g2000yqn.googlegroups.com>...
>> On Jun 21, 3:14 pm, "jia " <kuku...@gmail.com> wrote:

*snip*

>> This yields the same result as
>>
>> ftdnn_net = newfftd(p,t,[1:8],5);
>>
> What you mean is that the purpose of the first two arguments in NN
> creation function such as newfftd, newff, is to define the number of input
> and output? So is that right the following code will yeild the same
> results as the above?
> ftdnn_net = newfftd(y(10:end), y(10:end), [1:8], 5)

From the documentation:

http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/newfftd.html

If you know the sizes of P and T, you know how many elements each input
vector has. [I believe there's a typo in the description of T where it
should tell you how many elements each _output_ vector has; I'll report that
to the documentation staff.]

*snip*

> If you type "help newfftd", an simple example is provided at the end of
> the text:
> P = {1 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1};
> T = {1 -1 0 1 0 -1 1 -1 0 0 0 1 0 -1 0 1};
> net = newfftd(P,T,[0 1],5);
> Y = sim(net,P)
> net.trainParam.epochs = 50;
> net = train(net,P,T);
> Y = sim(net,P)
> Here there is no "pi" in the "train" function, is that right the initial
> input is set to zero if "pi" is not defined? in other words, p{1} and {0}
> are used to calculate T{1},then P{2} and P{1} are input to calculate T{2}

Let's go back to the documentation, this time for the TRAIN function:

http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/train.html

What does this page say about the Pi input to the TRAIN function? Does it
indicate what the default value for that input is? The default is used if
that input is not specified.

--
Steve Lord
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


Greg Heath

unread,
Jun 22, 2010, 4:59:39 PM6/22/10
to
On Jun 22, 4:39 am, "jia " <kuku...@gmail.com> wrote:
> Thank you very much, Greg.  Please see bellow.
> Greg Heath <he...@alumni.brown.edu> wrote in message <c3bcb488-d9f4-4b26-ad83-bc0333cfb...@e5g2000yqn.googlegroups.com>...

Not exactly. The range of the first two inputs is probably
used to intitialize the weights.

-----SNIP


>
> If you type "help newfftd", an simple example is provided at the end of the text:
>        P = {1  0 0 1 1  0 1  0 0 0 0 1 1  0 0 1};
>        T = {1 -1 0 1 0 -1 1 -1 0 0 0 1 0 -1 0 1};
>      net = newfftd(P,T,[0 1],5);

Same as

net = newfftd(P,T,Pi,5);

with

Pi = [ 0 1]

or is it

Pi = { 0 1}?

Note that T = P - [0 P(1:end-1)]

So hidden nodes are really uneccessary.

>       Y = sim(net,P)
>        net.trainParam.epochs = 50;
>        net = train(net,P,T);
>        Y = sim(net,P)
> Here there is no "pi"

You mean "Pi"

>in the "train" function, is that right the initial input is set to zero if "pi" is not defined?

I don't know. The obvious thing to do is to try both ways for a
couple of time steps and compare.

> in other words, p{1} and {0} are used to calculate T{1},then P{2} and P{1} are input to > calculate T{2}

That is the way it should be.

Maybe that info is embedded in the structure net.

Now I'm wondering if Pi shouldn't be explicitly used in sim.

help network/sim

[Y,Pf,Af,E,perf] = sim(net,P,Pi,Ai,T)

Obviously several things need investigating.

Hope this helps.

Greg

jia

unread,
Jun 22, 2010, 5:24:07 PM6/22/10
to
Thank you for your help
Greg Heath <he...@alumni.brown.edu> wrote in message <93626d50-c461-4d09...@f7g2000vbl.googlegroups.com>...

Greg Heath

unread,
Jun 22, 2010, 5:32:12 PM6/22/10
to
On Jun 22, 1:44 pm, "Steven Lord" <sl...@mathworks.com> wrote:
> "jia " <kuku...@gmail.com> wrote in message

>
> news:hvpsrq$78p$1...@fred.mathworks.com...
>
> > Thank you very much, Greg.  Please see bellow.
>
> > Greg Heath <he...@alumni.brown.edu> wrote in message
> > <c3bcb488-d9f4-4b26-ad83-bc0333cfb...@e5g2000yqn.googlegroups.com>...

> >> On Jun 21, 3:14 pm, "jia " <kuku...@gmail.com> wrote:
>
> *snip*
>
> >> This yields the same result as
>
> >> ftdnn_net = newfftd(p,t,[1:8],5);
>
> > What you mean is that the purpose of the first two arguments in NN
> > creation function such as newfftd, newff, is to define the number of input
> > and output?  So is that right the following code will yeild the same
> > results as the above?
> > ftdnn_net = newfftd(y(10:end), y(10:end), [1:8], 5)
>
> From the documentation:
>
> http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/newfftd.html
>
> If you know the sizes of P and T, you know how many elements each input
> vector has.  [I believe there's a typo in the description of T where it
> should tell you how many elements each _output_ vector has; I'll report that
> to the documentation staff.]

Also, I think that Q2 and Q1 should be replaced by plain Q.
So that

P R x Q1 matrix of Q1 sample R-element input vectors
T SN x Q2 matrix of Q2 sample SN-element input vectors

should be replaced by

P R x Q matrix of Q sample R-element input vectors
T SN x Q matrix of Q sample SN-element output vectors

> *snip*
>
> > If you type "help newfftd", an simple example is provided at the end of
> > the text:
> >       P = {1  0 0 1 1  0 1  0 0 0 0 1 1  0 0 1};
> >       T = {1 -1 0 1 0 -1 1 -1 0 0 0 1 0 -1 0 1};
> >     net = newfftd(P,T,[0 1],5);
> >      Y = sim(net,P)
> >       net.trainParam.epochs = 50;
> >       net = train(net,P,T);
> >       Y = sim(net,P)
> > Here there is no "pi" in the "train" function, is that right the initial
> > input is set to zero if "pi" is not defined? in other words, p{1} and {0}
> > are used to calculate T{1},then P{2} and P{1} are input to calculate T{2}
>
> Let's go back to the documentation, this time for the TRAIN function:
>
> http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/train.html
>
> What does this page say about the Pi input to the TRAIN function?  Does it
> indicate what the default value for that input is?  The default is used if
> that input is not specified.

The default is zeros. Therefore, shouldn't the train command in the
example
be modified?

In addition, from

http://www.mathworks.com/access/helpdesk/help/toolbox/nnet/sim.html

we get

[Y,Pf,Af,E,perf] = sim(net,P,Pi,Ai,T);

Therefore, shouldn't the sim command in the example be modified also?

As long as we're trashing the example, note that

T = P - [ 0 P(1:end-1)];

Therefore no hidden nodes are necessary.

Hope this helps.

Greg

0 new messages