?? example27.m
字號:
%
%==============
%==============
figure('name','訓練過程圖示','numbertitle','off');
P=[1 1.5 1.2 -0.3; -1 2 3 -0.5; 2 1 -1.6 0.9];
T=[0.5 3 -2.2 1.4; 1.1 -1.2 1.7 -0.4; 3 0.2 -1.8 -0.4; -1 0.1 -1.0 0.6];
disp_freq=5;
max_epoch=str2num(max_epoch);
err_goal=str2num(err_goal);
eta=str2num(eta);
lr=eta*maxlinlr(P);
[R,Q]=size(P);
[S,Q]=size(T);
W=rands(S,R);
B=rands(S,1);
%calculate the error
SSE=sumsqr(T-purelin(W*P,B));
fprintf('Before training ,sum squared error=%g.\n',SSE)
%train the network
flops(0);
tp=[disp_freq max_epoch err_goal lr];
[W,B,epochs,errors]=trainwh(W,B,P,T,tp);
W;B;
SSE= sumsqr(T-purelin(W*P,B));
%show the results and the conclusions
ploterr(errors);
fprintf('\n After %0f epochs,sum squared error=%g.\n\n',epochs,SSE);
fprintf('Training took %0f flops.\n',flops);
fprintf('Trained network operates:');
if SSE < err_goal
disp('Adequately.')
else
disp('Inadequately.')
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -