Perceptron Learning Rule Program

Perceptron Learning Rule Program - % begin EPOCHS. .. while...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% initializations. .. 'Initializations for Perceptron Learning Rule:' %w =[0 0] %b = 0 EPOCHNUM = 0; e = 1; % define input vectors and targets % target '0' = rabbit % target '1' = bear 'Input and target matrices are defined to' 'compute values in the sequence of' 'rabbit, bear, rabbit, bear, etc. ..' p = [1 3 1 3 2 4 2 4; 4 1 5 2 4 1 5 2] t = [0; 1; 0; 1; 0; 1; 0; 1] w = rand(size(p*t))'; b = rand(size(w,1));
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % begin EPOCHS. .. while (e ~= 0) EPOCHNUM = EPOCHNUM + 1 'Output of summing unit:' n = w * p(:,EPOCHNUM) + b % modelling a hardlimit function 'Output of hardlimit function:' if (n >= 0) a = 1 else a = 0 end % update values 'New values for current EPOCH:' e = t(EPOCHNUM)-a w = w + e * (p(:,EPOCHNUM))' b = b + e end 'Final weight vector and bias point:' w b...
View Full Document

Ask a homework question - tutors are online