• Aucun résultat trouvé

• lin ´eaires: g ( x ) = w

N/A
N/A
Protected

Academic year: 2022

Partager "• lin ´eaires: g ( x ) = w"

Copied!
40
0
0

Texte intégral

(1)

Objectif

d ´eterminer directement les fonctions discriminantes

lin ´eaires: g ( x ) = w

0

+ ∑

d

i=1

w

i

x

i

= w

t

x + w

0

lin ´eaires g ´en ´eralis ´ees: g ( x ) =

d

i=1

a

i

y

i

( x ) = a

t

y

en minimisant le risque empirique

(2)

Fonctions discriminantes lin ´eaires

2

Justifications

parfois optimal

facile `a calculer

candidates pour des classifieurs initiales

aborder quelques principes importants

(3)

fonction de d ´ecision:

f ( x ) =

C

1

si g ( x ) > 0 , C

2

si g ( x ) < 0 =

C

1

si w

t

x > w

0

, C

2

si w

t

x < w

0

x0=1

x1

. . .

w2 w0

w1

wd

g(x)

x2

. . .

xd

unit´e de biais unit´e de sortie

unit´es d’entr´ee

(4)

Fonctions discriminantes lin ´eaires

4

G ´eom ´etrie – deux classes

fronti `ere de d ´ecision H est un hyperplan:g ( x ) = 0

x

1

, x

2

H: w

t

( x

1

x

2

) = 0

r ´egions de d ´ecision: R

1

:cot ´e positif, R

2

:cot ´e n ´egatif

r = distance alg ´ebrique de x et H:

x = x

p

+ r w w

g ( x ) = w

t

x + w

0

= r w r = g ( x )

w

(5)

G ´eom ´etrie – deux classes

x

g( x ) = 0 w

x

1

x

2

x

3

w

0

/ || w ||

r

H

x

p

R

1

R

2

(6)

Fonctions discriminantes lin ´eaires

6

G ´eom ´etrie – multiclasses

C

i

/ non C

i

ω

1

not ω1

ω1

not ω2

ω2

not ω3 ω3

not ω4

ω4

ω

2

ω

4

ω

3

r´egion ambigue

(7)

G ´eom ´etrie – multiclasses

N ( N 1 )/ 2 fonctions discriminantes

ω1

ω1

ω1

ω2

ω2

ω2

ω3

ω3

ω3

ω4

ω4 ω4

ω

3

ω

2

ω

1

ω

4

H13

H12

H14

H23 H24

H34

r´egion ambigue

(8)

Fonctions discriminantes lin ´eaires

8

Fonctions discriminantes lin ´eaires

machine lin ´eaire: g

j

( x ) = w

tj

x + w

j0

, j = 1 ,..., N

fronti `eres de d ´ecision H

i,j

:g

i

( x ) = g

j

( x )

( w

i

w

j

) est orthogonal `a H

i,j

r ( x , H

i,j

) = g

i

( x ) g

j

( x )

w

i

w

j

(9)

Fonctions discriminantes lin ´eaires

R

1

R

2

R

3

R

4

R

5

ω

1

R

2

R

3

R

1

ω

2

ω

1

ω

3

ω

5

ω

2

ω

3

ω

4

H

15

H

25

H

24

H

14

H

35

H

13

H

34

H

23

H

12

H

23

H

13

(10)

Fonctions discriminantes lin ´eaires

10

Fonctions discriminantes lin ´eaires g ´en ´eralis ´ees:

g ( x ) =

d i ∑ = 1

a i y i ( x ) = a t y

exemple: fonction discriminante quadratique:

g ( x ) = w

0

+ ∑

d

i=1

w

i

x

i

+ ∑

d

i=1 d

j=1

w

i j

x

i

x

j

fronti `ere de d ´ecision: hyperquadrique

(11)

Fonctions discriminantes lin ´eaires g ´en ´eralis ´ees

exemple: g ( x ) = a

1

+ a

2

x + a

3

x

2

, y =

 1 x x

2

0

-1 0

1 2

y2

0 2 4

y3

0.5 1

1.5 2

2.5

y1

1

-1 0 2

-2 x

R1

R1 R2

y = 1

( )

xx2

R2

R1

ˆ

ˆ

(12)

12

exemple: y =

x

1

x

2

α x

1

x

2

y

2

w

R

2

R

1

R

1

R

2

R

1

x

1

x

2

x

1

x

2

y

1

y

3

y = x ( )

1

x α

2

x

1

x

2

H ˆ

ˆ

ˆ

(13)

Vecteur augment ´e

g ( x ) = w

0

+ ∑

d

i=1

w

i

x

i

= ∑

d

i=0

w

i

x

i

( x

0

= 1 )

g ( x ) =

d i

=1

a

i

y

i

, d = d + 1, y =

 

  1 x

1

...

x

d

 

  , a =

 

  w

0

w

1

...

w

d

 

  =

 

  w

0

w

 

 

(14)

Fonctions discriminantes lin ´eaires

14

Vecteur augment ´e

y1

y2

y0

a

y0=1

R1

R2

y0=0

y=01

y2=0

fronti

`ere de d´ecision

(15)

S ´eparabilit ´e lin ´eaire

D

n

= ( y

1

, z

1

),..., ( y

n

, z

n

)

, z

i

=

1 si y

i

est classifi ´e C

1

1 si y

i

est classifi ´e C

2

g ( x ) = a

t

y s ´epare D

n

sans erreur:

a

t

y

i

z

i

> 0 , i = 1 ,..., n

a: vecteur s ´eparateur, vecteur de solution

(16)

Fonctions discriminantes lin ´eaires

16

S ´eparabilit ´e lin ´eaire

y

1

y

2

y

1

y

2

a a

r´egion de r´egion de

solution solution

plans´eparateur

plan”s´eparateur”

(17)

Marge de s ´eparation:

m i = g ( x i ) z i = a t yz i

S ´eparation avec une marge b:

m i = a t y i z i > b , i = 1 ,..., n

(18)

Fonctions discriminantes lin ´eaires

18

Marge de s ´eparation

y

1

y

2

y

3

a

1

a

2

a

2

a

1

y

1

y

2

y

3

b/ || y

2

||

b/ || y

1

||

b/ || y ||

3

}

}

}

r´egion de r´egion de

solution solution

(19)

Proc ´edures de descente de gradient

fonction de crit `ere: J ( a ) – minimis ´ee si a est une solution

a ( k + 1 ) = a ( k ) η( k ) J ( a ( k ))

η( k ) : taux d’apprentissage

D ESCENTE D E G RADIENT S IMPLE ( Θ , η (·), a

0

)

1 a a

0

2 k 0 3 faire

4 k k + 1

5 a a η( k ) J ( a )

6 jusqu’ `a | η ( k ) J ( a )| < Θ

7 retourner a

(20)

Fonctions discriminantes lin ´eaires

20

Descente de Newton

J ( a ) J ( a ( k )) + J

t

( a a ( k )) + 1

2 ( a a ( k ))

t

H ( a a ( k ))

matrice hessienne: H

i j

= δ

2

J δ a

i

δ a

j

a ( k + 1 ) = a ( k ) H

1

J

D ESCENTE D E N EWTON (Θ, a

0

)

1 a a

0

2 faire

3 a a H

1

J ( a )

4 jusqu’ `a | H

1

J ( a )| < Θ

5 retourner a

(21)

Descente de Newton

a

1

a

2

J(a)

(22)

Fonctions discriminantes lin ´eaires

22

Le perceptron

J

p

( a ) = ∑

n

i=1

I

{atyizi0}

(− a

t

y

i

z

i

)

J

p

= ∑

n

i=1

I

{atyizi0}

(− y

i

z

i

)

a ( k + 1 ) = a ( k ) + η( k ) ∑

ni=1

I

{atyizi0}

y

i

z

i

(23)

Le perceptron

P ERCEPTRON B ATCH ( Θ , η (·), a

0

)

1 a a

0

2 k 0 3 faire

4 k k + 1

5 a a + η( k ) ∑

ni=1

I

{atyizi0}

y

i

z

i

6 jusqu’ `a | η ( k ) ∑

ni=1

I

{atyizi0}

y

i

z

i

| < Θ

7 retourner a

(24)

Fonctions discriminantes lin ´eaires

24

Fonctions de crit `ere

-2 0 2

4 -2

0 2

4 0

100

-2 0 2

4 -2

0 2

4 0

5 -2 0 2 4 -2

0 2

4 0

1 2 3

-2 0 2 4 -2

0 2

4 0

5 10

y1 y1

y1 y1

y2 y2

y2 y2

y3 y3

y3 y3

a2 a2

a2 a2

a1 a1

a1 a1

Jp(a)

Jq(a) Jr(a)

J(a)

r´egion de r´egion de

r´egion de r´egion de

solution solution

solution solution

(25)

1 a a

0

2 k 0 3 faire

4 k ( k + 1 ) mod n

5 si a

t

y

k

z

k

0 alors y

k

mal classifi´e 6 a a + y

k

z

k

7 jusqu’ `a

ni=1

I

{atyizi0}

= 0 pas d’erreur 8 retourner a

Th ´eor `eme

Si l’ensemble d’entraˆınement est lin ´eairement s ´eparable, l’algorithm

P ERCEPTRON E N L IGNE se termine `a une vecteur de solution apr `es

un nombre fini de corrections.

(26)

Fonctions discriminantes lin ´eaires

26

Le perceptron en-ligne, avec marge, d’incr ´ement variable

P ERCEPTRON E N L IGNE M ARGE V ARIABLE (η(·), a

0

, b)

1 a a

0

2 k 0 3 faire

4 k k + 1 5 k

k mod n

6 si a

t

y

k

z

k

b alors 7 a a + η( k ) y

k

z

k

8 jusqu’ `a

ni=1

I

{atyizib}

= 0 pas d’erreur par rapport `a la marge b

9 retourner a

(27)

Conditions de convergence

η( k ) 0

lim

m→∞

m k

=1

η( k ) = ∞

lim

m→∞

mk=1

η

2

( k )

(∑

mk=1

η ( k ))

2

= 0

(28)

Fonctions discriminantes lin ´eaires

28

Le perceptron batch d’incr ´ement variable

y

(k)

= ∑

n

i=1

I

{at(k)yizi0}

y

i

z

i

P ERCEPTRON B ATCH V ARIABLE (η(·), a

0

)

1 a a

0

2 k 0 3 faire

4 k k + 1

5 a a + η( k ) ∑

ni=1

I

{atyizi0}

y

i

z

i

6 jusqu’ `a

ni=1

I

{atyizi0}

= 0

7 retourner a

(29)

Proc ´edures de relaxation

J

q

( a ) = ∑

n

i=1

I

{atyizi0}

( a

t

y

i

z

i

)

2

J

r

( a ) = 1 2

n i

=1

I

{atyizib}

( a

t

y

i

z

i

b )

2

y

i

z

i

2

J

r

= ∑

n

i=1

I

{atyizib}

a

t

y

i

z

i

b y

i

z

i

2

y

i

z

i

a ( k + 1 ) = a ( k ) + η( k ) ∑

n

i=1

I

{atyizib}

b a

t

y

i

z

i

y

i

z

i

2

y

i

z

i

(30)

Fonctions discriminantes lin ´eaires

30

Proc ´edures de relaxation

R ELAXATION B ATCH M ARGE ( η (·), a

0

, b)

1 a a

0

2 k 0 3 faire

4 k k + 1

5 a a + η( k ) ∑

ni=1

I

{atyizib}batyizi

yizi2

y

i

z

i

6 jusqu’ `a

ni=1

I

{atyizib}

= 0

7 retourner a

(31)

Relaxation en-ligne

R ELAXATION E N L IGNE M ARGE (η(·), a

0

, b)

1 a a

0

2 k 0 3 faire

4 k k + 1 5 k

k mod n

6 si a

t

y

k

z

k

b alors

7 a a + η( k )

byatykzk

kzk2

y

k

z

k

8 jusqu’ `a

ni=1

I

{atyizib}

= 0

9 retourner a

(32)

Fonctions discriminantes lin ´eaires

32

Relaxation en-ligne

r ( k ) = b a

t

y

k

z

k

y

k

z

k

a

t

y

k

= b

a (k)

y

k

r(k)

y

1

y

2

1- η η

(33)

η > 1: sur-relaxation

η < 1: sous-relaxation

condition de convergence: 0 < η < 2

a1 a1

J(a) J(a)

(34)

Fonctions discriminantes lin ´eaires

34

Comportement dans le cas non-s ´eparable

proc ´edures de correction d’erreur

fonctionnent bien si

la d ´ecision de Bayes est `a peu pr`es lin ´eaire

l’erreur de Bayes est petite

si 2 d > n, la probabilit ´e de non-s ´eparabilit ´e est petite

(35)

Incr ´ement fixe

boucle infinie

engendre un proc ´essus d’ ´etat fini

moyenner les vecteurs de poids

Incr ´ement variable

converge si η( k ) 0

(36)

Fonctions discriminantes lin ´eaires

36

L’approche d’erreur carr ´ee (r ´egression)

soit b = ( z

1

,..., z

n

)

t

Id ´ealement on voudrait trouver a tel que Ya = b

Mais on commet des erreurs e = Ya b

J

s

( a ) = Ya b

2

= ∑

n

i=1

( a

t

y

i

b

i

)

2

J

s

( a ) = ∑

n

i=1

2 ( a

t

y

i

b

i

) y

i

= 2Y

t

( Ya b )

Y

t

Ya = Y

t

b

a = ( Y

t

Y )

1

Y

t

b = Y

b

(37)
(38)

Fonctions discriminantes lin ´eaires

38

Proc ´edure de Widrow-Hoff (LMS)

batch: a ( k + 1 ) = a ( k ) + η( k ) Y

t

( b Ya ( k ))

en ligne: a ( k + 1 ) = a ( k ) + η( k ) y

k

( b

k

a

t

y

k

) LMS ( Θ , η (·), a

0

)

1 a a

0

2 k 0 3 faire

4 k k + 1 5 k

k mod n

6 a a + η( k ) y

k

( b

k

a

t

y

k

)

7 jusqu’ `a | η ( k ) y

k

( b

k

a

t

y

k

)| < Θ

8 retourner a

(39)

Proc ´edure de Widrow-Hoff (LMS)

se comporte bien dans le cas non-s ´eparable

ne converge pas n ´ecessairement `a un hyperplan s ´eparateur dans les

cas s ´eparables

(40)

Fonctions discriminantes lin ´eaires

40

La machine de support vector (SVM)

objectif: trouver un hyperplan s ´eparateur avec une grande marge z

i

g ( y

i

) = z

i

a

t

y

i

maximiser b: z

i

g ( y

i

)

a b i = 1 ,..., n

y1 y2

R2

R1

hyperplan

optimal

mar gemar

ge

maximale maximale

Références

Documents relatifs

[r]

Mass transportation methods] [Cordero-Erausquin, Gangbo, Houdr´ e], [Cordero-Erausquin, Nazaret, Villani], [Agueh, Ghoussoub, Kang].. Existence and

On lui doit une m´ ethode c´ el` ebre pour la r´ esolution des syst` emes d’´ equations lin´ eaires, en d´ ecomposant une matrcie sym´ etrique d´ efinie posi- tive M sous la forme

Donner les coordonn´ ees du

Applications lin´ eaires.

[r]

On dit que la premi` ere est notre inconnue principale et que les deux autres sont nos inconnues secondaires... Le choix de

Applications lin´ eaires.