Borrar filtros
Borrar filtros

Neural Network will not "Learn"

1 visualización (últimos 30 días)
Gil maor
Gil maor el 8 de Mzo. de 2011
Hello All,
As part of a robotic project of main I want to creat a nueral network,
I have started with a simple target function y=2*x but still I cannot get matlab to identify this function.
Any suggestion, Whay am I doing wrong? I'm using matlab 10
net = newff(in,out,[20,10]);
net.trainParam.epochs = 50;
net = train(net,in,out);
Y = sim(net,in);
plot(in,out,'o',in,Y,'x')
Thanks very much
Gil,
  1 comentario
Andreas Goser
Andreas Goser el 8 de Mzo. de 2011
I put your code into the question and delete the answer. This way more people will look at the question.
Can you clarify what "MATLAB 10" is? Release 10 or MATLAB 7.10?

Iniciar sesión para comentar.

Respuestas (2)

Héctor Corte
Héctor Corte el 10 de En. de 2012
I have used your code and it works properly. What kind of error are you getting? I used x on interval [-2,10]. Note that with 20 and 10 neurons your net is by far a oversized network for this task. For example 5 and 3 also works fine.

Greg Heath
Greg Heath el 11 de En. de 2012
>As part of a robotic project of main I want to creat a nueral network, >I have started with a simple target function y=2*x but still I cannot >get matlab to identify this function.
Replace "identify" with "approximate". The former refers to a different kind of problem.
>Any suggestion, Whay am I doing wrong? I'm using matlab 10
>net = newff(in,out,[20,10]);
In general, one hidden layer with H nodes is sufficient where H is determined by trial and error. However, a linear function can be approximated with no hidden layer.
For demo purposes, ignore that fact or be more adventurous and consider y = sqrt(x) and/or y = x^2.
The lowest value of H that can be used will increase with length(x).
>net.trainParam.epochs = 50;
Delete. Just use the default.
>net = train(net,in,out); >Y = sim(net,in);
You didn't take into account that newff automatically scales the inputs and outputs to the range [-1 1].
Read the documentation to understand the defaults.
>plot(in,out,'o',in,Y,'x')
Hope this helps.
Greg

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by