📄 trainperceptron.m
字号:
%%% 欺剂飘沸 切嚼 颇老function [newWts] = trainPerceptron(patNum,wts,pats,targ,lrate)nOutputs = size(targ,1);for i = 1:nOutputs, inputVector = pats(:,patNum); targetOutput = targ(i,patNum); totalInput = dot(wts(i,:),inputVector); if (totalInput > 0) activation = 1; else activation = -1; end if (activation > targetOutput) %% unit is on but should be off wts(i,:) = wts(i,:) - lrate * inputVector'; elseif (activation < targetOutput) %% unit is off but should be on wts(i,:) = wts(i,:) + lrate * inputVector'; endend newWts = wts;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -