📄 example33.m
字号:
%example33
%==============
%==============
figure('name','训练过程图示','numbertitle','off');
P=-1:0.1:1;
T=[-0.96 -0.577 -0.0729 0.377 0.641 0.66 0.461 0.1336...
-0.201 -0.434 -0.5 -0.393 -0.1647 0.0988 0.3072...
0.396 0.3449 0.1816 -0.0312 -0.2183 -0.3201];
P2=-1:0.025:1;
[R,Q]=size(P);[S2,Q]=size(T);S1=str2num(S1);
[W1,B1]=rands(S1,R);
[W2,B2]=rands(S2,S1);
A2=purelin(W2*tansig(W1*P2,B1),B2);
%initialize the parameters
disp_freq=20;
max_epoch=str2num(max_epoch);
err_goal=str2num(err_goal);
lr=str2num(lr);
TP=[disp_freq max_epoch err_goal lr];
%training begins
[W1,B1,W2,B2,epochs,errors]=trainbp(W1,B1,'tansig',W2,B2,'purelin',P,T,TP);
%figure;
%ploterr(errors);
SSE=sumsqr(T-purelin(W2*tansig(W1*P,B1),B2));
fprintf('Trained network operates:');
if SSE < err_goal
disp('Adequately.')
else
disp('Inadequately.')
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -