trainperceptron.m
来自「patten regnization source从1-14章能运行」· M 代码 · 共 21 行
M
21 行
%%% 欺剂飘沸 切嚼 颇老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 + =
减小字号Ctrl + -
显示快捷键?