Professional Documents
Culture Documents
Neural Processing
Learning
Neural Networks
Lecture 2:Single Layer Classifiers
H.A Talebi
Farzaneh Abdollahi
Winter 2011
Neural Networks
Lecture 2
1/58
Outline
Neural Processing
Learning
Neural Processing
Classification
Discriminant Functions
Learning
Hebb Learning
Perceptron Learning Rule
ADALINE
Neural Networks
Lecture 2
2/58
Outline
Neural Processing
Learning
Neural Processing
I
Neural Networks
Lecture 2
3/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
4/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
5/58
Outline
Neural Processing
Learning
Pattern Classification
The goal of pattern classification is to assign a physical object, event, or
phenomenon to one of predefined classes.
I Pattern is quantified description of the physical object or event.
I
Neural Networks
Lecture 2
6/58
Outline
Neural Processing
Learning
Pattern Classification
I
Neural Networks
Lecture 2
7/58
Outline
Neural Processing
Learning
Pattern Classification
I
The fig. depicts two simple method to generate the pattern vector
I
Neural Networks
Lecture 2
8/58
Outline
Neural Processing
Learning
X = [20 10] 2 , X = [4 6] 3
Neural Networks
Lecture 2
9/58
Outline
Neural Processing
Learning
Discriminant Functions
I
Assume gi (X ) is scalar.
within the region i , ith discriminant function have the largest value.
Neural Networks
Lecture 2
10/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
11/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
12/58
Outline
Neural Processing
Learning
Pattern Classification
The patterns like first example are linearly separable and in second
example are nonlinearly separable
Neural Networks
Lecture 2
13/58
Outline
Neural Processing
Learning
Linear Machine
I
The classifier using the discriminant function (1) is called Linear Machine.
Neural Networks
Lecture 2
(1)
14/58
Outline
Neural Processing
Learning
Linear Machine
I
x T x is independent of i
We had gi (x) = wT
i x + win+1
= pij
1
= piT pi ,
2
i = 1, ..., R, j = 1, ..., n
Neural Networks
Lecture 2
(2)
15/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
16/58
Outline
Neural Processing
Learning
Example
I
Center of gravity
ofthe prototypes
a priori
are known
10
2
5
p1 =
, p2 =
, p3 =
2
5
5
Using (2) for R = 3, the weights are
10
2
5
w1 = 2 , w2 = 5 , w3 = 5
52
14.5
25
Neural Networks
Lecture 2
17/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
18/58
Outline
Neural Processing
Learning
Bias or Threshold?
I
Neural Networks
Lecture 2
19/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
(4)
20/58
Outline
Neural Processing
Learning
If R linear functions
gi (x) = w1 x1 + w2 x2 + ... + wn xn + wn+1 , i = 1, ..., R exists s.t
gi (x) > gj (x) x i , i, j = 1, ..., R, i 6= j
the pattern set is linearly separable
Example: AND: x2 = x1 + 1 (b = 1, w1 = 1, w2 = 1)
Example: OR: x2 = x1 1 (b = 1, w1 = 1, w2 = 1)
Neural Networks
Lecture 2
21/58
Outline
Neural Processing
Learning
Learning
I
The error between actual and desired response is used to correct and
adjust the weights.
It rewards accurate classifications/ associations and punishes those
yields inaccurate response.
Neural Networks
Lecture 2
22/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
23/58
Outline
Neural Processing
Learning
General learning rule is the weight vector wi = [wi1 wi2 ... win ]T
increases in proportion to the product of input x and learning signal r
wik+1 = wik + wik
wik
= cr k (wik , x k )x k
Neural Networks
Lecture 2
24/58
Outline
Neural Processing
Learning
Hebb Learning
I
Neural Networks
Lecture 2
25/58
Outline
Neural Processing
Learning
The general idea is an old one, that any two cells or systems of cells
that are repeatedly active at the same time will tend to become
associated, so that activity in one facilitates activity in the other.
(Hebb 1949, p. 70)
Hebbs principle is a method of learning, i.e., adjust the weights
between model neurons.
The weight between two neurons increases if the two neurons activate
simultaneously and reduces if they activate separately.
I
I
(5)
cxik y k
Neural Networks
Lecture 2
26/58
Outline
Neural Processing
Learning
b k+1
bk + y k
Neural Networks
Lecture 2
27/58
Outline
Neural Processing
Learning
Example: And
Consider w0 = [0 0 0]
x2 = x1 1
Neural Networks
w 1 = [1 1 1]
Lecture 2
28/58
Outline
Neural Processing
assume
x2 b
1
0
1
0
Learning
Now
x1
1
1
0
0
Pattern 1:w 1 = [1 1 1]
Pattern 2:w 2 = [1 0 1] w 2 = [0 1 0]
Pattern 3:w 3 = [0 1 1] w 3 = [0 0 1]
Pattern 4:w 4 = [0 0 1] w 4 = [0 0 2]
Neural Networks
Lecture 2
29/58
Outline
Neural Processing
assume
x2 b
1
-1
1
-1
Learning
Now
x1
1
1
-1
-1
Pattern 1:w 1 = [1 1 1]
and p4 )
Neural Networks
Lecture 2
30/58
Outline
Neural Processing
Learning
Learning is supervised.
The weights are updated based the error between the system output
and desired output
rk
Wik
= d k ok
= c(dik oik )x k
(6)
Based on this rule weights are adjusted iff output oik is incorrect.
The learning is repeated until the output error is zero for every
training pattern
It is proven that by using Perceptron rule the network can learn what
it can present
If there are desired weights to solve the problem, the network weights
converge to them.
Neural Networks
Lecture 2
31/58
Outline
Neural Processing
Learning
In classification, consider R = 2
I
b=0
(7)
T
I
I
(8)
Neural Networks
Lecture 2
32/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
33/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
34/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
35/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
36/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
37/58
Outline
Neural Processing
Learning
I
I
Choose c > 0
Initialized weights at small random values, w is (n + 1) 1
Initialize counters and error: k 1, p 1, E 0
Training cycle begins here. Set y yp , d dp , o = sgn(w T y ) (sgn
is sign function)
5. Update weights w w + 21 c(d o)y
6. Find error: E 21 (d o)2 + E
7. If p < P then p p + 1, k k + 1, go to step 4, otherwise, go to
step 8.
8. If E = 0 the training is terminated, otherwise E 0, p 1 go to
step 4 for new trainingNeural
cycle.
H. A. Talebi, Farzaneh Abdollahi
Networks
Lecture 2
38/58
Outline
Neural Processing
Learning
Assume W 0 = 0
Neural Networks
Lecture 2
39/58
Outline
Neural Processing
Learning
(9)
Multiply (9) by W T
W T W k+1 = W T W k W T y =W T W k+1 W T W k +
(10)
(W T W n )2
kW k2
n2 2
B
(11)
where kW k2 = B
H. A. Talebi, Farzaneh Abdollahi
Neural Networks
Lecture 2
40/58
Outline
Neural Processing
Learning
(13)
where ky k2 M
Neural Networks
Lecture 2
41/58
Outline
Neural Processing
Learning
(14)
n2 2
nM
B
So n is bounded
Neural Networks
Lecture 2
42/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
43/58
Outline
Neural Processing
Learning
I
I
Choose c > 0
Initialized weights at small random values, W = [wij ] is R (n + 1)
Initialize counters and error: k 1, p 1, E 0
Training cycle begins here. Set y yp , d dp , oi = sgn(wiT y ) for
i = 1, ..., R (sgn is sign function)
5. Update weights wi wi + 21 c(di oi )y for i = 1, ..., R
6. Find error: E 21 (di oi )2 + E for i = 1, ..., R
7. If p < P then p p + 1, k k + 1, go to step 4, otherwise, go to
step 8.
8. If E = 0 the training is terminated, otherwise E 0, p 1 go to
step 4 for new trainingNeural
cycle.
H. A. Talebi, Farzaneh Abdollahi
Networks
Lecture 2
44/58
Outline
Neural Processing
Learning
Example
Class 2 [2 5]0
-42
14.5
-60
Class 3 [5 5]0
-92
-49.5
25
So the thresholds values:w13 , w23 , and w33 are 52, 14.5, and 25,
respectively.
Neural Networks
Lecture 2
45/58
Outline
Neural Processing
Learning
y1 is input:
10
sgn([1 2 0] 2 ) = 1
1
10
sgn([0 1 2] 2 ) = 1
1
10
sgn([1 3 1] 2 ) = 1
1
Neural Networks
Lecture 2
46/58
Outline
Neural Processing
y2 is input:
Learning
2
sgn([1 2 0] 5 ) = 1
1
2
sgn([0 1 2] 5 ) = 1
1
2
sgn([9 1 0] 5 ) = 1
1
Neural Networks
Lecture 2
47/58
Outline
Neural Processing
y3 is input:
Learning
5
sgn([1 3 1] 5 ) = 1
1
5
sgn([0 1 2] 5 ) = 1
1
5
sgn([9 1 0] 5 ) = 1
1
First learning cycle is finished but the error is not zero, so the training
is not terminated
Neural Networks
Lecture 2
48/58
Outline
Neural Processing
Learning
= sgn(5x1 + 3x2 5)
o2
= sgn(x2 2)
o3
= sgn(9x1 + x2 )
Neural Networks
Lecture 2
49/58
Outline
Neural Processing
Learning
Continuous Perceptron
I
In many cases the output is not necessarily limited to two values (1)
Neural Networks
Lecture 2
50/58
Outline
Neural Processing
Learning
2(w w ), dw 2 = 2
Neural Networks
Lecture 2
51/58
Outline
Neural Processing
Learning
OE (w ) = (d o)f (net)
net = w T y
OE = (d
(net)
wi = yi for
o)f 0 (net)y
(net)
w1
(net)
w2
..
.
(net)
wn+1
i = 1, ..., n + 1
Neural Networks
Lecture 2
52/58
Outline
Neural Processing
Learning
The TLU activation function is not useful, since its time derivative is
always zero and indefinite at net = 0
2
1
1 + exp(net)
2exp(net)
1
= (1 f (net)2 )
2
(1 + exp(net))
2
o = f (net), therefore,
1
OE (w ) = (d o)(1 o 2 )y
2
Neural Networks
Lecture 2
53/58
Outline
Neural Processing
Learning
(15)
Neural Networks
Lecture 2
54/58
Outline
Neural Processing
Learning
1.
2.
3.
4.
5.
6.
7.
8.
Neural Networks
Lecture 2
55/58
Outline
Neural Processing
Learning
Neural Networks
Lecture 2
56/58
Outline
Neural Processing
Learning
(16)
x11
x21
..
.
x12
x22
..
.
...
...
..
.
x1n
x2n
..
.
xm1
xm2
...
xmn
Neural Networks
1
1
w1
w2
..
.
b
Lecture 2
d1
d2
..
.
dm
57/58
Outline
Neural Processing
Learning
x T xw = x T d w = x d
I
This learning method is also based in min least square error method
between output and desired signal
Neural Networks
Lecture 2
58/58