www.pudn.com > neuro.rar > neuro.cpp
procedure dichot_output (finished: booLean);
var i: integer;
begin
check_key;
gotoxy(1,4);
textbackground(7);textcoLor(0);
writeln('Training Cycle',iter,': weight Vector');
writeln; {outputvecs[i][1] then {...if not correct sign}
begin {...cycle ts not success}
finished:=false;
for j:=1 to leninvecs+1 do {...adjust weights +/-}
weightvecs[1][j]:=weightvecs[1][j]+alpha*sgn(sum)*inputvecs[i][j];
end;
end;
dichot_output(finished);
until finished or abort or quittrain;
if not abort then
while not abort and not quittest do {allow testing of new patts}
begin
writeln;
write('Enter a test vector of dimension',Leninvecs,':');
for i:=1 to leninvecs do read(testvec[i]);
readln;
testvec[leninvecs+1]:=1.0;
sum:=0.0;
for i:=1 to leninvecs+1 do
sum:=sum +weightvecs[1][i]*testvec[i];
if sgn(sum)<0.0 then writeln('Classified as pattern 1')
else writeln('Classified as pattern 2');
hitakey;
end;
until quitruns;
end;