iowa state universitycs573x/notes/cs573week3... · 2010-02-07 · 2 ! # department of computer...

37
1 !, %% +#$%- Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 $% !+# #& % $# !#%!#- "#%% ! !"*%# !!#&$ !"*%&! !!- #!# %# !# !"*%&! %0 #0 6 $!+#- !, %% +#$%- !+#7$1$%%1* ,,,1$1$%%1*25!+#2 ,,,11$%%1*2 !, %% +#$%- Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 $! # $$#$ 4 $! %# "#$%&! !# ! "$ ! "*% +#$ *$ 4 %$ ! !#&! %!#- 4 !, %! # $! %#$ #! % 4 +#3( !, %! . % 4 !, %! ,% $$ +*$ % % 4 # $! %#$ #! $%#*% % 4 # $! %#$ % *&" +$ ! $%#&!

Upload: others

Post on 27-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

1

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 2: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

2

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

11, 01,10, 00

11 10

01 00

1 0

c=A c=B

1 0

11 01

11 01

1 0

c=A c=B

10 00

10 00

c=A c=B

x 1 0 x

Tree 1 Tree 2 Data set

x

11, 01, 10, 00

y

Exa

mples

Class

Page 3: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

3

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

C

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 4: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

4

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 5: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

5

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 6: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

6

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 7: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

7

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 8: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

8

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 9: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

9

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

P.

P , H

P ( )

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 10: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

10

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 11: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

11

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

P(X = H; Y = H) = 0.2. P(X= H; Y = T) = 0.4P(X = T; Y = H) = 0.3. P(X = T; Y = T) = 0.1H(X,Y)=-0.2log20.2+… 1.85P(X = H) = 0.6. H(X) 0.97P(Y = H) = 0.5. H(Y) = 1.0P(Y= H| X = H) = 0.2/0.6 = 0.333P(Y = T|X = H) = 1-0.333=0.667P(Y= H| X = T)= 0.3/0.4=0.75P(Y= T| X = T)=0.1/0.4=0.25 H(Y|X) 0.88

Page 12: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

12

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

I(X,Y)=0?

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 13: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

13

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

S1

S2

SmS

Si Ci

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 14: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

14

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

I1 (t, d, l) +I2 (s, d, l) +I3 (t, b, l) -I4 (t, r, l) -I5 (s, b, l) -I6 (t, b, w) +I7 (t, d, w) +I8 (s, b, w) +

Height (tall, short)Hair (dark, blonde, red) Eye (blue, brown)

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

I1…I8

Height

I1 I3 I4 I6 I7 I2 I5 I8

t s

St Ss

Hair Hair

Page 15: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

15

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Hair

rd

+ -Eye

b

wl

+

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

P (h) h

P (D) D

P (h | D) h D

P (D | h) D h

Page 16: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

16

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 17: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

17

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

hMAP = argmaxh

iHP(D | hi )P(hi )

= argmaxh

iH

log2 P Dhi( ) + log2 P hi( )( )

= argminh

iH

log2 P Dhi( ) log2 P hi( )( )

log2 P hi( ) = description length of hi under optimal encoding

of hypotheses

-log2P(D | hi ) = description length of data D given hi under optimal encoding based on P(D | hi )

MAP hypothesis learning implies Occam's razor!

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

X,

D = {ei =(Xi , di)|Xi X di=c(Xi )}

D

VH,D

D

Page 18: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

18

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

i.i.d. samples imply

P D | h( ) = P ei | h( )i

= P Xi,di h( )i

= P di h,Xi( )i

P Xi | h( )

Assuming Xi are independent of h,

P D | h( ) = P(dii

| h,Xi )P Xi( )

P(di | h,Xi ) =1 if h(Xi ) = di;

P(di | h,Xi ) = 0 otherwise

Page 19: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

19

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

P D( ) = P(D | hh H

)P(h) =1H

h VH, D

P Xi( )i

+ 0

h VH, D

=VH ,D

HP Xi( )

i

h VH ,D, we have

P(h |D) =P Dh( )P h( )

P D( )=

P Xi( )i

H

H

VH ,D P Xi( )i

=

1VH ,D

and h VH ,D, we have P(h |D) = 0

H D

Page 20: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

20

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

H

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 21: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

21

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

D

hi

h h

hi

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

H

Page 22: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

22

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

H

H

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 23: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

23

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 24: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

24

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 25: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

25

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 26: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

26

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 27: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

27

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 28: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

28

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 29: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

29

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 30: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

30

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 31: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

31

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

EntropyRatio(S | A)Entropy(S | A)

SplitEntropy(S | A)

SplitEntropy(S | A)| Si || S |i=1

Values(A )log2

| Si || S |

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Entropy Impurity(Z) =ZiZi=1

Classeslog2

ZiZ

Gini Impurity(Z) =ZiZ

i j

Z j

Z

=1

ZiZ

2

i=1

Classes

Page 32: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

32

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Impurity(S | A) = Min

i Values(A )Impurity Si( ){ }

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

w

ASGain

ACost 1

12

+

-

ACost

ASGain2

Page 33: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

33

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Impurity(S) = ijij

SiS

S jS

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 34: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

34

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 35: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

35

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 36: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

36

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010

Page 37: Iowa State Universitycs573x/Notes/cs573week3... · 2010-02-07 · 2 ! # Department of Computer Science Artificial Intelligence Research Laboratory Copyright Vasant Honavar, 2010 &

37

Department of Computer Science

Artificial Intelligence Research Laboratory

Copyright Vasant Honavar, 2010