perceptron_class2.m

来自「人工神经网络资料」· M 代码 · 共 24 行

M
24
字号
p=[0  0   0  1   1  0   1  1]';
t=[0 0 0 1];
 w=(rand(1,2)-0.5)*2;
 b=(rand(1,1)-0.5)*2;
%w=[0.5 -1 -0.5];b=0.5;
% for j=1:1:10
e=1;j=0;nn=size(t,2);
while abs(e)>1.0e-6
for i=1:1:nn
y=w*p(:,i)+b;
a=hardlim(y);
e=t(i)-a;
w=w+e*p(:,i)';
b=b+e;
j=j+1;
end
endplotpv(p,t)linehandle=plotpc(w,b);drawnow;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?