• Tidak ada hasil yang ditemukan

Multilayer Networks - ru

N/A
N/A
Protected

Academic year: 2025

Membagikan "Multilayer Networks - ru"

Copied!
37
0
0

Teks penuh

(1)

Artificial Neural Networks

Input layer

First hidden

layer

Second hidden layer

Output layer

O u t p u t S i g n a l s

I n p u t S i g n a l s

(2)

Commercial ANNs

• Commercial ANNs incorporate three and Commercial ANNs incorporate three and

sometimes four layers, including one or two sometimes four layers, including one or two hidden layers. Each layer can contain from hidden layers. Each layer can contain from

10 to 1000 neurons. Experimental neural 10 to 1000 neurons. Experimental neural

networks may have five or even six layers, networks may have five or even six layers,

including three or four hidden layers, and including three or four hidden layers, and

utilise millions of neurons.

utilise millions of neurons.

(3)

Example

• Character recognition

(4)

Problems that are not linearly separable

• Xor function is not linearly separable

• Using Multilayer networks with back propagation training algorithm

• There are hundreds of training algorithms

for multilayer neural networks

(5)

Multilayer neural networks Multilayer neural networks

A multilayer perceptron is a feedforward neural A multilayer perceptron is a feedforward neural network with one or more hidden layers.

network with one or more hidden layers.

The network consists of an The network consists of an input layerinput layer of source of source neurons, at least one middle or

neurons, at least one middle or hidden layerhidden layer of of computational neurons, and an

computational neurons, and an output layeroutput layer of of computational neurons.

computational neurons.

The input signals are propagated in a forward The input signals are propagated in a forward direction on a layer-by-layer basis.

direction on a layer-by-layer basis.

(6)

Multilayer perceptron with two hidden layers Multilayer perceptron with two hidden layers

Input layer

First hidden

layer

Second hidden

layer

Output layer

O u t p u t S i g n a l s

I n p u t S i g n a l s

(7)

What do the middle layers hide?

What do the middle layers hide?

A hidden layer “hides” its desired output. Neurons A hidden layer “hides” its desired output. Neurons in the hidden layer cannot be observed through the in the hidden layer cannot be observed through the input/output behaviour of the network. There is no input/output behaviour of the network. There is no

obvious way to know what the desired output of the obvious way to know what the desired output of the

hidden layer should be.

hidden layer should be.

(8)

Back-propagation neural network Back-propagation neural network

Learning in a multilayer network proceeds the Learning in a multilayer network proceeds the same way as for a perceptron.

same way as for a perceptron.

A training set of input patterns is presented to the A training set of input patterns is presented to the network.

network.

The network computes its output pattern, and if The network computes its output pattern, and if there is an error

there is an error  or in other words a difference or in other words a difference between actual and desired output patterns

between actual and desired output patterns  the the weights are adjusted to reduce this error.

weights are adjusted to reduce this error.

(9)

In a back-propagation neural network, the learning In a back-propagation neural network, the learning algorithm has two phases.

algorithm has two phases.

First, a training input pattern is presented to the First, a training input pattern is presented to the network input layer. The network propagates the network input layer. The network propagates the

input pattern from layer to layer until the output input pattern from layer to layer until the output

pattern is generated by the output layer.

pattern is generated by the output layer.

If this pattern is different from the desired output, If this pattern is different from the desired output, an error is calculated and then propagated

an error is calculated and then propagated

backwards through the network from the output backwards through the network from the output

layer to the input layer. The weights are modified layer to the input layer. The weights are modified

as the error is propagated.

as the error is propagated.

(10)

Three-layer back-propagation neural network Three-layer back-propagation neural network

Input layer xi

x1

x2

xn

1

2

i

n

Output layer

1

2

k

l

yk y1

y2

yl Input signals

Error signals

wjk

Hidden layer

wij

1 2

j

m

(11)

Step 1

Step 1: Initialisation: Initialisation

Set all the weights and threshold levels of the Set all the weights and threshold levels of the

network to random numbers uniformly network to random numbers uniformly

distributed inside a small range:

distributed inside a small range:

where

where FFii is the total number of inputs of neuron is the total number of inputs of neuron ii in the network. The weight initialisation is done in the network. The weight initialisation is done

on a neuron-by-neuron basis.

on a neuron-by-neuron basis.

The back-propagation training algorithm The back-propagation training algorithm



 

  

i

i F

F

4 . 2

4 , . 2

(12)

Three-layer network Three-layer network

y5 5

x1 1 3

x2

Input layer

Output layer Hidden layer

2 4

3 w13

w24 w23

w24

w35

w45

4

5

1

1

1

w13 = 0.5, w13 = 0.5, ww14 = 0.9, 14 = 0.9, w23 = 0.4, w23 = 0.4, ww24 = 1.0, 24 = 1.0, w35 = w35 = 1.2, 1.2, ww45 = 1.1, 45 = 1.1, 3 = 0.8, 3 = 0.8, 4 = 4 = 0.1 and 0.1 and

5 = 0.3 5 = 0.3

(13)

The effect of the threshold applied to a neuron in the The effect of the threshold applied to a neuron in the hidden or output layer is represented by its weight, hidden or output layer is represented by its weight, , ,

connected to a fixed input equal to connected to a fixed input equal to 1.1.

The initial weights and threshold levels are set The initial weights and threshold levels are set randomly e.g., as follows:

randomly e.g., as follows:

ww1313 = 0.5, = 0.5, ww1414 = 0.9, = 0.9, ww2323 = 0.4, = 0.4, ww2424 = 1.0, = 1.0, ww3535 = = 1.2, 1.2, ww4545 = 1.1, = 1.1, 33 = 0.8, = 0.8, 44 = = 0.1 and 0.1 and 55 = 0.3. = 0.3.

(14)

Assuming the sigmoid activation Function

(15)

Step 2

Step 2: Activation: Activation

Activate the back-propagation neural network by Activate the back-propagation neural network by

applying inputs

applying inputs xx11((pp), ), xx22((pp),…, ),…, xxnn((pp) and desired ) and desired outputs

outputs yyd,1d,1((pp), ), yyd,2d,2((pp),…, ),…, yyd,d,nn((pp).).

((aa) Calculate the actual outputs of the neurons in ) Calculate the actual outputs of the neurons in the hidden layer:

the hidden layer:

where

where nn is the number of inputs of neuron is the number of inputs of neuron jj in the in the hidden layer, and

hidden layer, and sigmoidsigmoid is the is the sigmoidsigmoid activation activation

j

n i

ij i

j p sigmoid x p w p y

1

) ( )

( )

(

(16)

((bb) Calculate the actual outputs of the neurons in ) Calculate the actual outputs of the neurons in the output layer:

the output layer:

where

where mm is the number of inputs of neuron is the number of inputs of neuron kk in the in the output layer.

output layer.

k

m j

jk jk

k p sigmoid x p w p y

1

) ( )

( )

(

Step 2

Step 2: Activation (continued): Activation (continued)

(17)

Class Exercise

(18)

If the sigmoid activation function is used the output of If the sigmoid activation function is used the output of

the hidden layer is the hidden layer is

1

0.5250

/ 1 )

( 1 13 2 23 3 (10.5 10.4 10.8)

3 sigmoid x w x w e y

1

0.8808

/ 1 )

( 1 14 2 24 4 (10.9 11.0 10.1)

4 sigmoid x w x w e y

And the actual output of neuron 5 in the output layer is And the actual output of neuron 5 in the output layer is

And the error is And the error is

1

0.5097

/ 1 )

( 3 35 4 45 5 ( 0.52501.2 0.88081.1 10.3)

5 sigmoid y w y w e y

5097 .

0 5097

. 0

5 0

5

,

y y

e d

(19)

What learning law applies in a multilayer neural network?

) ( )

( )

(p y p p

wjk j k

(20)

Step 3

Step 3: Weight training output layer: Weight training output layer

Update the weights in the back-propagation network Update the weights in the back-propagation network

propagating backward the errors associated with propagating backward the errors associated with

output neurons.

output neurons.

((aa) Calculate the error) Calculate the error

and then the error gradient for the neurons in the and then the error gradient for the neurons in the

output layer:

output layer:

Then the weight corrections:

Then the weight corrections:

Then the new weights at the output neurons:

Then the new weights at the output neurons:

1 ( )

( )

) ( )

( p yk p yk p ek p

k

) ( )

( )

( p y , p y p

ek d k k

) ( )

( )

(p y p p

wjk j k

) ( )

( )

1

( p w p w p

wjk   jk   jk

(21)

Three-layer network for solving the Three-layer network for solving the

Exclusive-OR operation Exclusive-OR operation

y5 5

x1 1 3

x2

Input layer

Output layer 2 4

3 w13

w24 w23

w24

w35

w45

4

5

1

1

1

(22)

The error gradient for neuron 5 in the output layer:The error gradient for neuron 5 in the output layer:

1274 .

0 5097)

. 0 ( 0.5097) (1

0.5097 )

1

( 5

5

5 y y e

Determine the weight corrections assuming that the Determine the weight corrections assuming that the learning rate parameter,

learning rate parameter, , is equal to 0.1:, is equal to 0.1:

0112 .

0 )

1274 .

0 ( 8808 .

0 1 .

5 0

4

45

ww35 yy3 5 0.10.5250( 0.1274) 0.0067 0127 .

0 )

1274 .

0 ( ) 1 ( 1 . 0 )

1

( 5

5

(23)

Apportioning error in the hidden layer

• Error is apportioned in proportion to the weights of the connecting arcs.

• Higher weight indicates higher error

responsibility

(24)

((bb) Calculate the error gradient for the neurons in ) Calculate the error gradient for the neurons in the hidden layer:

the hidden layer:

Calculate the weight corrections:

Calculate the weight corrections:

Update the weights at the hidden neurons:

Update the weights at the hidden neurons:

) ( )

( )

( 1

) ( )

(

1

]

[

y p p w p

p y

p l jk

k

k j

j

j

) ( )

( )

( p x p p

wij i j

) ( )

( )

1

( p w p w p

wij ij ij

Step 3

Step 3: Weight training hidden layer: Weight training hidden layer

(25)

The error gradients for neurons 3 and 4 in the hidden The error gradients for neurons 3 and 4 in the hidden layer:

layer:

Determine the weight corrections:Determine the weight corrections:

0381 .

0 ) 2 . 1 ( 0.1274) (

0.5250) (1

0.5250 )

1

( 3 5 35

3

3 y y w

0.0147 .1

1 4) 0.127 (

0.8808) (1

0.8808 )

1

( 4 5 45

4

4 y y w

0038 .

0 0381

. 0 1 1 .

3 0

1

13

w x

0038 .

0 0381 .

0 1 1 .

3 0

2

23

w x

0038 .

0 0381

. 0 ) 1 ( 1 . 0 )

1

( 3

3

0015 .

0 )

0147 .

0 ( 1 1 .

4 0

1

14

w x

0015 .

0 )

0147 .

0 ( 1 1 .

4 0

2

24

w x

0015 .

0 )

0147 .

0 ( ) 1 ( 1 . 0 )

1

( 4

4

(26)

At last, we update all weights and threshold:At last, we update all weights and threshold:

5038 .

0 0038

. 0 5 .

13 0

13

13 w w

w

8985 .

0 0015

. 0 9 .

14 0

14

14 w w

w

4038 .

0 0038

. 0 4 .

23 0

23

23 w w

w

9985 .

0 0015

. 0 0 .

24 1

24

24 w w

w

2067 .

1 0067

. 0 2 .

35 1

35

35 w w

w

0888 .

1 0112

. 0 1 .

45 1

45

45 w w

w

7962 .

0 0038

. 0 8 .

3 0

3

3

0985 .

0 0015

. 0 1 .

4 0

4

4

3127 .

0 0127

. 0 3 .

5 0

5

5

The training process is repeated until the sum of The training process is repeated until the sum of squared errors is less than 0.001.

squared errors is less than 0.001.

(27)

Step 4

Step 4: Iteration: Iteration Increase iteration

Increase iteration pp by one, go back to by one, go back to Step 2Step 2 and and repeat the process until the selected error criterion repeat the process until the selected error criterion

is satisfied.

is satisfied.

As an example, we may consider the three-layer As an example, we may consider the three-layer

back-propagation network. Suppose that the back-propagation network. Suppose that the

network is required to perform logical operation network is required to perform logical operation

Exclusive-OR

Exclusive-OR. Recall that a single-layer perceptron . Recall that a single-layer perceptron could not do this operation. Now we will apply the could not do this operation. Now we will apply the

three-layer net.

three-layer net.

(28)

Typical Learning Curve Typical Learning Curve

0 50 100 150 200

101

Sum-Squared Error

Sum-Squared Network Error for 224 Epochs

100

10-1

10-2

10-3

10-4

(29)

Final results of three-layer network learning Final results of three-layer network learning

Inputs

x

1

x

2

1

0 1 0

1 1 0 0

0 1 1

Desired output

y

d

0

0.0155

Actual output

y

5

Y

Error

e

Sum of squared

errors

0.9849 e 0.9849 0.0175

 0.0155 0.0151 0.0151

 0.0175

0.0010

(30)

Network represented by McCulloch-Pitts model Network represented by McCulloch-Pitts model

for solving the

for solving the Exclusive-ORExclusive-OR operation operation

y5 5

x1 1 3

x2 2 4

+1.0

1

1

1 +1.0

+1.0 +1.0

+1.5

+1.0

+1.0

+0.5

+0.5

(31)

Accelerated learning in multilayer Accelerated learning in multilayer

neural networks neural networks

A multilayer network learns much faster when the A multilayer network learns much faster when the sigmoidal activation function is represented by a sigmoidal activation function is represented by a

hyperbolic tangent hyperbolic tangent::

where

where aa and and bb are constants. are constants.

Suitable values for

Suitable values for aa and and bb are: are:

aa = 1.716 and = 1.716 and bb = 0.667 = 0.667 e a

Y tanh abX

  1

2

(32)

We also can accelerate training by including a We also can accelerate training by including a momentum term

momentum term in the delta rule: in the delta rule:

where

where  is a positive number (0 is a positive number (0    1) called the 1) called the momentum constant

momentum constant. Typically, the momentum . Typically, the momentum constant is set to 0.95.

constant is set to 0.95.

This equation is called the

This equation is called the generalised delta rulegeneralised delta rule..

) ( )

( )

1 (

)

( p w p y p p

w

jk

   

jk

   

j

 

k

(33)

Learning with an adaptive learning rate Learning with an adaptive learning rate

To accelerate the convergence and yet avoid the To accelerate the convergence and yet avoid the

danger of instability, we can apply two heuristics:

danger of instability, we can apply two heuristics:

Heuristic Heuristic

If the error is decreasing the learning rate

If the error is decreasing the learning rate , should be , should be increased.

increased.

If the error is increasing or remaining constant the If the error is increasing or remaining constant the

learning rate

learning rate , should be decreased., should be decreased.

(34)

Adapting the learning rate requires some changes Adapting the learning rate requires some changes in the back-propagation algorithm.

in the back-propagation algorithm.

If the sum of squared errors at the current epoch If the sum of squared errors at the current epoch exceeds the previous value by more than a

exceeds the previous value by more than a

predefined ratio (typically 1.04), the learning rate predefined ratio (typically 1.04), the learning rate

parameter is decreased (typically by multiplying parameter is decreased (typically by multiplying

by 0.7) and new weights and thresholds are by 0.7) and new weights and thresholds are

calculated.

calculated.

If the error is less than the previous one, the If the error is less than the previous one, the

learning rate is increased (typically by multiplying learning rate is increased (typically by multiplying

by 1.05).

by 1.05).

(35)

Typical Learning Curve Typical Learning Curve

101

Sum-Squared Error

Sum-Squared Network Error for 224 Epochs

100

10-1

10-2

10-3

(36)

Typical learning with adaptive learning rate Typical learning with adaptive learning rate

0 10 20 30 40 50 60 70 80 90 100

Epoch

Training for 103 Epochs

0 20 40 60 80 100 120

0 0.2 0.4 0.6 0.8 1

Epoch

Learning Rate

10-4 10-2 100 102

Sum-Squared Error

10-3 101 10-1

(37)

Typical Learning with Typical Learning with

adaptive learning rate plus momentum adaptive learning rate plus momentum

0 10 20 30 40 50 60 70 80

Epoch

Training for 85 Epochs

0.5 1 2.5

Learning Rate

10-4 10-2 100 102

Sum-Squared Error

10-3 101 10-1

1.5 2

Referensi

Dokumen terkait

By using gabor filters with orientation: 3 and the frequency: 0, 2, 4, and configuration of back-propagation neural network with one hidden layer and one hundred neurons in

In this study, the feed forward back propagation (FFBP), cascade forward back propagation (CFBP) and radial basis function neural network (RBFNN) were used as alternative

This database is used on the face detection subsystem training process (used to obtain PCA projection vectors and Back Propagation Neural Network who have completed

In this paper, Back propagation (BP) and Multi Layer Perceptron (MLP) of the Artificial Neural Network were used to classify carp ( Cyprinus carpio ), tilapia ( Oreochromis niloticus

Penelitian ini menggunakan Metode Neural Network Back Propagation, dengan data training (100 data) yang terdiri atas variable predictor (penutupan IHSG, kurs nilai

Perancangan Artificial Neural Network model Multi Layer Perceptron (MLP) dengan metode pelatihan Back Propagation (BP) terdiri dari 3 neuron pada lapisan input, neuron

The resulting accuracy from classification training process of back propagation neural network using both area ratio and eccentricity parameters is: 100% 72 100% 82 87.80% number of

2.1 Typical Structure of Artificial Neural Network 16 2.2 Training Process of Neural Networks 17 2.3 Feedback Auto-Associative Network 19 2.4 A Simple Feed-Forward Back-Propagation