Professional Documents
Culture Documents
!
!
m
1
j jx w u
j
) (u y b + !
15
he neuron as a simple computing element The neuron as a simple computing element
Diagram of a neuron Diagram of a neuron
Neuron
Y
Input Signals
x
1
x
2
x
n
Output Signals
Y
Y
Y
w
2
w
1
w
n
Weights
16
The neuron computes the weighted sum of the input The neuron computes the weighted sum of the input
signals and compares the result with a signals and compares the result with a threshold threshold
value value, , . If the net input is less than the threshold, . If the net input is less than the threshold,
the neuron output is the neuron output is 1. But if the net input is 1. But if the net input is
greater than or equal to the threshold, the neuron greater than or equal to the threshold, the neuron
becomes activated and its output attains a value +1. becomes activated and its output attains a value +1.
The neuron uses the following transfer or The neuron uses the following transfer or activation activation
function function::
This type of activation function is called a This type of activation function is called a sign sign
function function. .
!
!
n
i
i i
w x X
1
|
,
|
> +
!
X
X
Y
if , 1
if , 1
17
Architecture of a typical artificial neural network Architecture of a typical artificial neural network
Input Layer
Output Layer
Middle Layer
I
n
p
u
t
S
i
g
n
a
l
s
O
u
t
p
u
t
S
i
g
n
a
l
s
Neural Networks NN 1 18
Bias of a Neuron
The bias b has the effect of applying an affine
transformation to the weighted sum u
v = u + b
v is called induced field of the neuron
x2 x1 u !
x1-x2=0
x1-x2= 1
x1
x2
x1-x2= -1
Effect of Bias
Without bias function
With Bias Function
Neural Networks NN 1 20
Bias as extra input
Input
signal
Synaptic
weights
Summing
function
Activation
function
Local
Field
v
Output
y
x
1
x
2
x
m
w
2
w
m
w
1
) (
w
0
x
0
= +1
The bias is an external parameter of the neuron. It can be
modeled by adding an extra input.
b w
x w v j
m
j
j
!
!
!
0
0
..
Neural Networks NN 1 21
Activation Function
There are different activation functions used in different applications. The
most common ones are:
Hard-limiter Piecewise linear Sigmoid Hyperbolic tangent
|
,
|
>
!
0 0
0 1
v if
v if
v
,
|
> >
>
!
2 1 0
2 1 2 1
2 1 1
v if
v if v
v if
v
) exp( 1
1
av
v
+
!
v v tanh !
Neural Networks NN 1 22
Neuron Models
The choice of determines the neuron model. Examples:
step function:
ramp function:
sigmoid function:
with z,x,y parameters
Gaussian function:
'
+
'
'
+
'
!
2
2
1
exp
2
1
) (
W
Q
W T
v
v
) exp( 1
1
) (
y xv
z v
+ +
+ !
,
|
+
>
!
otherwise )) /( ) )( ((
if
if
) (
c d a b c v a
d v b
c v a
v
|
,
|
>
!
c v b
c v a
v
if
if
) (
23
Activation functions Activation functions
Step function
Sign function
+1
-1
0
+1
-1
0 X
Y
X
Y
+1
-1
0 X
Y
Sigmoid function
+1
-1
0 X
Y
Linear function
|
,
|
>
!
0 if , 0
0 if , 1
X
X
Y
step
|
,
|
> +
!
0 if , 1
0 if , 1
X
X
Y
sign
X
sigmoid
e
Y
+
!
1
1
X Y
linear
!
24
Example
Threshold
Inputs
x
1
x
2
Output
Y
Hard
Limiter
w
2
w
1
Linear
Combiner
!
!
n
i
i i
p w p x step p Y
1
) ( ) ( ) (
32
) ( ) ( ) ( p Y p Y p e
d
!
If the error, If the error, ee( (p p), is positive, we need to ), is positive, we need to
increase perceptron output increase perceptron output Y Y( (p p), but if it ), but if it
is negative, we need to decrease is negative, we need to decrease Y Y( (p p). ).
33
Step 3 Step 3: Weight training : Weight training
Update the weights of the perceptron Update the weights of the perceptron
where where is is the the weight weight correction correction at at iteration iteration p p. .
The weight correction is computed by the The weight correction is computed by the delta delta
rule rule::
where where
Step 4 Step 4: Iteration : Iteration
Increase iteration Increase iteration p p by one, go back to by one, go back to Step 2 Step 2 and and
repeat the process until convergence. repeat the process until convergence.
) ( ) ( ) 1 ( p w p w p w
i i i
( + ! +
Perceptrons tarining algorithm (continued) Perceptrons tarining algorithm (continued)
) ( ) ( ) ( p e p x p w
i i
E ! (
) ( ) ( ) ( p Y p Y p e
d
!
34
Example of perceptron learning: the logical operation Example of perceptron learning: the logical operation AND AND
Inputs
x
1
x
2
0
0
1
1
0
1
0
1
0
0
0
Epoch
Desired
output
Y
d
1
Initial
weights
w
1
w
2
1
0.3
0.3
0.3
0.2
0.1
0.1
0.1
0.1
0
0
1
0
Actual
output
Y
Error
e
0
0
1
1
Final
weights
w
1
w
2
0.3
0.3
0.2
0.3
0.1
0.1
0.1
0.0
0
0
1
1
0
1
0
1
0
0
0
2
1
0.3
0.3
0.3
0.2
0
0
1
1
0
0
1
0
0.3
0.3
0.2
0.2
0.0
0.0
0.0
0.0
0
0
1
1
0
1
0
1
0
0
0
3
1
0.2
0.2
0.2
0.1
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0
0
1
0
0
0
1
1
0.2
0.2
0.1
0.2
0.0
0.0
0.0
0.1
0
0
1
1
0
1
0
1
0
0
0
4
1
0.2
0.2
0.2
0.1
0.1
0.1
0.1
0.1
0
0
1
1
0
0
1
0
0.2
0.2
0.1
0.1
0.1
0.1
0.1
0.1
0
0
1
1
0
1
0
1
0
0
0
5
1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0
0
0
1
0
0
0
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0.1
0
Threshold: = 0.2; learning rate: E = 0.1
35
Homework Exercise
By hand train a perceptron to learn an 'or'
function (write down the training sequence)
Train one to learn inference
Train one to learn the XOR function
36
The aim of the perceptron is to classify inputs, The aim of the perceptron is to classify inputs,
x x
11
, , x x
22
, . . ., , . . ., x x
n n
, into one of two classes, say , into one of two classes, say
AA
11
and and AA
22
. .
In the case of an elementary perceptron, the n In the case of an elementary perceptron, the n- -
dimensional space is divided by a dimensional space is divided by a hyperplane hyperplane into into
two decision regions. The hyperplane is defined by two decision regions. The hyperplane is defined by
the the linearly separable linearly separable function function::
0
1
!
!
n
i
i i
w x
37
Linear separability in the perceptrons Linear separability in the perceptrons
x
1
x
2
Class A
2
Class A
1
1
2
x
1
w
1
+ x
2
w
2
= 0
(a) Two-input perceptron. (b) Three-input perceptron.
x
2
x
1
x
3
x
1
w
1
+ x
2
w
2
+ x
3
w
3
= 0
1
2