Neural network for supervised learning Ricco RAKOTOMALALA Ricco - - PowerPoint PPT Presentation

neural network for supervised learning ricco rakotomalala
SMART_READER_LITE
LIVE PREVIEW

Neural network for supervised learning Ricco RAKOTOMALALA Ricco - - PowerPoint PPT Presentation

Neural network for supervised learning Ricco RAKOTOMALALA Ricco Rakotomalala 1 Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/ Biological metaphor Human brain working Transmission of information and learning process Important


slide-1
SLIDE 1

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

1

Neural network for supervised learning Ricco RAKOTOMALALA

slide-2
SLIDE 2

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

2

Biological metaphor

Human brain working Transmission of information and learning process Important things to retain

  • Receiving information (signal)
  • Activation and processing by a neuron
  • Transmission to other neurons (if the signal is enough strong)
  • In the long run: strengthening of some connections  LEARNING
slide-3
SLIDE 3

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

3

Mc Colluch and Pitts’ model Single-layer perceptron

 

) ( ), ( 1    Y

Binary problem (positive vs. negative)

X0=1 X1 X2 X3

a0 a1 a2 a3

Input layer Output layer weights

Bias Input Variables

Prediction model and classification rule

3 3 2 2 1 1

) ( x a x a x a a X d     Y ELSE 1 Y THEN d(X) IF   

The single-layer perceptron is a linear classifier

Transfer function Activation function – Heaviside step function ) (X d     1

slide-4
SLIDE 4

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

4

X0=1

X1 X2 X3

a0 a1 a2 a3

Learning algorithm – Single-layer perceptron

How to calculate the weights from a data set (Y ; X1, X2, X3) (1) Criterion to optimize? (2) Optimization process?

Draw a parallel with the least squares

  • regression. A neural network can be used for

the regression (linear transfer function)

(1) Minimizing of the prediction error (2) Error correction learning procedure

slide-5
SLIDE 5

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

5

Example – Learning the logical AND function

X1 X2 Y 1 1 1 1 1

Instructive example - The first applications are from the computer science area.

Dataset

1

  • 0.5
  • 0.3
  • 0.1

0.1 0.3 0.5 0.7 0.9 1.1 1.3 1.5

  • 0.5

0.5 1 1.5

2D representation (scatter plot)

Main steps: 1. Mix up randomly the instances of the learning set 2. Initialize the weights (small random value) 3. For each instance of the training set

  • Calculate the output of the perceptron
  • If the prediction is wrong, update the weights

4. Until convergence (termination condition is satisfied)

Sequential learning procedure An instance may be processed a few times !!!

slide-6
SLIDE 6

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

6

Example AND (1)

Initialize (randomly) the weights:

05 . ; 2 . ; 1 .

2 1

   a a a

Decision boundary : . 2 . 4 2 05 . 2 . 1 .

1 2 1

       x x x x 1

  • 6
  • 4
  • 2

2 4 6

  • 0.5

0.5 1 1.5

Update rule of the weights

For each instance which is processed

j j j

a a a   

Error

It enables to determine if we correct the weights or not

Strength of the signal

 

j j

x y y a ˆ    

with

Learning rate parameter

It determines the intensity of the correction What is the good value? Too small  processing is too slow Too high  oscillation A rule of thumb, about 0.05 ~ 0.15 (0.1 for our example)

slide-7
SLIDE 7

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

7

Example AND (2)

           1

2 1

y x x x

One instance of the dataset Calculate the output

1 ˆ 1 . 05 . 2 . 1 1 .         y

Error => Update the weights

     

                        1 1 . 1 1 . 1 . 1 1 1 .

2 1

a a a

New decision boundary:

. . 4 05 . 2 . .

1 2 2 1

       x x x x

1

  • 6
  • 4
  • 2

2 4 6

  • 0.5

0.5 1 1.5

slide-8
SLIDE 8

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

8

Example AND (3)

           1 1

2 1

y x x x

Other instance Calculate the output

1 ˆ 2 . 05 . 1 2 . 1 .         y

Error => update the weights

     

                         1 1 . 1 . 1 1 1 . 1 . 1 1 1 .

2 1

a a a

New decision boundary:

. 2 . 2 05 . 1 . 1 .

1 2 2 1

        x x x x

1

  • 6
  • 4
  • 2

2 4 6

  • 0.5

0.5 1 1.5

slide-9
SLIDE 9

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

9

Example AND (4) – Termination condition

Decision boundary:

. 2 . 2 05 . 1 . 1 .

1 2 2 1

        x x x x

1

  • 6
  • 4
  • 2

2 4 6

  • 0.5

0.5 1 1.5

Convergence?

(1) No correction is made whatever the instance handled (2) The error rate no longer decreases "significantly“ (3) The weights are "stable“ (4) We set a maximum number of iterations (5) We set a minimum error to achieve Note: What happens if we process again (x1=1 ; x2=0)?

           1 1

2 1

y x x x

Other instance Calculate the output

ˆ 05 . 1 05 . 1 . 1 1 .           y

Good prediction => no update

     

                    1 1 . 1 . 1 1 .

2 1

a a a

No correction here. Why? See the decision boundary in the scatter plot.

slide-10
SLIDE 10

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

10

Estimation of the conditional probability P(Y/X) Sigmoid transfer function

The perceptron provides a classification rule But in some circumstances, we need the estimation of P(Y/X)

Transfer function Heaviside function ) (X d     1 Transfer function Sigmoid function ) (X d     1

) ( 1 1 ) ( X d v e v g

v

  

The decision rule becomes: IF g(v) > 0.5 THEN Y=1 ELSE Y=0

slide-11
SLIDE 11

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

11

Consequence of the using a derivable real function as activation function Modification of the optimization criterion

X0=1

X1 X2 X3

a0 a1 a2 a3  

) ( ) ( ˆ x d f v g y  

Output of the network

Least mean squares criterion

 

2

) ( ˆ ) ( 2 1 

 

 

  y y E

But we use always the sequential learning procedure!

slide-12
SLIDE 12

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

12

Gradient descent optimization algorithm

The derivative of the sigmoid function

)) ( 1 )( ( ) ( ' v g v g v g  

Optimization: derivative

  • f the objective function

(criterion) with respect to the weights

) ( )] ( [ ' )] ( ˆ ) ( [    

j i j

x v g y y a E       

Update rule of the weights for each processed instance (Widrow-Hoff learning rule

  • r Delta rule)

j j j

x v g y y a a ) ( ' ) ˆ (    

Gradient: Computing the weights in the direction which minimizes E

The convergence toward the minimum is good in practice Ability to handle correlated input variables Ability to handle large datasets (rows and columns) Updating the model is easy if new labeled instances are available

slide-13
SLIDE 13

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

13

Multiclass perceptron (K the number of classes, K > 2)

(1) Dummy coding of the output

k k

y y iif y  1

J k J k k k

x a x a a v

, 1 , 1 ,

    

with (2) « Output » for each neuron in output layer

] [ ˆ

k k

v g y 

(4) Classification rule

k k k

y k iif y y ˆ max arg * ˆ

*

 

(3) P(Y/X)

] [ ) / (

k k

v g X y Y P   Minimizing the mean squared error By processing K perceptrons in parallel

 



 

 

K k k k

y y E

1 2

) ( ˆ ) ( 2 1

X0=1

X1 X2 X3

1

ˆ y

2

ˆ y

3

ˆ y

slide-14
SLIDE 14

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

14

Example on the "breast cancer" dataset (SIPINA tool)

Set the input variables on the same scale (standardization, normalization, etc.) Sometimes, it is useful to partition the data set in three parts: training set (learning of the weights), validation set (to monitor the error rate), test set (to estimate the generalization performance) The settings must be handled with care (learning rate, stopping rule, etc.)

Weights Evolution

  • f the

error rate

slide-15
SLIDE 15

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

15

Death and resurrection of the perceptron - The XOR problem

X1 X2 Y 1 1 1 1 1 1

Dataset

1 1

  • 0.5
  • 0.3
  • 0.1

0.1 0.3 0.5 0.7 0.9 1.1 1.3 1.5

  • 0.5

0.5 1 1.5

Not linearly separable (Minsky & Papert, 1969)  The perceptron cannot handle some kinds of

  • problems. It is the end of

the perceptron...

(1) (2)

X0=1

X1 X2 X3

X0=1

Input layer Output layer Hidden layer

A combination of several linear separators provides a global non- linear classifier (Rumelhart, 1986) Multilayer perceptron (MLP)

We can have several hidden layers (but this is unusual)

slide-16
SLIDE 16

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

16

MLP – Formulas

Representation power: the MLP can represent any boolean function if we set enough neurons in the hidden layer.

From Input layer  Hidden layer

3 3 2 2 1 1 2 3 3 2 2 1 1 1

x b x b x b b v x a x a x a a v        

Output of the hidden layer

2 1

1 1 ) ( 1 1 ) (

2 2 1 1 v v

e v g u e v g u

 

     

From the hidden layer  Output layer 2 2 1 1

u c u c c z   

Output of the MLP z

e z g y

   1 1 ) ( ˆ

X0=1

X1 X2 X3

X0=1

a0 a1 a2 a3 b0 b1 b2 b3 c0 c1 c2

slide-17
SLIDE 17

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

17

MLP – Learning the weights through back propagation of error

Generalization of the Widrow-Hoff learning rule

Output: Measure the error (for one instance) Correcting the weights from the hidden layer to the output layer. Back propagation of the correction to the weights from the input layer to the hidden layer.

The back propagation algorithm is efficient in the most of cases, even if the problem of local minima is not negligible. We must normalize (or standardize) the input variables and choose carefully the learning rate. Various sophisticated approaches to avoid local minima exist in the literature.

X0=1

X1 X2 X3

X0=1

slide-18
SLIDE 18

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

18

MLP – An example of non linear problem

X0=1 X1 X2

X0=1

21.46

  • 11.32
  • 0.76

27.00 17.68

  • 20.10
  • 36.83
  • 38.95

45.03

negatif positif X1 vs. X2 Control variable : C_Y 1 0.95 0.9 0.85 0.8 0.75 0.7 0.65 0.6 0.55 0.5 0.45 0.4 0.35 0.3 0.25 0.2 0.15 0.1 0.05 1

x1 x2

negatif positif u1 vs. u2 Control variable : Y 1 1

u1 u2

Another point of view: the

  • utput of the hidden layer

defines a new representation space where the classes are linearly separable.

Two neurons in the hidden layer = two straight lines in the original 2-dimensional representation space

slide-19
SLIDE 19

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

19

MLP – Pros and Cons

Very efficient classifier (if well parameterized) Sequential learning process (among others, easy to update) Scalability (ability to handle very large dataset) Black box model (no information about the influences of the input variables) The parameters are hard to determine (e.g. number of neurons in hidden layer) Problem of convergence in some situations (local minima) Overfitting (use absolutely a validation set for monitoring the error rate)

slide-20
SLIDE 20

Ricco Rakotomalala Tutoriels Tanagra - http://tutoriels-data-mining.blogspot.fr/

20

References

“Neural network” Tutorial slides by Andrew Moore http://www.autonlab.org/tutorials/neural.html “Perceptron Learning Rule” Martin Hagan, http://hagan.okstate.edu/4_Perceptron.pdf “Machine Learning” Tom Mitchell, Ed. Mc Graw-Hill International, 1997. “Introduction to machine learning” Nils Nilsson, 1996, http://robotics.stanford.edu/people/nilsson/mlbook.html