필터 지우기
필터 지우기

Neural Network will not "Learn"

조회 수: 1 (최근 30일)
Gil maor
Gil maor 2011년 3월 8일
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
Andreas Goser
Andreas Goser 2011년 3월 8일
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?

댓글을 달려면 로그인하십시오.

답변 (2개)

Héctor Corte
Héctor Corte 2012년 1월 10일
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 2012년 1월 11일
>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

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by