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:
Outputs in Elman Network

Subject: Outputs in Elman Network

From: Pedro

Date: 1 Jun, 2013 15:22:10

Message: 1 of 4

Good morning from Spain,

I'm working with a Elman NN, and I have two problems that I cannot resolve.

1. I'm trying to entablish two outputs in the net, but I can't find the code or the option that can do this. I've prove "net.outputs = 2" o "net.numOutputs = 2", but both either work. I thought that, when I configure the net, maybe if I put two targets, this could change, but I was wrong.

2. The output. This takes a long time giving me headache. I don't know why, the output is really really small if we compare it with the target or even the input. Can it be the weights or the bias? Or maybe the train option?

Input = 1x5000 cell
Target = 1x5000 cell

The code I use to create the net and to configurate it is the next:

net = elmannet(1:2,10);
net = configure(net,input,target);
[Xs,Xi,Ai,Ts] = preparets(net,input,target);

net.divideFcn='divideind';
[trainInd,valInd,testInd] = divideind(5000,1:3000,3001:4000,4001:5000);
net.divideParam.trainInd = trainInd;
net.divideParam.valInd = valInd;
net.divideParam.testInd = testInd;

net = trainlm(net,Xs,Ts,Xi,Ai);
Y = net(Xs,Xi,Ai);
perf = perform(net,Ts,Y);

Subject: Outputs in Elman Network

From: Greg Heath

Date: 8 Jun, 2013 08:22:08

Message: 2 of 4

"Pedro" wrote in message <kod3j2$mpf$1@newscl01ah.mathworks.com>...
> Good morning from Spain,
>
> I'm working with a Elman NN, and I have two problems that I cannot resolve.
>
> 1. I'm trying to entablish two outputs in the net, but I can't find the code or the option that can do this. I've prove "net.outputs = 2" o "net.numOutputs = 2", but both either work. I thought that, when I configure the net, maybe if I put two targets, this could >change, but I was wrong.

Just change the size of the target from [ 1 N ] to [ 2 N ].

> 2. The output. This takes a long time giving me headache.

N = 5000, H = 10 should take a long time, especially with closeloop delays.

Why not try N = 100 or so for debugging purposes?

Why are you using ELMAN instead of te less complicated NARXNET?

>I don't know why, the output is really really small if we compare it with the target or even >the input. Can it be the weights or the bias? Or maybe the train option?

Do you mean max(abs(cell2mat(Y))) << max(abs(cell2mat(T))) ?

Again, try reducing N to debug.

Also, try your code on a nndataset so we can compare answers.

help nndatasets
doc nndatasets
 
> Input = 1x5000 cell
> Target = 1x5000 cell
>
> The code I use to create the net and to configurate it is the next:
>
> net = elmannet(1:2,10);
> net = configure(net,input,target);
> [Xs,Xi,Ai,Ts] = preparets(net,input,target);
>
> net.divideFcn='divideind';
> [trainInd,valInd,testInd] = divideind(5000,1:3000,3001:4000,4001:5000);
> net.divideParam.trainInd = trainInd;
> net.divideParam.valInd = valInd;
> net.divideParam.testInd = testInd;
>
> net = trainlm(net,Xs,Ts,Xi,Ai);
> Y = net(Xs,Xi,Ai);
> perf = perform(net,Ts,Y);

Hope this helps.

Greg

Subject: Outputs in Elman Network

From: Pedro

Date: 12 Jun, 2013 10:04:11

Message: 3 of 4

I've changed Elman to NARX and the problem is solved. But I'm still thinking why the output is so small.

To answer your question: >I don't know why, the output is really really small if we compare it with the target or even >the input. Can it be the weights or the bias? Or maybe the train option?

Do you mean max(abs(cell2mat(Y))) << max(abs(cell2mat(T))) ?

Yes. Cell2mat(Y) <<<<<<<< cell2mat(T). But with the NARX, this doesn't happen. I don't know why.

Thanks for answering.

Subject: Outputs in Elman Network

From: Greg Heath

Date: 15 Jun, 2013 17:08:11

Message: 4 of 4

"Pedro" wrote in message <kp9h2r$sle$1@newscl01ah.mathworks.com>...
> I've changed Elman to NARX and the problem is solved. But I'm still thinking why the output is so small.
>
> To answer your question: >I don't know why, the output is really really small if we compare it with the target or even >the input. Can it be the weights or the bias? Or maybe the train option?
>
> Do you mean max(abs(cell2mat(Y))) << max(abs(cell2mat(T))) ?
>
> Yes. Cell2mat(Y) <<<<<<<< cell2mat(T). But with the NARX, this doesn't happen. I don't know why.
>
> Thanks for answering.

I don't know. Would have to see your code.

Greg

Tags for 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