Simulation of perceptron and adaline

Solo disponible en BuenasTareas
  • Páginas : 4 (880 palabras )
  • Descarga(s) : 0
  • Publicado : 2 de mayo de 2011
Leer documento completo
Vista previa del texto
Tutorial 3 — Simulation of Perceptron and Adaline

Perceptron
A single adaptive layer of feedforward network of pure threshold logic units.

Linear Separability
Two sets of data in ann-dimensional space are said to be (absolutely) linearly separable if n+1 real weights (including a threshold) exist such that the weighted sum of a datum in one set is always greater than or equal to (greaterthan but not equal to) the threshold and that in the other set is always less tan the threshold.

Learning Rule
1) Initialize weights and threshold randomly 2) Calculate actual output of thePerceptron y = f (Σn wi xi − θ) i=1 (1)

where f (·) is the actuation function and it is either a unipolar or a bipolar threshold logic unit in this case; 3) Adapt weights: for every pattern p wi (k + 1)= wi (k) + η(dp − y p )xp i (2) where wi (k) is the ith weight in kth iteration, dp is the desired output corresponding to pth pattern, η > 0 is the learning rate, and xp is the i ith coordinate ofpth pattern. In fact, we can write (2) in a more compact form as follows: w(k + 1) = w(k) + η(dp − y p )xp which is often used in programming in Matlab. 1 (3)

2

Convergence of Weights 0.8 0.6Weights

w1 w2 Threshold

0.4 0.2 0

0

20

40

60 80 Iteration Number Variation of Error

100

120

1 0.5
Errors

Ew1 Ew2 Ew3

0 −0.5 −1

0

20

40

60 Iteration Number80

100

120

4) Go to step 2) and repeat until w converges. It is important to note that we usually train Perceptron using sequential mode, that is, input the pattern orderly or randomly.AND Example
In the following, we will simulate Perceptron with unipolar threshold logic units to classify AND logic data. The simulation result is shown in the above figure. % Initialization closeall; clear;clc; eta=0.1; % P=4; % w_0=rand(1,3); % % [5.66772800303106

learning rate the number of patterns involved set the initial weights randomly 8.23008314290667 6.73948632095360];

3...
tracking img