English 中文(简体)
MLP 农村网络没有正确培训,可能与当地最低培训相联。
原标题:MLP Neural network not training correctly, probably converging to a local minimum

I m 成为一个MLP的神经网络,在马特拉布进行后推进。 问题在于,它似乎无法很好地处理曲线问题,而且其程度也与价值相当。 例如,它可达到80%的 co(x),但如果我投入100*cos(x)的话,它根本不会受到训练。

What is even weirder is, that some functions it can train well to, while others it just doesn t work at all.. For example: Well trained: http://img515.imageshack.us/img515/2148/coscox3.jpg

http://img252.imageshack.us/img252/5370/cos2d.jpg” rel=“nofollow” http://img252.imageshack.us/img252/5370/cos2d.jpg (远离长时间)

http://img717.imageshack.us/img717/2145/ex2ug.jpg”rel=“nofollow”http://img717.imageshack.us/img717/2145/ex2ug.jpg

这是试图执行下列行动的algo I m:

这是我的执行:

close all;clc;

j=[4,3,1]; %number neurons in hidden layers and output layer
i=[1,j(1),j(2)];

X=0:0.1:pi;
d=cos(X);

%-----------Weights------------%
%-----First layer weights------%
W1p=rand([i(1)+1,j(1)]);
W1p=W1p/sum(W1p(:));
W1=rand([i(1)+1,j(1)]);
W1=W1/sum(W1(:));

%-----Second layer weights------%
W2p=rand([i(2)+1,j(2)]);
W2p=W2p/sum(W2p(:));
W2=rand([i(2)+1,j(2)]);
W2=W2/sum(W2(:));

%-----Third layer weights------%
W3p=rand([i(3)+1,j(3)]);
W3p=W3p/sum(W3p(:));
W3=rand([i(3)+1,j(3)]);
W3=W3/sum(W3(:));
%-----------/Weights-----------%

V1=zeros(1,j(1));
V2=zeros(1,j(2));
V3=zeros(1,j(3));

Y1a=zeros(1,j(1));
Y1=[0 Y1a];
Y2a=zeros(1,j(2));
Y2=[0 Y2a];

O=zeros(1,j(3));
e=zeros(1,j(3));

%----Learning and forgetting factor-----%
alpha=0.1;
etha=0.1;
sortie=zeros(1,length(X));
while(1)

n=randi(length(X),1);
%---------------Feed forward---------------%

%-----First layer-----%
X0=[-1 X(:,n)];
V1=X0*W1;
Y1a=tanh(V1/2);

%----Second layer-----%
Y1=[-1 Y1a];
V2=Y1*W2;
Y2a=tanh(V2/2);

%----Output layer-----%
Y2=[-1 Y2a];
V3=Y2*W3;
O=tanh(V3/2);
e=d(n)-O;
sortie(n)=O;

%------------/Feed Forward-----------------%

%------------Backward propagation---------%

%----Output layer-----%
delta3=e*0.5*(1+O)*(1-O);
W3n=W3+ alpha*(W3-W3p) + etha * delta3 * W3;

%----Second Layer-----%
delta2=zeros(1,length(Y2a));
for b=1:length(Y2a)
delta2(b)=0.5*(1-Y2a(b))*(1+Y2a(b)) * sum(delta3*W3(b+1,1));
end

W2n=W2 + alpha*(W2-W2p)+ (etha * delta2 *Y1) ;

%----First Layer-----%
delta1=zeros(1,length(Y1a));
for b=1:length(Y1a)
    for m=1:length(Y2a)
          delta1(b)=0.5*(1-Y1a(b))*(1+Y1a(b)) * sum(delta2(m)*W2(b+1,m));


    end
end


W1n=W1+ alpha*(W1-W1p)+ (etha * delta1 *X0) ;                                    
W3p=W3;
W3=W3n;

W2p=W2;
W2=W2n;

W1p=W1;
W1=W1n;

figure(1);
plot(1:length(d),d,1:length(d),sortie);

drawnow;
end

My question is, what can I do to correct it? My guesses so far are, I either have something wrong in the back propagation, specifically in calculating delta and the weights. Or I have the weights initialized wrong (too small, or not dependent on the initial input)..

最佳回答

我不是该领域的专家,但在马特拉布和贾瓦尼文化网络系统方面有一些经验。

我可以说,使用工具箱可以帮助你,它帮助了我知道的其他人。

I can offer a few points of information:

  • 不要指望有线电视新闻网从事所有培训数据的工作,有时数据过于复杂,无法以这种方式进行分类。

  • 您的CNN格式将对趋同的效绩产生巨大影响。

最后:

  • Training algorithms like this will often train better when the various parameters are normalized to +/- 1. cos(x) is normalized, 100*cos*(x) is not. This is because the weighting updates required are much larger, and the training system might be taking very small steps. If you are data with multiple different ranges, then normalization is vital. Might I suggest you start with, at the very least, investigating that
问题回答

暂无回答




相关问题
MATLAB Solving equations problem

I want to solve these equations using MATLAB and I am sure there is a non zero solution. The equations are: 0.7071*x + 0.7071*z = x -0.5*x + 0.7071*y + 0.5*z = y -0.5*x - 0.7071*y +...

Difference between MATLAB s matrix notations

How do you read the following MATLAB codes? #1 K>> [p,d]=eig(A) // Not sure about the syntax. p = 0.5257 -0.8507 -0.8507 -0.5257 d = ...

preventing data from being freed when vector goes out of scope

Is there a way to transfer ownership of the data contained in a std::vector (pointed to by, say T*data) into another construct, preventing having "data" become a dangling pointer after the vector goes ...

Divide two polynomials using MATLAB

I want to divide p(x) by q(x) given that: p(x)=-5x^4+3x^2-6x q(x)=x^2+1 I tried: p=inline( -5*(x^4)+3*(x^2) , x ) p = Inline function: p(x) = -5*(x^4)+3*(x^2) q=inline( x^2+1 , x ) q = ...

matlab deals with Fibbonacci

The Fibonacci series is given as follows: 1, 2, 3, 5, 8, 13, 21, ... How can I write a script which calculates and prints the n-th Fibonacci term (for n>2), where n is inputed by the user. This ...

How do I plot lines between all points in a vector?

I have a vector containing some points in 2-D space. I want MATLAB to plot these points with lines drawn from every point to every other point. Basically, I want a graph with all vertices connected. ...

How do I create a string using a loop variable in MATLAB?

I have a loop like this: for i=1:no %some calculations fid = fopen( c:\out.txt , wt ); %write something to the file fclose(fid); end I want data to be written to different files like ...

热门标签