• Aucun résultat trouvé

Fonctions discriminantes lin ´eaires

N/A
N/A
Protected

Academic year: 2022

Partager "Fonctions discriminantes lin ´eaires"

Copied!
10
0
0

Texte intégral

(1)

Objectif

•d ´eterminerdirectementles fonctions discriminantes

•lin ´eaires:g(x) =w0+

!

d

i=1

wixi=wtx+w0

•lin ´eairesg ´en ´eralis ´ees:g(x) =

!

d"

i=1aiyi(x) =aty

•en minimisant lerisque empirique

Justifications

•parfoisoptimal

•facile `a calculer

•candidates pour desclassifieurs initiales

•aborderquelquesprincipesimportants

Fonctions discriminantes lin ´eaires

3

G ´eom ´etrie – deux classes

•fonction de d ´ecision:

f(x) =

!C1 sig(x)>0, C2 sig(x)<0 =

!C1 siwtx>−w0, C2 siwtx<−w0

x0=1 x1

. . .

w2 w0

w1

wd g(x)

x2

. . .

xd

unit´e de biais unit´e de sortie

unit´es d’entr´ee

Fonctions discriminantes lin ´eaires

4

G ´eom ´etrie – deux classes

•fronti `erede d ´ecisionHest unhyperplan:g(x) =0

x1,x2H:wt(x1x2) =0

•r ´egionsde d ´ecision:R1:cot ´epositif,R2:cot ´en ´egatif

r=distance alg ´ebriquedexetH:

x = xp+r w

#w# g(x) = wtx+w0=r#w#

r = g(x)

#w#

(2)

G ´eom ´etrie – deux classes

x

g(x) = 0 w

x1

x2

x3

w0 /||w||

r

H xp

R1

R2

G ´eom ´etrie – multiclasses

Ci/nonCi

ω1

not ω1

ω1

not ω2

ω2

not ω3ω3

not ω4

ω4 ω2

ω4

ω3 r´egion

ambigue

Fonctions discriminantes lin ´eaires

7

G ´eom ´etrie – multiclasses

N(N−1)/2fonctions 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

Fonctions discriminantes lin ´eaires

8

Fonctions discriminantes lin ´eaires

•machine lin ´eaire:gj(x) =wtjx+wj0, j=1, . . . ,N

•fronti `eresde d ´ecisionHi,j:gi(x) =gj(x)

•(wi−wj)estorthogonal`aHi,j

r(x,Hi,j) =gi(x)−gj(x)

#wiwj#

(3)

Fonctions discriminantes lin ´eaires

R1

R2

R3

R4

R5

ω1 R2

R3

R1

ω2 ω1

ω3

ω5

ω2 ω3

ω4

H15 H25

H24 H14

H35

H13

H34H23

H12

H23

H13

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

g(x) =

!

d"

i=1

aiyi(x) =aty

•exemple: fonction discriminantequadratique:

g(x) =w0+

!

d

i=1

wixi+

!

d

i=1 d

!

j=1

wi jxixj

•fronti `erede d ´ecision:hyperquadrique

Fonctions discriminantes lin ´eaires

11

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

•exemple:g(x) =a1+a2x+a3x2,y=

 1 x x2

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

•exemple:y=

x1

x2

"x1x2

y2

w

R2

R1

R1

R2

R1

x1 x2

x1 x2 y1 y3

y =

x

( )

1xα2x1x2 H

ˆ

ˆ

ˆ

(4)

Vecteur augment ´e

g(x) =w0+

!

d

i=1

wixi=

!

d

i=0

wixi (x0=1)

g(x) =

!

d"

i=1

aiyi,d"=d+1,y=



 1 x1

...

xd



,a=



 w0

w1

...

wd



=



 w0

w





Vecteur augment ´e

y1

y2

y0

a y0=1

R1

R2

y0=0

y1=0

y2=0 fronti

`ere de d´ecision

Fonctions discriminantes lin ´eaires

15

S ´eparabilit ´e lin ´eaire

Dn=)

(y1,z1), . . . ,(yn,zn)* ,zi=

!1 siyiest classifi´eC1

−1 siyiest classifi´eC2

g(x) =atys ´epareDnsans erreur:

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

a: vecteurs ´eparateur, vecteur desolution

Fonctions discriminantes lin ´eaires

16

S ´eparabilit ´e lin ´eaire

y1

y2

y1

y2

a a

r´egion de r´egion de

solution solution

plans´eparateur

plan”s´eparateur”

(5)

Marge de s ´eparation:

mi=g(xi)zi=atyzi

•S ´eparation avec unemargeb:

mi=atyizi>b, i=1, . . . ,n

Marge de s ´eparation

y1

y2

y3

a1

a2

a2

a1

y1

y2

y3

b/||y2

||

b/||y1||

b/||y||3

}

}

}

r´egion de r´egion de

solution solution

Fonctions discriminantes lin ´eaires

19

Proc ´edures de descente de gradient

•fonction decrit `ere:J(a)– minimis ´ee siaest une solution

a(k+1) =a(k)−%(k)!J(a(k))

•%(k):taux d’apprentissage

DESCENTEDEGRADIENTSIMPLE($,%(·),a0) 1 aa0

2 k←0 3 faire 4 kk+1 5 aa−%(k)!J(a) 6 jusqu’`a|%(k)!J(a)|<$ 7 retourner a

Fonctions discriminantes lin ´eaires

20

Descente de Newton

J(a)$J(a(k)) +!Jt(a−a(k)) +1

2(a−a(k))tH(aa(k))

•matricehessienne:Hi j= #2J

#ai#aj

a(k+1) =a(k)H1!J DESCENTEDENEWTON($,a0)

1 aa0

2 faire

3 aaH1!J(a) 4 jusqu’`a|H−1!J(a)|<$ 5 retourner a

(6)

Descente de Newton

a1

a2

J(a)

Le perceptron

Jp(a) =

!

n

i=1

I{atyizi0}(−atyizi)

•!Jp=

!

n

i=1

I{atyizi0}(−yizi)

a(k+1) =a(k) +%(k)!ni=1I{atyizi0}yizi

Fonctions discriminantes lin ´eaires

23

Le perceptron

PERCEPTRONBATCH($,%(·),a0) 1 aa0

2 k←0 3 faire 4 kk+1

5 aa+%(k)!ni=1I{atyizi0}yizi

6 jusqu’`a|%(k)!ni=1I{atyizi0}yizi|<$ 7 retourner a

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

(7)

PERCEPTRONENLIGNE(a0) 1 aa0

2 k←0 3 faire

4 k←(k+1) modn

5 si atykzk≤0alors !ykmal classifi´e 6 aa+ykzk

7 jusqu’`a!ni=1I{atyizi≤0}=0 !pas d’erreur 8 retourner a

Th ´eor `eme

•Sil’ensemble d’entraˆınement estlin ´eairement s ´eparable, l’algorithm PERCEPTRONENLIGNEsetermine `a une vecteur de solution apr `es unnombrefini de corrections.

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

PERCEPTRONENLIGNEMARGEVARIABLE(%(·),a0,b) 1 aa0

2 k←0 3 faire 4 kk+1 5 k'k modn 6 si atyk'zk'balors 7 aa+%(k)yk'zk'

8 jusqu’`a!ni=1I{atyizi≤b}=0 !pas d’erreur par rapport `a la marge b

9 retourner a

Fonctions discriminantes lin ´eaires

27

Conditions de convergence

•%(k)≥0

•lim

m&

m k=1

!

%(k) =&

•lim

m&

!mk=1%2(k) (!mk=1%(k))2=0

Fonctions discriminantes lin ´eaires

28

Le perceptron batch d’incr ´ement variable

y(k)=

!

n

i=1

I{at(k)yizi0}yizi

PERCEPTRONBATCHVARIABLE(%(·),a0) 1 aa0

2 k←0 3 faire 4 kk+1

5 aa+%(k)!ni=1I{atyizi0}yizi

6 jusqu’`a!ni=1I{atyizi0}=0 7 retourner a

(8)

Proc ´edures de relaxation

Jq(a) =

!

n

i=1I{atyizi0}(atyizi)2

Jr(a) =1 2

n i=1

!

I{atyizi≤b}

(atyizib)2

#yizi#2

•!Jr=

!

n

i=1I{atyizib}atyizib

#yizi#2 yizi

a(k+1) =a(k) +%(k)

!

n

i=1

I{atyizib}

batyizi

#yizi#2 yizi

Proc ´edures de relaxation

RELAXATIONBATCHMARGE(%(·),a0,b) 1 aa0

2 k←0 3 faire 4 kk+1

5 aa+%(k)!ni=1I{atyizib}batyizi

#yizi#2yizi

6 jusqu’`a!ni=1I{atyizib}=0 7 retourner a

Fonctions discriminantes lin ´eaires

31

Relaxation en-ligne

RELAXATIONENLIGNEMARGE(%(·),a0,b) 1 aa0

2 k←0 3 faire 4 kk+1 5 k'k modn 6 si atyk'zk'balors 7 aa+%(k)b−atyk'zk'

#yk'zk'#2yk'zk'

8 jusqu’`a!ni=1I{atyizib}=0 9 retourner a

Fonctions discriminantes lin ´eaires

32

Relaxation en-ligne

r(k) =batyk'zk'

#yk'zk'#

atyk = b a(k)

yk

r(k)

y1

y2

1- η η

(9)

Relaxation en-ligne

•%>1:sur-relaxation

•%<1:sous-relaxation

•condition deconvergence:0<%<2

a1 a1

J(a) J(a)

Comportement dans le cas non-s ´eparable

•proc ´edures decorrection d’erreur

•fonctionnentbiensi

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

l’erreur de Bayes estpetite

•si2d">n, la probabilit ´e de non-s ´eparabilit ´e est petite

Fonctions discriminantes lin ´eaires

35

Incr ´ement

fixe

•boucleinfinie

•engendre un proc ´essus d’´etatfini

•moyennerles vecteurs de poids

Incr ´ement variable

•convergesi%(k)→0

Fonctions discriminantes lin ´eaires

36

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

•soitb= (z1, . . .,zn)t

•Id ´ealement on voudrait trouveratel queYa=b

•Mais on commet des erreurse=Yab

Js(a) =#Yab#2=

!

n

i=1

(atyibi)2

•!Js(a) =

!

n

i=1

2(atyibi)yi=2Yt(Ya−b)

YtYa=Ytb

a= (YtY)1Ytb=Yb

(10)

Proc ´edure de Widrow-Hoff (LMS)

•batch:a(k+1) =a(k) +%(k)Yt(b−Ya(k))

•en ligne:a(k+1) =a(k) +%(k)yk'(bk'atyk') LMS($,%(·),a0)

1 aa0

2 k←0 3 faire 4 kk+1 5 k'k modn

6 aa+%(k)yk'(bk'atyk') 7 jusqu’`a|%(k)yk'(bk'atyk')|<$ 8 retourner a

Fonctions discriminantes lin ´eaires

39

Proc ´edure de Widrow-Hoff (LMS)

•se comportebiendans le casnon-s ´eparable

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

Fonctions discriminantes lin ´eaires

40

La machine de support vector (SVM)

•objectif: trouver un hyperplan s ´eparateur avec unegrande marge zig(yi) =ziatyi

•maximiserb:zig(yi)

#a# ≥b i=1, . . . ,n

y1

y2

R2

R1

hyperplan optimal

mar gemar

ge

maximale maximale

Références

Documents relatifs

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

En principe, r´ esoudre un syst` eme lin´ eaire, c’est montrer qu’il n’a pas de solution, ou alors en exhiber une r´ esolution (en justifiant). En pratique, on applique la m´

Applications lin´ eaires.

[r]

Applications lin´ eaires.

[r]

D´ elivre ta premi` ere combinaison lin´ eaire, en pr´ ecisant qui sont les objets combin´ es et qui sont