Ch7 Classication and Prediction

download Ch7 Classication and Prediction

of 47

Transcript of Ch7 Classication and Prediction

  • 8/12/2019 Ch7 Classication and Prediction

    1/47

    C o n t e n t s

    7 C l a s s i c a t i o n a n d P r e d i c t i o n 3

    7 . 1 W h a t i s c l a s s i c a t i o n ? W h a t i s p r e d i c t i o n ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    7 . 2 I s s u e s r e g a r d i n g c l a s s i c a t i o n a n d p r e d i c t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    7 . 3 C l a s s i c a t i o n b y d e c i s i o n t r e e i n d u c t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    7 . 3 . 1 D e c i s i o n t r e e i n d u c t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    7 . 3 . 2 T r e e p r u n i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    7 . 3 . 3 E x t r a c t i n g c l a s s i c a t i o n r u l e s f r o m d e c i s i o n t r e e s . . . . . . . . . . . . . . . . . . . . . . . . . . 1 0

    7 . 3 . 4 E n h a n c e m e n t s t o b a s i c d e c i s i o n t r e e i n d u c t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1

    7 . 3 . 5 S c a l a b i l i t y a n d d e c i s i o n t r e e i n d u c t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2

    7 . 3 . 6 I n t e g r a t i n g d a t a w a r e h o u s i n g t e c h n i q u e s a n d d e c i s i o n t r e e i n d u c t i o n . . . . . . . . . . . . . . . 1 3

    7 . 4 B a y e s i a n c l a s s i c a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 5

    7 . 4 . 1 B a y e s t h e o r e m . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 5

    7 . 4 . 2 N a i v e B a y e s i a n c l a s s i c a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 6

    7 . 4 . 3 B a y e s i a n b e l i e f n e t w o r k s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 7

    7 . 4 . 4 T r a i n i n g B a y e s i a n b e l i e f n e t w o r k s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 9

    7 . 5 C l a s s i c a t i o n b y b a c k p r o p a g a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 9

    7 . 5 . 1 A m u l t i l a y e r f e e d - f o r w a r d n e u r a l n e t w o r k . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 0

    7 . 5 . 2 D e n i n g a n e t w o r k t o p o l o g y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1

    7 . 5 . 3 B a c k p r o p a g a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1

    7 . 5 . 4 B a c k p r o p a g a t i o n a n d i n t e r p r e t a b i l i t y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 4

    7 . 6 A s s o c i a t i o n - b a s e d c l a s s i c a t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 5

    7 . 7 O t h e r c l a s s i c a t i o n m e t h o d s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 7

    7 . 7 . 1 k - n e a r e s t n e i g h b o r c l a s s i e r s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 7

    7 . 7 . 2 C a s e - b a s e d r e a s o n i n g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8

    7 . 7 . 3 G e n e t i c a l g o r i t h m s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8

    7 . 7 . 4 R o u g h s e t t h e o r y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 8

    7 . 7 . 5 F u z z y s e t a p p r o a c h e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 9

    7 . 8 P r e d i c t i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0

    7 . 8 . 1 L i n e a r a n d m u l t i p l e r e g r e s s i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 0

    7 . 8 . 2 N o n l i n e a r r e g r e s s i o n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2

    7 . 8 . 3 O t h e r r e g r e s s i o n m o d e l s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2

    7 . 9 C l a s s i e r a c c u r a c y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3

    7 . 9 . 1 E s t i m a t i n g c l a s s i e r a c c u r a c y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 3

    7 . 9 . 2 I n c r e a s i n g c l a s s i e r a c c u r a c y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4

    7 . 9 . 3 I s a c c u r a c y e n o u g h t o j u d g e a c l a s s i e r ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4

    7 . 1 0 S u m m a r y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 5

    1

    Bzupages.com

  • 8/12/2019 Ch7 Classication and Prediction

    2/47

    2 C O N T E N T S

  • 8/12/2019 Ch7 Classication and Prediction

    3/47

    C h a p t e r 7

    C l a s s i c a t i o n a n d P r e d i c t i o n

    c

    J . H a n a n d M . K a m b e r , 1 9 9 8 , D R A F T ! ! D O N O T C O P Y ! ! D O N O T D I S T R I B U T E ! ! S e p t e m b e r 1 5 , 1 9 9 9

    D a t a b a s e s a r e r i c h w i t h h i d d e n i n f o r m a t i o n t h a t c a n b e u s e d f o r m a k i n g i n t e l l i g e n t b u s i n e s s d e c i s i o n s . C l a s s i -

    c a t i o n a n d p r e d i c t i o n a r e t w o f o r m s o f d a t a a n a l y s i s w h i c h c a n b e u s e d t o e x t r a c t m o d e l s d e s c r i b i n g i m p o r t a n t

    d a t a c l a s s e s o r t o p r e d i c t f u t u r e d a t a t r e n d s . W h e r e a s c l a s s i c a t i o n p r e d i c t s c a t e g o r i c a l l a b e l s o r d i s c r e t e v a l u e s ,

    p r e d i c t i o n m o d e l s c o n t i n u o u s - v a l u e d f u n c t i o n s . F o r e x a m p l e , a c l a s s i c a t i o n m o d e l m a y b e b u i l t t o c a t e g o r i z e b a n k

    l o a n a p p l i c a t i o n s a s e i t h e r s a f e o r r i s k y , w h i l e a p r e d i c t i o n m o d e l m a y b e b u i l t t o p r e d i c t t h e e x p e n d i t u r e s o f p o -

    t e n t i a l c u s t o m e r s o n c o m p u t e r e q u i p m e n t g i v e n t h e i r i n c o m e a n d o c c u p a t i o n . M a n y c l a s s i c a t i o n a n d p r e d i c t i o n

    m e t h o d s h a v e b e e n p r o p o s e d b y r e s e a r c h e r s i n m a c h i n e l e a r n i n g , e x p e r t s y s t e m s , s t a t i s t i c s , a n d n e u r o b i o l o g y . M o s t

    a l g o r i t h m s a r e m e m o r y r e s i d e n t , t y p i c a l l y a s s u m i n g a s m a l l d a t a s i z e . R e c e n t d a t a b a s e m i n i n g r e s e a r c h h a s b u i l t o n

    s u c h w o r k , d e v e l o p i n g s c a l a b l e c l a s s i c a t i o n a n d p r e d i c t i o n t e c h n i q u e s c a p a b l e o f h a n d l i n g l a r g e , d i s k r e s i d e n t d a t a .

    T h e s e t e c h n i q u e s o f t e n c o n s i d e r p a r a l l e l a n d d i s t r i b u t e d p r o c e s s i n g .

    I n t h i s c h a p t e r , y o u w i l l l e a r n b a s i c t e c h n i q u e s f o r d a t a c l a s s i c a t i o n s u c h a s d e c i s i o n t r e e i n d u c t i o n , B a y e s i a n

    c l a s s i c a t i o n a n d B a y e s i a n b e l i e f n e t w o r k s , a n d n e u r a l n e t w o r k s . T h e i n t e g r a t i o n o f d a t a w a r e h o u s i n g t e c h n o l o g y

    w i t h c l a s s i c a t i o n i s a l s o d i s c u s s e d , a s w e l l a s a s s o c i a t i o n - b a s e d c l a s s i c a t i o n . O t h e r a p p r o a c h e s t o c l a s s i c a t i o n , s u c h

    a s k - n e a r e s t n e i g h b o r c l a s s i e r s , c a s e - b a s e d r e a s o n i n g , g e n e t i c a l g o r i t h m s , r o u g h s e t s , a n d f u z z y l o g i c t e c h n i q u e s a r e

    i n t r o d u c e d . M e t h o d s f o r p r e d i c t i o n , i n c l u d i n g l i n e a r , n o n l i n e a r , a n d g e n e r a l i z e d l i n e a r r e g r e s s i o n m o d e l s a r e b r i e y

    d i s c u s s e d . W h e r e a p p l i c a b l e , y o u w i l l l e a r n o f m o d i c a t i o n s , e x t e n s i o n s a n d o p t i m i z a t i o n s t o t h e s e t e c h n i q u e s f o r

    t h e i r a p p l i c a t i o n t o d a t a c l a s s i c a t i o n a n d p r e d i c t i o n f o r l a r g e d a t a b a s e s .

    7 . 1 W h a t i s c l a s s i c a t i o n ? W h a t i s p r e d i c t i o n ?

    D a t a c l a s s i c a t i o n i s a t w o s t e p p r o c e s s F i g u r e 7 . 1 . I n t h e r s t s t e p , a m o d e l i s b u i l t d e s c r i b i n g a p r e d e t e r m i n e d

    s e t o f d a t a c l a s s e s o r c o n c e p t s . T h e m o d e l i s c o n s t r u c t e d b y a n a l y z i n g d a t a b a s e t u p l e s d e s c r i b e d b y a t t r i b u t e s . E a c h

    t u p l e i s a s s u m e d t o b e l o n g t o a p r e d e n e d c l a s s , a s d e t e r m i n e d b y o n e o f t h e a t t r i b u t e s , c a l l e d t h e c l a s s l a b e l

    a t t r i b u t e . I n t h e c o n t e x t o f c l a s s i c a t i o n , d a t a t u p l e s a r e a l s o r e f e r r e d t o a s s a m p l e s , e x a m p l e s o r o b j e c t s . T h e

    d a t a t u p l e s a n a l y z e d t o b u i l d t h e m o d e l c o l l e c t i v e l y f o r m t h e t r a i n i n g d a t a s e t . T h e i n d i v i d u a l t u p l e s m a k i n g

    u p t h e t r a i n i n g s e t a r e r e f e r r e d t o a s t r a i n i n g s a m p l e s a n d a r e r a n d o m l y s e l e c t e d f r o m t h e s a m p l e p o p u l a t i o n .

    S i n c e t h e c l a s s l a b e l o f e a c h t r a i n i n g s a m p l e i s p r o v i d e d , t h i s s t e p i s a l s o k n o w n a s s u p e r v i s e d l e a r n i n g i . e . , t h e

    l e a r n i n g o f t h e m o d e l i s ` s u p e r v i s e d ' i n t h a t i t i s t o l d t o w h i c h c l a s s e a c h t r a i n i n g s a m p l e b e l o n g s . I t c o n t r a s t s w i t h

    u n s u p e r v i s e d l e a r n i n g o r c l u s t e r i n g , i n w h i c h t h e c l a s s l a b e l s o f t h e t r a i n i n g s a m p l e s a r e n o t k n o w n , a n d t h e

    n u m b e r o r s e t o f c l a s s e s t o b e l e a r n e d m a y n o t b e k n o w n i n a d v a n c e . C l u s t e r i n g i s t h e t o p i c o f C h a p t e r 8 .

    T y p i c a l l y , t h e l e a r n e d m o d e l i s r e p r e s e n t e d i n t h e f o r m o f c l a s s i c a t i o n r u l e s , d e c i s i o n t r e e s , o r m a t h e m a t i c a l

    f o r m u l a e . F o r e x a m p l e , g i v e n a d a t a b a s e o f c u s t o m e r c r e d i t i n f o r m a t i o n , c l a s s i c a t i o n r u l e s c a n b e l e a r n e d t o

    i d e n t i f y c u s t o m e r s a s h a v i n g e i t h e r e x c e l l e n t o r f a i r c r e d i t r a t i n g s F i g u r e 7 . 1 a . T h e r u l e s c a n b e u s e d t o c a t e g o r i z e

    f u t u r e d a t a s a m p l e s , a s w e l l a s p r o v i d e a b e t t e r u n d e r s t a n d i n g o f t h e d a t a b a s e c o n t e n t s .

    I n t h e s e c o n d s t e p F i g u r e 7 . 1 b , t h e m o d e l i s u s e d f o r c l a s s i c a t i o n . F i r s t , t h e p r e d i c t i v e a c c u r a c y o f t h e m o d e l

    o r c l a s s i e r i s e s t i m a t e d . S e c t i o n 7 . 9 o f t h i s c h a p t e r d e s c r i b e s s e v e r a l m e t h o d s f o r e s t i m a t i n g c l a s s i e r a c c u r a c y .

    T h e h o l d o u t m e t h o d i s a s i m p l e t e c h n i q u e w h i c h u s e s a t e s t s e t o f c l a s s - l a b e l e d s a m p l e s . T h e s e s a m p l e s a r e

    3

  • 8/12/2019 Ch7 Classication and Prediction

    4/47

    4 C H A P T E R 7 . C L A S S I F I C A T I O N A N D P R E D I C T I O N

    Training

    Data

    Classification

    Rules

    Classification

    Algorithm

    < 30

    < 30

    30 - 40

    > 40

    > 40

    30 - 40

    low

    low

    high

    med

    med

    high

    ...

    Sandy Jones

    Bill Lee

    Susan Lake

    Claire Phips

    Andre Beau

    Courtney Fox

    ...

    fair

    fair

    fair

    excellent

    excellent

    excellent

    ...

    name age income credit rating

    a)

    IF age 30-40

    AND income=high

    THEN

    credit_rating=excellent

    Classification

    Rules

    New

    Data

    (John Henri, 30-40, high)

    Credit rating?

    Data

    Test

    fair

    ...

    fair

    excellent

    name age income credit rating

    < 30

    30 - 40

    low

    Frank Jones

    Sylvia Crest

    Anne Yee...... ...

    > 40 high

    high

    b)

    excellent

    F i g u r e 7 . 1 : T h e d a t a c l a s s i c a t i o n p r o c e s s : a L e a r n i n g : T r a i n i n g d a t a a r e a n a l y z e d b y a c l a s s i c a t i o n a l g o r i t h m .

    H e r e , t h e c l a s s l a b e l a t t r i b u t e i s c r e d i t r a t i n g , a n d t h e l e a r n e d m o d e l o r c l a s s i e r i s r e p r e s e n t e d i n t h e f o r m o f

    c l a s s i c a t i o n r u l e s . b C l a s s i c a t i o n : T e s t d a t a a r e u s e d t o e s t i m a t e t h e a c c u r a c y o f t h e c l a s s i c a t i o n r u l e s . I f t h e

    a c c u r a c y i s c o n s i d e r e d a c c e p t a b l e , t h e r u l e s c a n b e a p p l i e d t o t h e c l a s s i c a t i o n o f n e w d a t a t u p l e s .

    r a n d o m l y s e l e c t e d a n d a r e i n d e p e n d e n t o f t h e t r a i n i n g s a m p l e s . T h e a c c u r a c y o f a m o d e l o n a g i v e n t e s t s e t i s t h e

    p e r c e n t a g e o f t e s t s e t s a m p l e s t h a t a r e c o r r e c t l y c l a s s i e d b y t h e m o d e l . F o r e a c h t e s t s a m p l e , t h e k n o w n c l a s s l a b e l

    i s c o m p a r e d w i t h t h e l e a r n e d m o d e l ' s c l a s s p r e d i c t i o n f o r t h a t s a m p l e . N o t e t h a t i f t h e a c c u r a c y o f t h e m o d e l w e r e

    e s t i m a t e d b a s e d o n t h e t r a i n i n g d a t a s e t , t h i s e s t i m a t e c o u l d b e o p t i m i s t i c s i n c e t h e l e a r n e d m o d e l t e n d s t o o v e r t

    t h e d a t a t h a t i s , i t m a y h a v e i n c o r p o r a t e d s o m e p a r t i c u l a r a n o m a l i e s o f t h e t r a i n i n g d a t a w h i c h a r e n o t p r e s e n t i n

    t h e o v e r a l l s a m p l e p o p u l a t i o n . T h e r e f o r e , a t e s t s e t i s u s e d .

    I f t h e a c c u r a c y o f t h e m o d e l i s c o n s i d e r e d a c c e p t a b l e , t h e m o d e l c a n b e u s e d t o c l a s s i f y f u t u r e d a t a t u p l e s o r

    o b j e c t s f o r w h i c h t h e c l a s s l a b e l i s n o t k n o w n . S u c h d a t a a r e a l s o r e f e r r e d t o i n t h e m a c h i n e l e a r n i n g l i t e r a t u r e

    a s u n k n o w n " o r p r e v i o u s l y u n s e e n " d a t a . F o r e x a m p l e , t h e c l a s s i c a t i o n r u l e s l e a r n e d i n F i g u r e 7 . 1 a f r o m t h e

    a n a l y s i s o f d a t a f r o m e x i s t i n g c u s t o m e r s c a n b e u s e d t o p r e d i c t t h e c r e d i t r a t i n g o f n e w o r f u t u r e i . e . , p r e v i o u s l y

    u n s e e n c u s t o m e r s .

    H o w i s p r e d i c t i o n d i e r e n t f r o m c l a s s i c a t i o n ? " P r e d i c t i o n c a n b e v i e w e d a s t h e c o n s t r u c t i o n a n d u s e o f a

    m o d e l t o a s s e s s t h e c l a s s o f a n u n l a b e l e d o b j e c t , o r t o a s s e s s t h e v a l u e o r v a l u e r a n g e s o f a n a t t r i b u t e t h a t a g i v e n

    o b j e c t i s l i k e l y t o h a v e . I n t h i s v i e w , c l a s s i c a t i o n a n d r e g r e s s i o n a r e t h e t w o m a j o r t y p e s o f p r e d i c t i o n p r o b l e m s

    w h e r e c l a s s i c a t i o n i s u s e d t o p r e d i c t d i s c r e t e o r n o m i n a l v a l u e s , w h i l e r e g r e s s i o n i s u s e d t o p r e d i c t c o n t i n u o u s o r

  • 8/12/2019 Ch7 Classication and Prediction

    5/47

    7 . 2 . I S S U E S R E G A R D I N G C L A S S I F I C A T I O N A N D P R E D I C T I O N 5

    o r d e r e d v a l u e s . I n o u r v i e w , h o w e v e r , w e r e f e r t o t h e u s e o f p r e d i c a t i o n t o p r e d i c t c l a s s l a b e l s a s c l a s s i c a t i o n a n d

    t h e u s e o f p r e d i c a t i o n t o p r e d i c t c o n t i n u o u s v a l u e s e . g . , u s i n g r e g r e s s i o n t e c h n i q u e s a s p r e d i c t i o n . T h i s v i e w i s

    c o m m o n l y a c c e p t e d i n d a t a m i n i n g .

    C l a s s i c a t i o n a n d p r e d i c t i o n h a v e n u m e r o u s a p p l i c a t i o n s i n c l u d i n g c r e d i t a p p r o v a l , m e d i c a l d i a g n o s i s , p e r f o r -

    m a n c e p r e d i c t i o n , a n d s e l e c t i v e m a r k e t i n g .

    E x a m p l e 7 . 1 S u p p o s e t h a t w e h a v e a d a t a b a s e o f c u s t o m e r s o n t h e A l l E l e c t r o n i c s m a i l i n g l i s t . T h e m a i l i n g l i s t

    i s u s e d t o s e n d o u t p r o m o t i o n a l l i t e r a t u r e d e s c r i b i n g n e w p r o d u c t s a n d u p c o m i n g p r i c e d i s c o u n t s . T h e d a t a b a s e

    d e s c r i b e s a t t r i b u t e s o f t h e c u s t o m e r s , s u c h a s t h e i r n a m e , a g e , i n c o m e , o c c u p a t i o n , a n d c r e d i t r a t i n g . T h e c u s t o m e r s

    c a n b e c l a s s i e d a s t o w h e t h e r o r n o t t h e y h a v e p u r c h a s e d a c o m p u t e r a t A l l E l e c t r o n i c s . S u p p o s e t h a t n e w c u s t o m e r s

    a r e a d d e d t o t h e d a t a b a s e a n d t h a t y o u w o u l d l i k e t o n o t i f y t h e s e c u s t o m e r s o f a n u n c o m i n g c o m p u t e r s a l e . T o s e n d

    o u t p r o m o t i o n a l l i t e r a t u r e t o e v e r y n e w c u s t o m e r i n t h e d a t a b a s e c a n b e q u i t e c o s t l y . A m o r e c o s t e c i e n t m e t h o d

    w o u l d b e t o o n l y t a r g e t t h o s e n e w c u s t o m e r s w h o a r e l i k e l y t o p u r c h a s e a n e w c o m p u t e r . A c l a s s i c a t i o n m o d e l c a n

    b e c o n s t r u c t e d a n d u s e d f o r t h i s p u r p o s e .

    S u p p o s e i n s t e a d t h a t y o u w o u l d l i k e t o p r e d i c t t h e n u m b e r o f m a j o r p u r c h a s e s t h a t a c u s t o m e r w i l l m a k e a t

    A l l E l e c t r o n i c s d u r i n g a s c a l y e a r . S i n c e t h e p r e d i c t e d v a l u e h e r e i s o r d e r e d , a p r e d i c t i o n m o d e l c a n b e c o n s t r u c t e d

    f o r t h i s p u r p o s e . 2

    7 . 2 I s s u e s r e g a r d i n g c l a s s i c a t i o n a n d p r e d i c t i o n

    P r e p a r i n g t h e d a t a f o r c l a s s i c a t i o n a n d p r e d i c t i o n . T h e f o l l o w i n g p r e p r o c e s s i n g s t e p s m a y b e a p p l i e d t o t h e

    d a t a i n o r d e r t o h e l p i m p r o v e t h e a c c u r a c y , e c i e n c y , a n d s c a l a b i l i t y o f t h e c l a s s i c a t i o n o r p r e d i c t i o n p r o c e s s .

    D a t a c l e a n i n g . T h i s r e f e r s t o t h e p r e p r o c e s s i n g o f d a t a i n o r d e r t o r e m o v e o r r e d u c e n o i s e b y a p p l y i n g

    s m o o t h i n g t e c h n i q u e s , f o r e x a m p l e , a n d t h e t r e a t m e n t o f m i s s i n g v a l u e s e . g . , b y r e p l a c i n g a m i s s i n g v a l u e

    w i t h t h e m o s t c o m m o n l y o c c u r r i n g v a l u e f o r t h a t a t t r i b u t e , o r w i t h t h e m o s t p r o b a b l e v a l u e b a s e d o n s t a t i s t i c s .

    A l t h o u g h m o s t c l a s s i c a t i o n a l g o r i t h m s h a v e s o m e m e c h a n i s m s f o r h a n d l i n g n o i s y o r m i s s i n g d a t a , t h i s s t e p

    c a n h e l p r e d u c e c o n f u s i o n d u r i n g l e a r n i n g .

    R e l e v a n c e a n a l y s i s . M a n y o f t h e a t t r i b u t e s i n t h e d a t a m a y b e i r r e l e v a n t t o t h e c l a s s i c a t i o n o r p r e d i c t i o n

    t a s k . F o r e x a m p l e , d a t a r e c o r d i n g t h e d a y o f t h e w e e k o n w h i c h a b a n k l o a n a p p l i c a t i o n w a s l e d i s u n l i k e l y t o

    b e r e l e v a n t t o t h e s u c c e s s o f t h e a p p l i c a t i o n . F u r t h e r m o r e , o t h e r a t t r i b u t e s m a y b e r e d u n d a n t . H e n c e , r e l e v a n c e

    a n a l y s i s m a y b e p e r f o r m e d o n t h e d a t a w i t h t h e a i m o f r e m o v i n g a n y i r r e l e v a n t o r r e d u n d a n t a t t r i b u t e s f r o m

    t h e l e a r n i n g p r o c e s s . I n m a c h i n e l e a r n i n g , t h i s s t e p i s k n o w n a s f e a t u r e s e l e c t i o n . I n c l u d i n g s u c h a t t r i b u t e s

    m a y o t h e r w i s e s l o w d o w n , a n d p o s s i b l y m i s l e a d , t h e l e a r n i n g s t e p .

    I d e a l l y , t h e t i m e s p e n t o n r e l e v a n c e a n a l y s i s , w h e n a d d e d t o t h e t i m e s p e n t o n l e a r n i n g f r o m t h e r e s u l t i n g

    r e d u c e d " f e a t u r e s u b s e t , s h o u l d b e l e s s t h a n t h e t i m e t h a t w o u l d h a v e b e e n s p e n t o n l e a r n i n g f r o m t h e

    o r i g i n a l s e t o f f e a t u r e s . H e n c e , s u c h a n a l y s i s c a n h e l p i m p r o v e c l a s s i c a t i o n e c i e n c y a n d s c a l a b i l i t y .

    D a t a t r a n s f o r m a t i o n . T h e d a t a c a n b e g e n e r a l i z e d t o h i g h e r - l e v e l c o n c e p t s . C o n c e p t h i e r a r c h i e s m a y b e

    u s e d f o r t h i s p u r p o s e . T h i s i s p a r t i c u l a r l y u s e f u l f o r c o n t i n u o u s - v a l u e d a t t r i b u t e s . F o r e x a m p l e , n u m e r i c v a l u e s

    f o r t h e a t t r i b u t e i n c o m e m a y b e g e n e r a l i z e d t o d i s c r e t e r a n g e s s u c h a s l o w , m e d i u m , a n d h i g h . S i m i l a r l y ,

    n o m i n a l - v a l u e d a t t r i b u t e s , l i k e s t r e e t , c a n b e g e n e r a l i z e d t o h i g h e r - l e v e l c o n c e p t s , l i k e c i t y . S i n c e g e n e r a l i z a t i o n

    c o m p r e s s e s t h e o r i g i n a l t r a i n i n g d a t a , f e w e r i n p u t o u t p u t o p e r a t i o n s m a y b e i n v o l v e d d u r i n g l e a r n i n g .

    T h e d a t a m a y a l s o b e n o r m a l i z e d , p a r t i c u l a r l y w h e n n e u r a l n e t w o r k s o r m e t h o d s i n v o l v i n g d i s t a n c e m e a s u r e -

    m e n t s a r e u s e d i n t h e l e a r n i n g s t e p . N o r m a l i z a t i o n i n v o l v e s s c a l i n g a l l v a l u e s f o r a g i v e n a t t r i b u t e s o t h a t

    t h e y f a l l w i t h i n a s m a l l s p e c i e d r a n g e , s u c h a s - 1 . 0 t o 1 . 0 , o r 0 t o 1 . 0 . I n m e t h o d s w h i c h u s e d i s t a n c e m e a s u r e -

    m e n t s , f o r e x a m p l e , t h i s w o u l d p r e v e n t a t t r i b u t e s w i t h i n i t i a l l y l a r g e r a n g e s l i k e , s a y i n c o m e f r o m o u t w e i g h i n g

    a t t r i b u t e s w i t h i n i t i a l l y s m a l l e r r a n g e s s u c h a s b i n a r y a t t r i b u t e s .

    D a t a c l e a n i n g , r e l e v a n c e a n a l y s i s , a n d d a t a t r a n s f o r m a t i o n a r e d e s c r i b e d i n g r e a t e r d e t a i l i n C h a p t e r 3 o f t h i s

    b o o k .

    C o m p a r i n g c l a s s i c a t i o n m e t h o d s . C l a s s i c a t i o n a n d p r e d i c t i o n m e t h o d s c a n b e c o m p a r e d a n d e v a l u a t e d a c -

    c o r d i n g t o t h e f o l l o w i n g c r i t e r i a :

  • 8/12/2019 Ch7 Classication and Prediction

    6/47

    6 C H A P T E R 7 . C L A S S I F I C A T I O N A N D P R E D I C T I O N

    no

    yes

    yesyesno

    age?

    student? credit_rating?

    40

    no yes excellent fair

    F i g u r e 7 . 2 : A d e c i s i o n t r e e f o r t h e c o n c e p t b u y s c o m p u t e r , i n d i c a t i n g w h e t h e r o r n o t a c u s t o m e r a t A l l E l e c t r o n i c s

    i s l i k e l y t o p u r c h a s e a c o m p u t e r . E a c h i n t e r n a l n o n - l e a f n o d e r e p r e s e n t s a t e s t o n a n a t t r i b u t e . E a c h l e a f n o d e

    r e p r e s e n t s a c l a s s e i t h e r b u y s c o m p u t e r = y e s o r b u y s c o m p u t e r = n o

    1 P r e d i c t i v e a c c u r a c y . T h i s r e f e r s t o t h e a b i l i t y o f t h e m o d e l t o c o r r e c t l y p r e d i c t t h e c l a s s l a b e l o f n e w o r

    p r e v i o u s l y u n s e e n d a t a .

    2 S p e e d . T h i s r e f e r s t o t h e c o m p u t a t i o n c o s t s i n v o l v e d i n g e n e r a t i n g a n d u s i n g t h e m o d e l .

    3 R o b u s t n e s s . T h i s i s t h e a b i l i t y o f t h e m o d e l t o m a k e c o r r e c t p r e d i c t i o n s g i v e n n o i s y d a t a o r d a t a w i t h m i s s i n g

    v a l u e s .

    4 S c a l a b i l i t y . T h i s r e f e r s t o t h e a b i l i t y o f t h e l e a r n e d m o d e l t o p e r f o r m e c i e n t l y o n l a r g e a m o u n t s o f d a t a .

    5 I n t e r p r e t a b i l i t y . T h i s r e f e r s i s t h e l e v e l o f u n d e r s t a n d i n g a n d i n s i g h t t h a t i s p r o v i d e d b y t h e l e a r n e d m o d e l .

    T h e s e i s s u e s a r e d i s c u s s e d t h r o u g h o u t t h e c h a p t e r . T h e d a t a b a s e r e s e a r c h c o m m u n i t y ' s c o n t r i b u t i o n s t o c l a s s i -

    c a t i o n a n d p r e d i c t i o n f o r d a t a m i n i n g h a v e s t r o n g l y e m p h a s i z e d t h e s c a l a b i l i t y a s p e c t , p a r t i c u l a r l y w i t h r e s p e c t t o

    d e c i s i o n t r e e i n d u c t i o n .

    7 . 3 C l a s s i c a t i o n b y d e c i s i o n t r e e i n d u c t i o n

    W h a t i s a d e c i s i o n t r e e ? "

    A d e c i s i o n t r e e i s a o w - c h a r t - l i k e t r e e s t r u c t u r e , w h e r e e a c h i n t e r n a l n o d e d e n o t e s a t e s t o n a n a t t r i b u t e , e a c h

    b r a n c h r e p r e s e n t s a n o u t c o m e o f t h e t e s t , a n d l e a f n o d e s r e p r e s e n t c l a s s e s o r c l a s s d i s t r i b u t i o n s . T h e t o p m o s t n o d e

    i n a t r e e i s t h e r o o t n o d e . A t y p i c a l d e c i s i o n t r e e i s s h o w n i n F i g u r e 7 . 2 . I t r e p r e s e n t s t h e c o n c e p t b u y s c o m p u t e r

    t h a t i s , i t p r e d i c t s w h e t h e r o r n o t a c u s t o m e r a t A l l E l e c t r o n i c s i s l i k e l y t o p u r c h a s e a c o m p u t e r . I n t e r n a l n o d e s a r e

    d e n o t e d b y r e c t a n g l e s , a n d l e a f n o d e s a r e d e n o t e d b y o v a l s .

    I n o r d e r t o c l a s s i f y a n u n k n o w n s a m p l e , t h e a t t r i b u t e v a l u e s o f t h e s a m p l e a r e t e s t e d a g a i n s t t h e d e c i s i o n t r e e .

    A p a t h i s t r a c e d f r o m t h e r o o t t o a l e a f n o d e w h i c h h o l d s t h e c l a s s p r e d i c t i o n f o r t h a t s a m p l e . D e c i s i o n t r e e s c a n

    e a s i l y b e c o n v e r t e d t o c l a s s i c a t i o n r u l e s .

    I n S e c t i o n 7 . 3 . 1 , w e d e s c r i b e a b a s i c a l g o r i t h m f o r l e a r n i n g d e c i s i o n t r e e s . W h e n d e c i s i o n t r e e s a r e b u i l t , m a n y

    o f t h e b r a n c h e s m a y r e e c t n o i s e o r o u t l i e r s i n t h e t r a i n i n g d a t a . T r e e p r u n i n g a t t e m p t s t o i d e n t i f y a n d r e m o v e

    s u c h b r a n c h e s , w i t h t h e g o a l o f i m p r o v i n g c l a s s i c a t i o n a c c u r a c y o n u n s e e n d a t a . T r e e p r u n i n g i s d e s c r i b e d i n

    S e c t i o n 7 . 3 . 2 . T h e e x t r a c t i o n o f c l a s s i c a t i o n r u l e s f r o m d e c i s i o n t r e e s i s d i s c u s s e d i n S e c t i o n 7 . 3 . 3 . E n h a n c e m e n t s o f

    t h e b a s i c d e c i s i o n t r e e a l g o r i t h m a r e g i v e n i n S e c t i o n 7 . 3 . 4 . S c a l a b i l i t y i s s u e s f o r t h e i n d u c t i o n o f d e c i s i o n t r e e s f r o m

    l a r g e d a t a b a s e s a r e d i s c u s s e d i n S e c t i o n 7 . 3 . 5 . S e c t i o n 7 . 3 . 6 d e s c r i b e s t h e i n t e g r a t i o n o f d e c i s i o n t r e e i n d u c t i o n w i t h

    d a t a w a r e h o u s i n g f a c i l i t i e s , s u c h a s d a t a c u b e s , a l l o w i n g t h e m i n i n g o f d e c i s i o n t r e e s a t m u l t i p l e l e v e l s o f g r a n u l a r i t y .

    D e c i s i o n t r e e s h a v e b e e n u s e d i n m a n y a p p l i c a t i o n a r e a s r a n g i n g f r o m m e d i c i n e t o g a m e t h e o r y a n d b u s i n e s s . D e c i s i o n

    t r e e s a r e t h e b a s i s o f s e v e r a l c o m m e r c i a l r u l e i n d u c t i o n s y s t e m s .

  • 8/12/2019 Ch7 Classication and Prediction

    7/47

    7 . 3 . C L A S S I F I C A T I O N B Y D E C I S I O N T R E E I N D U C T I O N 7

    A l g o r i t h m 7 . 3 . 1 G e n e r a t e d e c i s i o n t r e e G e n e r a t e a d e c i s i o n t r e e f r o m t h e g i v e n t r a i n i n g d a t a .

    I n p u t : T h e t r a i n i n g s a m p l e s , s a m p l e s , r e p r e s e n t e d b y d i s c r e t e - v a l u e d a t t r i b u t e s ; t h e s e t o f c a n d i d a t e a t t r i b u t e s , a t t r i b u t e - l i s t

    O u t p u t : A d e c i s i o n t r e e .

    M e t h o d :

    1 c r e a t e a n o d e N

    2 i f s a m p l e s a r e a l l o f t h e s a m e c l a s s , C t h e n

    3 r e t u r n N a s a l e a f n o d e l a b e l e d w i t h t h e c l a s s C

    4 i f a t t r i b u t e - l i s t i s e m p t y t h e n

    5 r e t u r n N a s a l e a f n o d e l a b e l e d w i t h t h e m o s t c o m m o n c l a s s i n s a m p l e s ; m a j o r i t y v o t i n g

    6 s e l e c t t e s t - a t t r i b u t e , t h e a t t r i b u t e a m o n g a t t r i b u t e - l i s t w i t h t h e h i g h e s t i n f o r m a t i o n g a i n ;

    7 l a b e l n o d e N w i t h t e s t - a t t r i b u t e

    8 f o r e a c h k n o w n v a l u e a o f t e s t - a t t r i b u t e p a r t i t i o n t h e s a m p l e s

    9 g r o w a b r a n c h f r o m n o d e N f o r t h e c o n d i t i o n t e s t - a t t r i b u t e = a

    1 0 l e t s b e t h e s e t o f s a m p l e s i n s a m p l e s f o r w h i c h t e s t - a t t r i b u t e = a ; a p a r t i t i o n

    1 1 i f s i s e m p t y t h e n

    1 2 a t t a c h a l e a f l a b e l e d w i t h t h e m o s t c o m m o n c l a s s i n s a m p l e s

    1 3 e l s e a t t a c h t h e n o d e r e t u r n e d b y G e n e r a t e d e c i s i o n t r e e s a t t r i b u t e - l i s t - t e s t - a t t r i b u t e

    2

    F i g u r e 7 . 3 : B a s i c a l g o r i t h m f o r i n d u c i n g a d e c i s i o n t r e e f r o m t r a i n i n g s a m p l e s .

    7 . 3 . 1 D e c i s i o n t r e e i n d u c t i o n

    T h e b a s i c a l g o r i t h m f o r d e c i s i o n t r e e i n d u c t i o n i s a g r e e d y a l g o r i t h m w h i c h c o n s t r u c t s d e c i s i o n t r e e s i n a t o p - d o w n

    r e c u r s i v e d i v i d e - a n d - c o n q u e r m a n n e r . T h e a l g o r i t h m , s u m m a r i z e d i n F i g u r e 7 . 3 , i s a v e r s i o n o f I D 3 , a w e l l - k n o w n

    d e c i s i o n t r e e i n d u c t i o n a l g o r i t h m . E x t e n s i o n s t o t h e a l g o r i t h m a r e d i s c u s s e d i n S e c t i o n s 7 . 3 . 2 t o 7 . 3 . 6 .

    T h e b a s i c s t r a t e g y i s a s f o l l o w s :

    T h e t r e e s t a r t s a s a s i n g l e n o d e r e p r e s e n t i n g t h e t r a i n i n g s a m p l e s s t e p 1 .

    I f t h e s a m p l e s a r e a l l o f t h e s a m e c l a s s , t h e n t h e n o d e b e c o m e s a l e a f a n d i s l a b e l e d w i t h t h a t c l a s s s t e p s 2

    a n d 3 .

    O t h e r w i s e , t h e a l g o r i t h m u s e s a n e n t r o p y - b a s e d m e a s u r e k n o w n a s i n f o r m a t i o n g a i n a s a h e u r i s t i c f o r s e l e c t i n g

    t h e a t t r i b u t e t h a t w i l l b e s t s e p a r a t e t h e s a m p l e s i n t o i n d i v i d u a l c l a s s e s s t e p 6 . T h i s a t t r i b u t e b e c o m e s t h e

    t e s t " o r d e c i s i o n " a t t r i b u t e a t t h e n o d e s t e p 7 . I n t h i s v e r s i o n o f t h e a l g o r i t h m , a l l a t t r i b u t e s a r e c a t e g o r i c a l ,

    i . e . , d i s c r e t e - v a l u e d . C o n t i n u o u s - v a l u e d a t t r i b u t e s m u s t b e d i s c r e t i z e d .

    A b r a n c h i s c r e a t e d f o r e a c h k n o w n v a l u e o f t h e t e s t a t t r i b u t e , a n d t h e s a m p l e s a r e p a r t i t i o n e d a c c o r d i n g l y

    s t e p s 8 - 1 0 .

    T h e a l g o r i t h m u s e s t h e s a m e p r o c e s s r e c u r s i v e l y t o f o r m a d e c i s i o n t r e e f o r t h e s a m p l e s a t e a c h p a r t i t i o n . O n c e

    a n a t t r i b u t e h a s o c c u r r e d a t a n o d e , i t n e e d n o t b e c o n s i d e r e d i n a n y o f t h e n o d e ' s d e s c e n d e n t s s t e p 1 3 .

    T h e r e c u r s i v e p a r t i t i o n i n g s t o p s o n l y w h e n a n y o n e o f t h e f o l l o w i n g c o n d i t i o n s i s t r u e :

    1 . A l l s a m p l e s f o r a g i v e n n o d e b e l o n g t o t h e s a m e c l a s s s t e p 2 a n d 3 , o r

    2 . T h e r e a r e n o r e m a i n i n g a t t r i b u t e s o n w h i c h t h e s a m p l e s m a y b e f u r t h e r p a r t i t i o n e d s t e p 4 . I n t h i s c a s e ,

    m a j o r i t y v o t i n g i s e m p l o y e d s t e p 5 . T h i s i n v o l v e s c o n v e r t i n g t h e g i v e n n o d e i n t o a l e a f a n d l a b e l i n g i t

    w i t h t h e c l a s s i n m a j o r i t y a m o n g s a m p l e s . A l t e r n a t i v e l y , t h e c l a s s d i s t r i b u t i o n o f t h e n o d e s a m p l e s m a y

    b e s t o r e d ; o r

    3 . T h e r e a r e n o s a m p l e s f o r t h e b r a n c h t e s t - a t t r i b u t e = a

    i

    s t e p 1 1 . I n t h i s c a s e , a l e a f i s c r e a t e d w i t h t h e

    m a j o r i t y c l a s s i n s a m p l e s s t e p 1 2 .

  • 8/12/2019 Ch7 Classication and Prediction

    8/47

    8 C H A P T E R 7 . C L A S S I F I C A T I O N A N D P R E D I C T I O N

    A t t r i b u t e s e l e c t i o n m e a s u r e . T h e i n f o r m a t i o n g a i n m e a s u r e i s u s e d t o s e l e c t t h e t e s t a t t r i b u t e a t e a c h n o d e

    i n t h e t r e e . S u c h a m e a s u r e i s r e f e r r e d t o a s a n a t t r i b u t e s e l e c t i o n m e a s u r e o r a m e a s u r e o f t h e g o o d n e s s o f s p l i t . T h e

    a t t r i b u t e w i t h t h e h i g h e s t i n f o r m a t i o n g a i n o r g r e a t e s t e n t r o p y r e d u c t i o n i s c h o s e n a s t h e t e s t a t t r i b u t e f o r t h e

    c u r r e n t n o d e . T h i s a t t r i b u t e m i n i m i z e s t h e i n f o r m a t i o n n e e d e d t o c l a s s i f y t h e s a m p l e s i n t h e r e s u l t i n g p a r t i t i o n s a n d

    r e e c t s t h e l e a s t r a n d o m n e s s o r i m p u r i t y " i n t h e s e p a r t i t i o n s . S u c h a n i n f o r m a t i o n - t h e o r e t i c a p p r o a c h m i n i m i z e s

    t h e e x p e c t e d n u m b e r o f t e s t s n e e d e d t o c l a s s i f y a n o b j e c t a n d g u a r a n t e e s t h a t a s i m p l e b u t n o t n e c e s s a r i l y t h e

    s i m p l e s t t r e e i s f o u n d .

    L e t S b e a s e t c o n s i s t i n g o f s d a t a s a m p l e s . S u p p o s e t h e c l a s s l a b e l a t t r i b u t e h a s m d i s t i n c t v a l u e s d e n i n g m

    d i s t i n c t c l a s s e s , C

    i

    f o r i = 1 ; : : : ; m . L e t s

    i

    b e t h e n u m b e r o f s a m p l e s o f S i n c l a s s C

    i

    . T h e e x p e c t e d i n f o r m a t i o n

    n e e d e d t o c l a s s i f y a g i v e n s a m p l e i s g i v e n b y :

    I s

    1

    s

    2

    ; : : : ; s

    m

    = ,

    m

    X

    i = 1

    p

    i

    l o g

    2

    p

    i

    7 . 1

    w h e r e p

    i

    i s t h e p r o b a b i l i t y t h a n a n a r b i t r a r y s a m p l e b e l o n g s t o c l a s s C

    i

    a n d i s e s t i m a t e d b y s

    i

    s . N o t e t h a t a l o g

    f u n c t i o n t o t h e b a s e 2 i s u s e d s i n c e t h e i n f o r m a t i o n i s e n c o d e d i n b i t s .

    L e t a t t r i b u t e A h a v e v d i s t i n c t v a l u e s , f a

    1

    a

    2

    a

    v

    g . A t t r i b u t e A c a n b e u s e d t o p a r t i t i o n S i n t o v s u b s e t s ,

    f S

    1

    S

    2

    S

    v

    g , w h e r e S

    j

    c o n t a i n s t h o s e s a m p l e s i n S t h a t h a v e v a l u e a

    j

    o f A I f A w e r e s e l e c t e d a s t h e t e s t

    a t t r i b u t e i . e . , b e s t a t t r i b u t e f o r s p l i t t i n g , t h e n t h e s e s u b s e t s w o u l d c o r r e s p o n d t o t h e b r a n c h e s g r o w n f r o m t h e

    n o d e c o n t a i n i n g t h e s e t S . L e t s

    i j

    b e t h e n u m b e r o f s a m p l e s o f c l a s s C

    i

    i n a s u b s e t S

    j

    . T h e e n t r o p y , o r e x p e c t e d

    i n f o r m a t i o n b a s e d o n t h e p a r t i t i o n i n g i n t o s u b s e t s b y A i s g i v e n b y :

    E A =

    v

    X

    j = 1

    s

    1 j

    + + s

    m j

    s

    I s

    1 j

    ; : : : ; s

    m j

    7 . 2

    T h e t e r m

    P

    v

    j = 1

    s

    1 j

    + + s

    m j

    s

    a c t s a s t h e w e i g h t o f t h e j

    t h

    s u b s e t a n d i s t h e n u m b e r o f s a m p l e s i n t h e s u b s e t i . e . ,

    h a v i n g v a l u e a

    j

    o f A d i v i d e d b y t h e t o t a l n u m b e r o f s a m p l e s i n S . T h e s m a l l e r t h e e n t r o p y v a l u e i s , t h e g r e a t e r t h e

    p u r i t y o f t h e s u b s e t p a r t i t i o n s . T h e e n c o d i n g i n f o r m a t i o n t h a t w o u l d b e g a i n e d b y b r a n c h i n g o n A i s

    G a i n A = I s

    1

    s

    2

    ; : : : ; s

    m

    , E A 7 . 3

    I n o t h e r w o r d s , G a i n A i s t h e e x p e c t e d r e d u c t i o n i n e n t r o p y c a u s e d b y k n o w i n g t h e v a l u e o f a t t r i b u t e A

    T h e a l g o r i t h m c o m p u t e s t h e i n f o r m a t i o n g a i n o f e a c h a t t r i b u t e . T h e a t t r i b u t e w i t h t h e h i g h e s t i n f o r m a t i o n g a i n

    i s c h o s e n a s t h e t e s t a t t r i b u t e f o r t h e g i v e n s e t S . A n o d e i s c r e a t e d a n d l a b e l e d w i t h t h e a t t r i b u t e , b r a n c h e s a r e

    c r e a t e d f o r e a c h v a l u e o f t h e a t t r i b u t e , a n d t h e s a m p l e s a r e p a r t i t i o n e d a c c o r d i n g l y .

    E x a m p l e 7 . 2 I n d u c t i o n o f a d e c i s i o n t r e e . T a b l e 7 . 1 p r e s e n t s a t r a i n i n g s e t o f d a t a t u p l e s t a k e n f r o m t h e A l l E l e c -

    t r o n i c s c u s t o m e r d a t a b a s e . T h e d a t a a r e a d a p t e d f r o m Q u i n l a n 1 9 8 6 b . T h e c l a s s l a b e l a t t r i b u t e , b u y s c o m p u t e r

    h a s t w o d i s t i n c t v a l u e s n a m e l y f y e s , n o g , t h e r e f o r e , t h e r e a r e t w o d i s t i n c t c l a s s e s m = 2 . L e t C

    1

    c o r r e s p o n d t o

    t h e c l a s s y e s a n d c l a s s C

    2

    c o r r e s p o n d t o n o T h e r e a r e 9 s a m p l e s o f c l a s s y e s a n d 5 s a m p l e s o f c l a s s n o . T o c o m p u t e

    t h e i n f o r m a t i o n g a i n o f e a c h a t t r i b u t e , w e r s t u s e E q u a t i o n 7 . 1 t o c o m p u t e t h e e x p e c t e d i n f o r m a t i o n n e e d e d t o

    c l a s s i f y a g i v e n s a m p l e . T h i s i s :

    I s

    1

    s

    2

    = I 9 5 = ,

    9

    1 4

    l o g

    2

    9

    1 4

    ,

    5

    1 4

    l o g

    2

    5

    1 4

    = 0 9 4 0

    N e x t , w e n e e d t o c o m p u t e t h e e n t r o p y o f e a c h a t t r i b u t e . L e t ' s s t a r t w i t h t h e a t t r i b u t e a g e . W e n e e d t o l o o k a t

    t h e d i s t r i b u t i o n o f y e s a n d n o s a m p l e s f o r e a c h v a l u e o f a g e . W e c o m p u t e t h e e x p e c t e d i n f o r m a t i o n f o r e a c h o f t h e s e

    d i s t r i b u t i o n s .

    f o r a g e = 3 0 " s

    1 1

    = 2 s

    2 1

    = 3 I s

    1 1

    s

    2 1

    = 0 . 9 7 1

    f o r a g e = 3 0 - 4 0 " s

    1 2

    = 4 s

    2 2

    = 0 I s

    1 2

    s

    2 2

    = 0

    f o r a g e = 4 0 " s

    1 3

    = 3 s

    2 3

    = 2 I s

    1 3

    s

    2 3

    = 0 . 9 7 1

  • 8/12/2019 Ch7 Classication and Prediction

    9/47

    7 . 3 . C L A S S I F I C A T I O N B Y D E C I S I O N T R E E I N D U C T I O N 9

    r i d a g e i n c o m e s t u d e n t c r e d i t r a t i n g C l a s s : b u y s c o m p u t e r

    1 3 0 h i g h n o f a i r n o

    2 3 0 h i g h n o e x c e l l e n t n o

    3 3 0 - 4 0 h i g h n o f a i r y e s

    4 4 0 m e d i u m n o f a i r y e s

    5 4 0 l o w y e s f a i r y e s

    6 4 0 l o w y e s e x c e l l e n t n o

    7 3 0 - 4 0 l o w y e s e x c e l l e n t y e s

    8 3 0 m e d i u m n o f a i r n o

    9 3 0 l o w y e s f a i r y e s

    1 0 4 0 m e d i u m y e s f a i r y e s

    1 1 3 0 m e d i u m y e s e x c e l l e n t y e s

    1 2 3 0 - 4 0 m e d i u m n o e x c e l l e n t y e s

    1 3 3 0 - 4 0 h i g h y e s f a i r y e s

    1 4 4 0 m e d i u m n o e x c e l l e n t n o

    T a b l e 7 . 1 : T r a i n i n g d a t a t u p l e s f r o m t h e A l l E l e c t r o n i c s c u s t o m e r d a t a b a s e .

    U s i n g E q u a t i o n 7 . 2 , t h e e x p e c t e d i n f o r m a t i o n n e e d e d t o c l a s s i f y a g i v e n s a m p l e i f t h e s a m p l e s a r e p a r t i t i o n e d

    a c c o r d i n g t o a g e , i s :

    E a g e =

    5

    1 4

    I s

    1 1

    s

    2 1

    +

    4

    1 4

    I s

    1 2

    s

    2 2

    +

    5

    1 4

    I s

    1 3

    s

    2 3

    = 0 6 9 4

    H e n c e , t h e g a i n i n i n f o r m a t i o n f r o m s u c h a p a r t i t i o n i n g w o u l d b e :

    G a i n a g e = I s

    1

    s

    2

    , E a g e = 0 2 4 6

    S i m i l a r l y , w e c a n c o m p u t e G a i n i n c o m e = 0 . 0 2 9 , G a i n s t u d e n t = 0 . 1 5 1 , a n d G a i n c r e d i t r a t i n g = 0 . 0 4 8 . S i n c e

    a g e h a s t h e h i g h e s t i n f o r m a t i o n g a i n a m o n g t h e a t t r i b u t e s , i t i s s e l e c t e d a s t h e t e s t a t t r i b u t e . A n o d e i s c r e a t e d

    a n d l a b e l e d w i t h a g e , a n d b r a n c h e s a r e g r o w n f o r e a c h o f t h e a t t r i b u t e ' s v a l u e s . T h e s a m p l e s a r e t h e n p a r t i t i o n e d

    a c c o r d i n g l y , a s s h o w n i n F i g u r e 7 . 4 . N o t i c e t h a t t h e s a m p l e s f a l l i n g i n t o t h e p a r t i t i o n f o r a g e = 3 0 - 4 0 a l l b e l o n g t o

    t h e s a m e c l a s s . S i n c e t h e y a l l b e l o n g t o c l a s s y e s , a l e a f s h o u l d t h e r e f o r e b e c r e a t e d a t t h e e n d o f t h i s b r a n c h a n d

    l a b e l e d w i t h y e s . T h e n a l d e c i s i o n t r e e r e t u r n e d b y t h e a l g o r i t h m i s s h o w n i n F i g u r e 7 . 2 . 2

    I n s u m m a r y , d e c i s i o n t r e e i n d u c t i o n a l g o r i t h m s h a v e b e e n u s e d f o r c l a s s i c a t i o n i n a w i d e r a n g e o f a p p l i c a t i o n

    d o m a i n s . S u c h s y s t e m s d o n o t u s e d o m a i n k n o w l e d g e . T h e l e a r n i n g a n d c l a s s i c a t i o n s t e p s o f d e c i s i o n t r e e i n d u c t i o n

    a r e g e n e r a l l y f a s t . C l a s s i c a t i o n a c c u r a c y i s t y p i c a l l y h i g h f o r d a t a w h e r e t h e m a p p i n g o f c l a s s e s c o n s i s t s o f l o n g a n d

    t h i n r e g i o n s i n c o n c e p t s p a c e .

    7 . 3 . 2 T r e e p r u n i n g

    W h e n a d e c i s i o n t r e e i s b u i l t , m a n y o f t h e b r a n c h e s w i l l r e e c t a n o m a l i e s i n t h e t r a i n i n g d a t a d u e t o n o i s e o r o u t l i e r s .

    T r e e p r u n i n g m e t h o d s a d d r e s s t h i s p r o b l e m o f o v e r t t i n g t h e d a t a . S u c h m e t h o d s t y p i c a l l y u s e s t a t i s t i c a l m e a s u r e s

    t o r e m o v e t h e l e a s t r e l i a b l e b r a n c h e s , g e n e r a l l y r e s u l t i n g i n f a s t e r c l a s s i c a t i o n a n d a n i m p r o v e m e n t i n t h e a b i l i t y o f

    t h e t r e e t o c o r r e c t l y c l a s s i f y i n d e p e n d e n t t e s t d a t a .

    H o w d o e s t r e e p r u n i n g w o r k ? " T h e r e a r e t w o c o m m o n a p p r o a c h e s t o t r e e p r u n i n g .

    I n t h e p r e p r u n i n g a p p r o a c h , a t r e e i s p r u n e d " b y h a l t i n g i t s c o n s t r u c t i o n e a r l y e . g . , b y d e c i d i n g n o t t o

    f u r t h e r s p l i t o r p a r t i t i o n t h e s u b s e t o f t r a i n i n g s a m p l e s a t a g i v e n n o d e . U p o n h a l t i n g , t h e n o d e b e c o m e s a

    l e a f . T h e l e a f m a y h o l d t h e m o s t f r e q u e n t c l a s s a m o n g t h e s u b s e t s a m p l e s , o r t h e p r o b a b i l i t y d i s t r i b u t i o n o f

    t h o s e s a m p l e s .

    W h e n c o n s t r u c t i n g a t r e e , m e a s u r e s s u c h a s s t a t i s t i c a l s i g n i c a n c e ,

    2

    , i n f o r m a t i o n g a i n , e t c . , c a n b e u s e d t o

    a s s e s s t h e g o o d n e s s o f a s p l i t . I f p a r t i t i o n i n g t h e s a m p l e s a t a n o d e w o u l d r e s u l t i n a s p l i t t h a t f a l l s b e l o w a

    p r e s p e c i e d t h r e s h o l d , t h e n f u r t h e r p a r t i t i o n i n g o f t h e g i v e n s u b s e t i s h a l t e d . T h e r e a r e d i c u l t i e s , h o w e v e r ,

  • 8/12/2019 Ch7 Classication and Prediction

    10/47

    1 0 C H A P T E R 7 . C L A S S I F I C A T I O N A N D P R E D I C T I O N

    high

    high

    medium

    low

    medium

    no

    no

    no

    yes

    yes

    fair

    excellent

    fair

    fair

    excellent

    no

    no

    no

    yes

    yes

    income student credit_rating Class

    age?

    income student credit_rating Class

    high

    low

    medium

    high

    no

    yes

    no

    yes

    excellent

    excellent

    fair

    fair yes

    yes

    yes

    yes

    income student credit_rating Class

    medium

    low

    low

    medium

    medium

    no

    yes

    yes

    yes

    no

    yes

    yes

    no

    yes

    no

    fair

    fair

    excellent

    fair

    excellent

    40

    F i g u r e 7 . 4 : T h e a t t r i b u t e a g e h a s t h e h i g h e s t i n f o r m a t i o n g a i n a n d t h e r e f o r e b e c o m e s a t e s t a t t r i b u t e a t t h e r o o t

    n o d e o f t h e d e c i s i o n t r e e . B r a n c h e s a r e g r o w n f o r e a c h v a l u e o f a g e . T h e s a m p l e s a r e s h o w n p a r t i t i o n e d a c c o r d i n g

    t o e a c h b r a n c h .

    i n c h o o s i n g a n a p p r o p r i a t e t h r e s h o l d . H i g h t h r e s h o l d s c o u l d r e s u l t i n o v e r s i m p l i e d t r e e s , w h i l e l o w t h r e s h o l d s

    c o u l d r e s u l t i n v e r y l i t t l e s i m p l i c a t i o n .

    T h e p o s t p r u n i n g a p p r o a c h r e m o v e s b r a n c h e s f r o m a f u l l y g r o w n " t r e e . A t r e e n o d e i s p r u n e d b y r e m o v i n g

    i t s b r a n c h e s .

    T h e c o s t c o m p l e x i t y p r u n i n g a l g o r i t h m i s a n e x a m p l e o f t h e p o s t p r u n i n g a p p r o a c h . T h e p r u n e d n o d e b e c o m e s

    a l e a f a n d i s l a b e l e d b y t h e m o s t f r e q u e n t c l a s s a m o n g i t s f o r m e r b r a n c h e s . F o r e a c h n o n - l e a f n o d e i n t h e t r e e ,

    t h e a l g o r i t h m c a l c u l a t e s t h e e x p e c t e d e r r o r r a t e t h a t w o u l d o c c u r i f t h e s u b t r e e a t t h a t n o d e w e r e p r u n e d .

    N e x t , t h e e x p e c t e d e r r o r r a t e o c c u r r i n g i f t h e n o d e w e r e n o t p r u n e d i s c a l c u l a t e d u s i n g t h e e r r o r r a t e s f o r e a c h

    b r a n c h , c o m b i n e d b y w e i g h t i n g a c c o r d i n g t o t h e p r o p o r t i o n o f o b s e r v a t i o n s a l o n g e a c h b r a n c h . I f p r u n i n g t h e

    n o d e l e a d s t o a g r e a t e r e x p e c t e d e r r o r r a t e , t h e n t h e s u b t r e e i s k e p t . O t h e r w i s e , i t i s p r u n e d . A f t e r g e n e r a t i n g

    a s e t o f p r o g r e s s i v e l y p r u n e d t r e e s , a n i n d e p e n d e n t t e s t s e t i s u s e d t o e s t i m a t e t h e a c c u r a c y o f e a c h t r e e . T h e

    d e c i s i o n t r e e t h a t m i n i m i z e s t h e e x p e c t e d e r r o r r a t e i s p r e f e r r e d .

    R a t h e r t h a n p r u n i n g t r e e s b a s e d o n e x p e c t e d e r r o r r a t e s , w e c a n p r u n e t r e e s b a s e d o n t h e n u m b e r o f b i t s

    r e q u i r e d t o e n c o d e t h e m . T h e b e s t p r u n e d t r e e " i s t h e o n e t h a t m i n i m i z e s t h e n u m b e r o f e n c o d i n g b i t s . T h i s

    m e t h o d a d o p t s t h e M i n i m u m D e s c r i p t i o n L e n g t h M D L p r i n c i p l e w h i c h f o l l o w s t h e n o t i o n t h a t t h e s i m p l e s t

    s o l u t i o n i s p r e f e r r e d . U n l i k e c o s t c o m p l e x i t y p r u n i n g , i t d o e s n o t r e q u i r e a n i n d e p e n d e n t s e t o f s a m p l e s .

    A l t e r n a t i v e l y , p r e p r u n i n g a n d p o s t p r u n i n g m a y b e i n t e r l e a v e d f o r a c o m b i n e d a p p r o a c h . P o s t p r u n i n g r e q u i r e s

    m o r e c o m p u t a t i o n t h a n p r e p r u n i n g , y e t g e n e r a l l y l e a d s t o a m o r e r e l i a b l e t r e e .

    7 . 3 . 3 E x t r a c t i n g c l a s s i c a t i o n r u l e s f r o m d e c i s i o n t r e e s

    C a n I g e t c l a s s i c a t i o n r u l e s o u t o f m y d e c i s i o n t r e e ? I f s o , h o w ? "

    T h e k n o w l e d g e r e p r e s e n t e d i n d e c i s i o n t r e e s c a n b e e x t r a c t e d a n d r e p r e s e n t e d i n t h e f o r m o f c l a s s i c a t i o n I F -

    T H E N r u l e s . O n e r u l e i s c r e a t e d f o r e a c h p a t h f r o m t h e r o o t t o a l e a f n o d e . E a c h a t t r i b u t e - v a l u e p a i r a l o n g a g i v e n

    p a t h f o r m s a c o n j u n c t i o n i n t h e r u l e a n t e c e d e n t I F " p a r t . T h e l e a f n o d e h o l d s t h e c l a s s p r e d i c t i o n , f o r m i n g t h e

    r u l e c o n s e q u e n t T H E N " p a r t . T h e I F - T H E N r u l e s m a y b e e a s i e r f o r h u m a n s t o u n d e r s t a n d , p a r t i c u l a r l y i f t h e

    g i v e n t r e e i s v e r y l a r g e .

  • 8/12/2019 Ch7 Classication and Prediction

    11/47

    7 . 3 . C L A S S I F I C A T I O N B Y D E C I S I O N T R E E I N D U C T I O N 1 1

    E x a m p l e 7 . 3 G e n e r a t i n g c l a s s i c a t i o n r u l e s f r o m a d e c i s i o n t r e e . T h e d e c i s i o n t r e e o f F i g u r e 7 . 2 c a n b e

    c o n v e r t e d t o c l a s s i c a t i o n I F - T H E N r u l e s b y t r a c i n g t h e p a t h f r o m t h e r o o t n o d e t o e a c h l e a f n o d e i n t h e t r e e . T h e

    r u l e s e x t r a c t e d f r o m F i g u r e 7 . 2 a r e :

    I F a g e = 3 0 " A N D s t u d e n t = n o T H E N b u y s c o m p u t e r = n o

    I F a g e = 3 0 " A N D s t u d e n t = y e s T H E N b u y s c o m p u t e r = y e s

    I F a g e = 3 0 - 4 0 " T H E N b u y s c o m p u t e r = y e s

    I F a g e = 4 0 " A N D c r e d i t r a t i n g = e x c e l l e n t T H E N b u y s c o m p u t e r = y e s

    I F a g e = 4 0 " A N D c r e d i t r a t i n g = f a i r T H E N b u y s c o m p u t e r = n o

    2

    C 4 . 5 , a l a t e r v e r s i o n o f t h e I D 3 a l g o r i t h m , u s e s t h e t r a i n i n g s a m p l e s t o e s t i m a t e t h e a c c u r a c y o f e a c h r u l e . S i n c e

    t h i s w o u l d r e s u l t i n a n o p t i m i s t i c e s t i m a t e o f r u l e a c c u r a c y , C 4 . 5 e m p l o y s a p e s s i m i s t i c e s t i m a t e t o c o m p e n s a t e f o r

    t h e b i a s . A l t e r n a t i v e l y , a s e t o f t e s t s a m p l e s i n d e p e n d e n t f r o m t h e t r a i n i n g s e t c a n b e u s e d t o e s t i m a t e r u l e a c c u r a c y .

    A r u l e c a n b e p r u n e d " b y r e m o v i n g a n y c o n d i t i o n i n i t s a n t e c e d e n t t h a t d o e s n o t i m p r o v e t h e e s t i m a t e d a c c u r a c y

    o f t h e r u l e . F o r e a c h c l a s s , r u l e s w i t h i n a c l a s s m a y t h e n b e r a n k e d a c c o r d i n g t o t h e i r e s t i m a t e d a c c u r a c y . S i n c e i t

    i s p o s s i b l e t h a t a g i v e n t e s t s a m p l e w i l l n o t s a t i s f y a n y r u l e a n t e c e d e n t , a d e f a u l t r u l e a s s i g n i n g t h e m a j o r i t y c l a s s i s

    t y p i c a l l y a d d e d t o t h e r e s u l t i n g r u l e s e t .

    7 . 3 . 4 E n h a n c e m e n t s t o b a s i c d e c i s i o n t r e e i n d u c t i o n

    W h a t a r e s o m e e n h a n c e m e n t s t o b a s i c d e c i s i o n t r e e i n d u c t i o n ? "

    M a n y e n h a n c e m e n t s t o t h e b a s i c d e c i s i o n t r e e i n d u c t i o n a l g o r i t h m o f S e c t i o n 7 . 3 . 1 h a v e b e e n p r o p o s e d . I n t h i s

    s e c t i o n , w e d i s c u s s s e v e r a l m a j o r e n h a n c e m e n t s , m a n y o f w h i c h a r e i n c o r p o r a t e d i n t o C 4 . 5 , a s u c c e s s o r a l g o r i t h m t o

    I D 3 .

    T h e b a s i c d e c i s i o n t r e e i n d u c t i o n a l g o r i t h m o f S e c t i o n 7 . 3 . 1 r e q u i r e s a l l a t t r i b u t e s t o b e c a t e g o r i c a l o r d i s c r e t i z e d .

    T h e a l g o r i t h m c a n b e m o d i e d t o a l l o w f o r c o n t i n u o u s - v a l u e d a t t r i b u t e s . A t e s t o n a c o n t i n u o u s - v a l u e d a t t r i b u t e A

    r e s u l t s i n t w o b r a n c h e s , c o r r e s p o n d i n g t o t h e c o n d i t i o n s A V a n d A V f o r s o m e n u m e r i c v a l u e , V o f A . G i v e n

    v v a l u e s o f A , t h e n v , 1 p o s s i b l e s p l i t s a r e c o n s i d e r e d i n d e t e r m i n i n g V . T y p i c a l l y , t h e m i d p o i n t s b e t w e e n e a c h p a i r

    o f a d j a c e n t v a l u e s a r e c o n s i d e r e d . I f t h e v a l u e s a r e s o r t e d i n a d v a n c e , t h e n t h i s r e q u i r e s o n l y o n e p a s s t h r o u g h t h e

    v a l u e s .

    T h e b a s i c a l g o r i t h m f o r d e c i s i o n t r e e i n d u c t i o n c r e a t e s o n e b r a n c h f o r e a c h v a l u e o f a t e s t a t t r i b u t e , a n d t h e n

    d i s t r i b u t e s t h e s a m p l e s a c c o r d i n g l y . T h i s p a r t i t i o n i n g c a n r e s u l t i n n u m e r o u s s m a l l s u b s e t s . A s t h e s u b s e t s b e c o m e

    s m a l l e r a n d s m a l l e r , t h e p a r t i t i o n i n g p r o c e s s m a y e n d u p u s i n g s a m p l e s i z e s t h a t a r e s t a t i s t i c a l l y i n s u c i e n t . T h e

    d e t e c t i o n o f u s e f u l p a t t e r n s i n t h e s u b s e t s m a y b e c o m e i m p o s s i b l e d u e t o i n s u c i e n c y o f t h e d a t a . O n e a l t e r n a t i v e

    i s t o a l l o w f o r t h e g r o u p i n g o f c a t e g o r i c a l a t t r i b u t e v a l u e s . A t r e e n o d e m a y t e s t w h e t h e r t h e v a l u e o f a n a t t r i b u t e

    b e l o n g s t o a g i v e n s e t o f v a l u e s , s u c h a s A

    i

    2 f a

    1

    a

    2

    ; : : : ; a

    n

    g . A n o t h e r a l t e r n a t i v e i s t o c r e a t e b i n a r y d e c i s i o n t r e e s ,

    w h e r e e a c h b r a n c h h o l d s a b o o l e a n t e s t o n a n a t t r i b u t e . B i n a r y t r e e s r e s u l t i n l e s s f r a g m e n t a t i o n o f t h e d a t a . S o m e

    e m p i r i c a l s t u d i e s h a v e f o u n d t h a t b i n a r y d e c i s i o n t r e e s t e n d t o b e m o r e a c c u r a t e t h a t t r a d i t i o n a l d e c i s i o n t r e e s .

    T h e i n f o r m a t i o n g a i n m e a s u r e i s b i a s e d i n t h a t i t t e n d s t o p r e f e r a t t r i b u t e s w i t h m a n y v a l u e s . M a n y a l t e r n a t i v e s

    h a v e b e e n p r o p o s e d , s u c h a s g a i n r a t i o , w h i c h c o n s i d e r s t h e p r o b a b i l i t y o f e a c h a t t r i b u t e v a l u e . V a r i o u s o t h e r s e l e c t i o n

    m e a s u r e s e x i s t , i n c l u d i n g t h e g i n i i n d e x , t h e

    2

    c o n t i n g e n c y t a b l e s t a t i s t i c , a n d t h e G - s t a t i s t i c .

    M a n y m e t h o d s h a v e b e e n p r o p o s e d f o r h a n d l i n g m i s s i n g a t t r i b u t e v a l u e s . A m i s s i n g o r u n k n o w n v a l u e f o r a n

    a t t r i b u t e A m a y b e r e p l a c e d b y t h e m o s t c o m m o n v a l u e f o r A , f o r e x a m p l e . A l t e r n a t i v e l y , t h e a p p a r e n t i n f o r m a t i o n

    g a i n o f a t t r i b u t e A c a n b e r e d u c e d b y t h e p r o p o r t i o n o f s a m p l e s w i t h u n k n o w n v a l u e s o f A . I n t h i s w a y , f r a c t i o n s "

    o f a s a m p l e h a v i n g a m i s s i n g v a l u e c a n b e p a r t i t i o n e d i n t o m o r e t h a n o n e b r a n c h a t a t e s t n o d e . O t h e r m e t h o d s

    m a y l o o k f o r t h e m o s t p r o b a b l e v a l u e o f A , o r m a k e u s e o f k n o w n r e l a t i o n s h i p s b e t w e e n A a n d o t h e r a t t r i b u t e s .

    I n c r e m e n t a l v e r s i o n s o f d e c i s i o n t r e e i n d u c t i o n h a v e b e e n p r o p o s e d . W h e n g i v e n n e w t r a i n i n g d a t a , t h e s e

    r e s t r u c t u r e t h e d e c i s i o n t r e e a c q u i r e d f r o m l e a r n i n g o n p r e v i o u s t r a i n i n g d a t a , r a t h e r t h a n r e l e a r n i n g a n e w t r e e

    f r o m s c r a t c h " .

    A d d i t i o n a l e n h a n c e m e n t s t o b a s i c d e c i s i o n t r e e i n d u c t i o n w h i c h a d d r e s s s c a l a b i l i t y , a n d t h e i n t e g r a t i o n o f d a t a

    w a r e h o u s i n g t e c h n i q u e s , a r e d i s c u s s e d i n S e c t i o n s 7 . 3 . 5 a n d 7 . 3 . 6 , r e s p e c t i v e l y .

  • 8/12/2019 Ch7 Classication and Prediction

    12/47

    1 2 C H A P T E R 7 . C L A S S I F I C A T I O N A N D P R E D I C T I O N

    7 . 3 . 5 S c a l a b i l i t y a n d d e c i s i o n t r e e i n d u c t i o n

    H o w s c a l a b l e i s d e c i s i o n t r e e i n d u c t i o n ? "

    T h e e c i e n c y o f e x i s t i n g d e c i s i o n t r e e a l g o r i t h m s , s u c h a s I D 3 a n d C 4 . 5 , h a s b e e n w e l l e s t a b l i s h e d f o r r e l a t i v e l y

    s m a l l d a t a s e t s . E c i e n c y a n d s c a l a b i l i t y b e c o m e i s s u e s o f c o n c e r n w h e n t h e s e a l g o r i t h m s a r e a p p l i e d t o t h e m i n i n g o f

    v e r y l a r g e , r e a l - w o r l d d a t a b a s e s . M o s t d e c i s i o n t r e e a l g o r i t h m s h a v e t h e r e s t r i c t i o n t h a t t h e t r a i n i n g s a m p l e s s h o u l d

    r e s i d e i n m a i n m e m o r y . I n d a t a m i n i n g a p p l i c a t i o n s , v e r y l a r g e t r a i n i n g s e t s o f m i l l i o n s o f s a m p l e s a r e c o m m o n .

    H e n c e , t h i s r e s t r i c t i o n l i m i t s t h e s c a l a b i l i t y o f s u c h a l g o r i t h m s , w h e r e t h e d e c i s i o n t r e e c o n s t r u c t i o n c a n b e c o m e

    i n e c i e n t d u e t o s w a p p i n g o f t h e t r a i n i n g s a m p l e s i n a n d o u t o f m a i n a n d c a c h e m e m o r i e s .

    E a r l y s t r a t e g i e s f o r i n d u c i n g d e c i s i o n t r e e s f r o m l a r g e d a t a b a s e s i n c l u d e d i s c r e t i z i n g c o n t i n u o u s a t t r i b u t e s , a n d

    s a m p l i n g d a t a a t e a c h n o d e . T h e s e , h o w e v e r , s t i l l a s s u m e t h a t t h e t r a i n i n g s e t c a n t i n m e m o r y . A n a l t e r n a t i v e

    m e t h o d r s t p a r t i t i o n s t h e d a t a i n t o s u b s e t s w h i c h i n d i v i d u a l l y c a n t i n t o m e m o r y , a n d t h e n b u i l d s a d e c i s i o n

    t r e e f r o m e a c h s u b s e t . T h e n a l o u t p u t c l a s s i e r c o m b i n e s e a c h c l a s s i e r o b t a i n e d f r o m t h e s u b s e t s . A l t h o u g h t h i s

    m e t h o d a l l o w s f o r t h e c l a s s i c a t i o n o f l a r g e d a t a s e t s , i t s c l a s s i c a t i o n a c c u r a c y i s n o t a s h i g h a s t h e s i n g l e c l a s s i e r

    t h a t w o u l d h a v e b e e n b u i l t u s i n g a l l o f t h e d a t a a t o n c e .

    r i d c r e d i t r a t i n g a g e b u y s c o m p u t e r

    1 e x c e l l e n t 3 8 y e s

    2 e x c e l l e n t 2 6 y e s

    3 f a i r 3 5 n o

    4 e x c e l l e n t 4 9 n o

    T a b l e 7 . 2 : S a m p l e d a t a f o r t h e c l a s s b u y s c o m p u t e r

    3 4

    5 6

    0

    1 2

    credit_rating

    excellent

    excellent

    fair

    excellent

    rid

    1

    2

    3

    4

    5

    2

    3

    6

    age

    26

    35

    38

    49

    2

    3

    1

    4

    rid rid

    1

    2

    3

    4

    buys_computer

    yes

    yes

    no

    no

    Memory Resident -- Class ListDisk Resident -- Attribute List

    ... ... ... ...

    node

    ... ... ...

    F i g u r e 7 . 5 : A t t r i b u t e l i s t a n d c l a s s l i s t d a t a s t r u c t u r e s u s e d i n S L I Q f o r t h e s a m p l e d a t a o f T a b l e 7 . 2 .

    M o r e r e c e n t d e c i s i o n t r e e a l g o r i t h m s w h i c h a d d r e s s t h e s c a l a b i l i t y i s s u e h a v e b e e n p r o p o s e d . A l g o r i t h m s f o r

    t h e i n d u c t i o n o f d e c i s i o n t r e e s f r o m v e r y l a r g e t r a i n i n g s e t s i n c l u d e S L I Q a n d S P R I N T , b o t h o f w h i c h c a n h a n d l e

    c a t e g o r i c a l a n d c o n t i n u o u s - v a l u e d a t t r i b u t e s . B o t h a l g o r i t h m s p r o p o s e p r e - s o r t i n g t e c h n i q u e s o n d i s k - r e s i d e n t d a t a

    s e t s t h a t a r e t o o l a r g e t o t i n m e m o r y . B o t h d e n e t h e u s e o f n e w d a t a s t r u c t u r e s t o f a c i l i t a t e t h e t r e e c o n s t r u c t i o n .

    S L I Q e m p l o y s d i s k r e s i d e n t a t t r i b u t e l i s t s a n d a s i n g l e m e m o r y r e s i d e n t c l a s s l i s t . T h e a t t r i b u t e l i s t s a n d c l a s s l i s t s

    g e n e r a t e d b y S L I Q f o r t h e s a m p l e d a t a o f T a b l e 7 . 2 a r e s h o w n i n F i g u r e 7 . 5 . E a c h a t t r i b u t e h a s a n a s s o c i a t e d

    a t t r i b u t e l i s t , i n d e x e d b y r i d a r e c o r d i d e n t i e r . E a c h t u p l e i s r e p r e s e n t e d b y a l i n k a g e o f o n e e n t r y f r o m e a c h

    a t t r i b u t e l i s t t o a n e n t r y i n t h e c l a s s l i s t h o l d i n g t h e c l a s s l a b e l o f t h e g i v e n t u p l e , w h i c h i n t u r n i s l i n k e d t o i t s

    c o r r e s p o n d i n g l e a f n o d e i n t h e d e c i s i o n t r e e . T h e c l a s s l i s t r e m a i n s i n m e m o r y s i n c e i t i s o f t e n a c c e s s e d a n d m o d i e d

    i n t h e b u i l d i n g a n d p r u n i n g p h a s e s . T h e s i z e o f t h e c l a s s l i s t g r o w s p r o p o r t i o n a l l y w i t h t h e n u m b e r o f t u p l e s i n t h e

    t r a i n i n g s e t . W h e n a c l a s s l i s t c a n n o t t i n t o m e m o r y , t h e p e r f o r m a n c e o f S L I Q d e c r e a s e s .

    S P R I N T u s e s a d i e r e n t a t t r i b u t e l i s t d a t a s t r u c t u r e w h i c h h o l d s t h e c l a s s a n d r i d i n f o r m a t i o n , a s s h o w n i n

    F i g u r e 7 . 6 . W h e n a n o d e i s s p l i t , t h e a t t r i b u t e l i s t s a r e p a r t i t i o n e d a n d d i s t r i b u t e d a m o n g t h e r e s u l t i n g c h i l d n o d e s

  • 8/12/2019 Ch7 Classication and Prediction

    13/47

    7 . 3 . C L A S S I F I C A T I O N B Y D E C I S I O N T R E E I N D U C T I O N 1 3

    credit_rating

    excellent

    excellent

    fair

    excellent

    ...

    buys_computer

    yes

    yes

    no

    no

    ...

    rid

    1

    2

    3

    4

    ...

    age

    26

    35

    38

    49

    ...

    2

    3

    1

    4

    rid

    ...

    buys_computer

    y

    n

    y

    n

    ...

    F i g u r e 7 . 6 : A t t r i b u t e l i s t d a t a s t r u c t u r e u s e d i n S P R I N T f o r t h e s a m p l e d a t a o f T a b l e 7 . 2 .

    a c c o r d i n g l y . W h e n a l i s t i s p a r t i t i o n e d , t h e o r d e r o f t h e r e c o r d s i n t h e l i s t i s m a i n t a i n e d . H e n c e , p a r t i t i o n i n g l i s t s

    d o e s n o t r e q u i r e r e s o r t i n g . S P R I N T w a s d e s i g n e d t o b e e a s i l y p a r a l l e l i z e d , f u r t h e r c o n t r i b u t i n g t o i t s s c a l a b i l i t y .

    W h i l e b o t h S L I Q a n d S P R I N T h a n d l e d i s k - r e s i d e n t d a t a s e t s t h a t a r e t o o l a r g e t o t i n t o m e m o r y , t h e s c a l a b i l i t y

    o f S L I Q i s l i m i t e d b y t h e u s e o f i t s m e m o r y - r e s i d e n t d a t a s t r u c t u r e . S P R I N T r e m o v e s a l l m e m o r y r e s t r i c t i o n s , y e t

    r e q u i r e s t h e u s e o f a h a s h t r e e p r o p o r t i o n a l i n s i z e t o t h e t r a i n i n g s e t . T h i s m a y b e c o m e e x p e n s i v e a s t h e t r a i n i n g

    s e t s i z e g r o w s .

    R a i n F o r e s t i s a f r a m e w o r k f o r t h e s c a l a b l e i n d u c t i o n o f d e c i s i o n t r e e s . T h e m e t h o d a d a p t s t o t h e a m o u n t o f m a i n

    m e m o r y a v a i l a b l e , a n d a p p l y t o a n y d e c i s i o n t r e e i n d u c t i o n a l g o r i t h m . I t m a i n t a i n s a n A V C - s e t A t t r i b u t e - V a l u e ,

    C l a s s l a b e l i n d i c a t i n g t h e c l a s s d i s t r i b u t i o n f o r e a c h a t t r i b u t e . R a i n F o r e s t r e p o r t s a s p e e d - u p o v e r S P R I N T .

    7 . 3 . 6 I n t e g r a t i n g d a t a w a r e h o u s i n g t e c h n i q u e s a n d d e c i s i o n t r e e i n d u c t i o n

    D e c i s i o n t r e e i n d u c t i o n c a n b e i n t e g r a t e d w i t h d a t a w a r e h o u s i n g t e c h n i q u e s f o r d a t a m i n i n g . I n t h i s s e c t i o n w e

    d i s c u s s t h e m e t h o d o f a t t r i b u t e - o r i e n t e d i n d u c t i o n t o g e n e r a l i z e t h e g i v e n d a t a , a n d t h e u s e o f m u l t i d i m e n s i o n a l

    d a t a c u b e s t o s t o r e t h e g e n e r a l i z e d d a t a a t m u l t i p l e l e v e l s o f g r a n u l a r i t y . W e t h e n d i s c u s s h o w t h e s e a p p r o a c h e s

    c a n b e i n t e g r a t e d w i t h d e c i s i o n t r e e i n d u c t i o n i n o r d e r t o f a c i l i t a t e i n t e r a c t i v e m u l t i l e v e l m i n i n g . T h e u s e o f a d a t a

    m i n i n g q u e r y l a n g u a g e t o s p e c i f y c l a s s i c a t i o n t a s k s i s a l s o d i s c u s s e d . I n g e n e r a l , t h e t e c h n i q u e s d e s c r i b e d h e r e a r e

    a p p l i c a b l e t o o t h e r f o r m s o f l e a r n i n g a s w e l l .

    A t t r i b u t e - o r i e n t e d i n d u c t i o n A O I u s e s c o n c e p t h i e r a r c h i e s t o g e n e r a l i z e t h e t r a i n i n g d a t a b y r e p l a c i n g l o w e r

    l e v e l d a t a w i t h h i g h e r l e v e l c o n c e p t s C h a p t e r 5 . F o r e x a m p l e , n u m e r i c a l v a l u e s f o r t h e a t t r i b u t e i n c o m e m a y b e

    g e n e r a l i z e d t o t h e r a n g e s 3 0 K " , 3 0 K - 4 0 K " , 4 0 K " , o r t h e c a t e g o r i e s l o w , m e d i u m o r h i g h . T h i s a l l o w s t h e u s e r

    t o v i e w t h e d a t a a t m o r e m e a n i n g f u l l e v e l s . I n a d d i t i o n , t h e g e n e r a l i z e d d a t a a r e m o r e c o m p a c t t h a n t h e o r i g i n a l

    t r a i n i n g s e t , w h i c h m a y r e s u l t i n f e w e r i n p u t o u t p u t o p e r a t i o n s . H e n c e , A O I a l s o a d d r e s s e s t h e s c a l a b i l i t y i s s u e b y

    c o m p r e s s i n g t h e t r a i n i n g d a t a .

    T h e g e n e r a l i z e d t r a i n i n g d a t a c a n b e s t o r e d i n a m u l t i d i m e n s i o n a l d a t a c u b e , s u c h a s t h e s t r u c t u r e t y p i c a l l y

    u s e d i n d a t a w a r e h o u s i n g C h a p t e r 2 . T h e d a t a c u b e i s a m u l t i d i m e n s i o n a l d a t a s t r u c t u r e , w h e r e e a c h d i m e n s i o n

    r e p r e s e n t s a n a t t r i b u t e o r a s e t o f a t t r i b u t e s i n t h e d a t a s c h e m a , a n d e a c h c e l l s t o r e s t h e v a l u e o f s o m e a g g r e g a t e

    m e a s u r e s u c h a s c o u n t . F i g u r e 7 . 7 s h o w s a d a t a c u b e f o r c u s t o m e r i n f o r m a t i o n d a t a , w i t h t h e d i m e n s i o n s i n c o m e

    a g e , a n d o c c u p a t i o n . T h e o r i g i n a l n u m e r i c v a l u e s o f i n c o m e a n d a g e h a v e b e e n g e n e r a l i z e d t o r a n g e s . S i m i l a r l y ,

    o r i g i n a l v a l u e s f o r o c c u p a t i o n , s u c h a s a c c o u n t a n t a n d b a n k e r o r n u r s e a n d X - r a y t e c h n i c i a n , h a v e b e e n g e n e r a l i z e d

    t o n a n c e a n d m e d i c a l , r e s p e c t i v e l y . T h e a d v a n t a g e o f t h e m u l t i d i m e n s i o n a l s t r u c t u r e i s t h a t i t a l l o w s f a s t i n d e x i n g

    t o c e l l s o r s l i c e s o f t h e c u b e . F o r i n s t a n c e , o n e m a y e a s i l y a n d q u i c k l y a c c e s s t h e t o t a l c o u n t o f c u s t o m e r s i n

    o c c u p a t i o n s r e l a t i n g t o n a n c e w h o h a v e a n i n c o m e g r e a t e r t h a n $ 4 0 K , o r t h e n u m b e r o f c u s t o m e r s w h o w o r k i n t h e

    a r e a o f m e d i c i n e a n d a r e l e s s t h a n 4 0 y e a r s o l d .

    D a t a w a r e h o u s i n g s y s t e m s p r o v i d e a n u m b e r o f o p e r a t i o n s t h a t a l l o w m i n i n g o n t h e d a t a c u b e a t m u l t i p l e l e v e l s

    o f g r a n u l a r i t y . T o r e v i e w , t h e r o l l - u p o p e r a t i o n p e r f o r m s a g g r e g a t i o n o n t h e c u b e , e i t h e r b y c l i m b i n g u p a c o n c e p t

    h i e r a r c h y e . g . , r e p l a c i n g t h e v a l u e b a n k e r f o r o c c u p a t i o n b y t h e m o r e g e n e r a l , n a n c e , o r b y r e m o v i n g a d i m e n s i o n

    i n t h e c u b e . D r i l l - d o w n p e r f o r m s t h e r e v e r s e o f r o l l - u p , b y e i t h e r s t e p p i n g d o w n a c o n c e p t h i e r a r c h y o r a d d i n g a

    d i m e n s i o n e . g . , t i m e . A s l i c e p e r f o r m s a s e l e c t i o n o n o n e d i m e n s i o n o f t h e c u b e . F o r e x a m p l e , w e m a y o b t a i n a

    d a t a s l i c e f o r t h e g e n e r a l i z e d v a l u e a c c o u n t a n t o f o c c u p a t i o n , s h o w i n g t h e c o r r e s p o n d i n g i n c o m e a n d a g e d a t a . A

    d i c e p e r f o r m s a s e l e c t i o n o n t w o o r m o r e d i m e n s i o n s . T h e p i v o t o r r o t a t e o p e r a t i o n r o t a t e s t h e d a t a a x e s i n v i e w

  • 8/12/2019 Ch7 Classication and Prediction

    14/47

    1 4 C H A P T E R 7 . C L A S S I F I C A T I O N A N D P R E D I C T I O N

    < 30 30-40 > 40

    > 30K

    > 40K

    30K-40K

    Finance

    Medical

    Government

    Income

    Occupation

    Age

    F i g u r e 7 . 7 : A m u l t i d i m e n s i o n a l d a t a c u b e .

    i n o r d e r t o p r o v i d e a n a l t e r n a t i v e p r e s e n t a t i o n o f t h e d a t a . F o r e x a m p l e , p i v o t m a y b e u s e d t o t r a n s f o r m a 3 - D c u b e

    i n t o a s e r i e s o f 2 - D p l a n e s .

    T h e a b o v e a p p r o a c h e s c a n b e i n t e g r a t e d w i t h d e c i s i o n t r e e i n d u c t i o n t o p r o v i d e i n t e r a c t i v e m u l t i l e v e l m i n i n g

    o f d e c i s i o n t r e e s . T h e d a t a c u b e a n d k n o w l e d g e s t o r e d i n t h e c o n c e p t h i e r a r c h i e s c a n b e u s e d t o i n d u c e d e c i s i o n

    t r e e s a t d i e r e n t l e v e l s o f a b s t r a c t i o n . F u r t h e r m o r e , o n c e a d e c i s i o n t r e e h a s b e e n d e r i v e d , t h e c o n c e p t h i e r a r c h i e s

    c a n b e u s e d t o g e n e r a l i z e o r s p e c i a l i z e i n d i v i d u a l n o d e s i n t h e t r e e , a l l o w i n g a t t r i b u t e r o l l - u p o r d r i l l - d o w n , a n d

    r e c l a s s i c a t i o n o f t h e d a t a f o r t h e n e w l y s p e c i e d a b s t r a c t i o n l e v e l . T h i s i n t e r a c t i v e f e a t u r e w i l l a l l o w u s e r s t o f o c u s

    t h e i r a t t e n t i o n o n a r e a s o f t h e t r e e o r d a t a w h i c h t h e y n d i n t e r e s t i n g .

    W h e n i n t e g r a t i n g A O I w i t h d e c i s i o n t r e e i n d u c t i o n , g e n e r a l i z a t i o n t o a v e r y l o w s p e c i c c o n c e p t l e v e l c a n r e s u l t

    i n q u i t e l a r g e a n d b u s h y t r e e s . G e n e r a l i z a t i o n t o a v e r y h i g h c o n c e p t l e v e l c a n r e s u l t i n d e c i s i o n t r e e s o f l i t t l e u s e ,

    w h e r e i n t e r e s t i n g a n d i m p o r t a n t s u b c o n c e p t s a r e l o s t d u e t o o v e r g e n e r a l i z a t i o n . I n s t e a d , g e n e r a l i z a t i o n s h o u l d b e t o

    s o m e i n t e r m e d i a t e c o n c e p t l e v e l , s e t b y a d o m a i n e x p e r t o r c o n t r o l l e d b y a u s e r - s p e c i e d t h r e s h o l d . H e n c e , t h e u s e

    o f A O I m a y r e s u l t i n c l a s s i c a t i o n t r e e s t h a t a r e m o r e u n d e r s t a n d a b l e , s m a l l e r , a n d t h e r e f o r e e a s i e r t o i n t e r p r e t t h a n

    t r e e s o b t a i n e d f r o m m e t h o d s o p e r a t i n g o n u n g e n e r a l i z e d l a r g e r s e t s o f l o w - l e v e l d a t a s u c h a s S L I Q o r S P R I N T .

    A c r i t i c i s m o f t y p i c a l d e c i s i o n t r e e g e n e r a t i o n i s t h a t , b e c a u s e o f t h e r e c u r s i v e p a r t i t i o n i n g , s o m e r e s u l t i n g d a t a

    s u b s e t s m a y b e c o m e s o s m a l l t h a t p a r t i t i o n i n g t h e m f u r t h e r w o u l d h a v e n o s t a t i s t i c a l l y s i g n i c a n t b a s i s . T h e

    m a x i m u m s i z e o f s u c h i n s i g n i c a n t " d a t a s u b s e t s c a n b e s t a t i s t i c a l l y d e t e r m i n e d . T o d e a l w i t h t h i s p r o b l e m , a n

    e x c e p t i o n t h r e s h o l d m a y b e i n t r o d u c e d . I f t h e p o r t i o n o f s a m p l e s i n a g i v e n s u b s e t i s l e s s t h a n t h e t h r e s h o l d , f u r t h e r

    p a r t i t i o n i n g o f t h e s u b s e t i s h a l t e d . I n s t e a d , a l e a f n o d e i s c r e a t e d w h i c h s t o r e s t h e s u b s e t a n d c l a s s d i s t r i b u t i o n o f

    t h e s u b s e t s a m p l e s .

    O w i n g t o t h e l a r g e a m o u n t a n d w i d e d i v e r s i t y o f d a t a i n l a r g e d a t a b a s e s , i t m a y n o t b e r e a s o n a b l e t o a s s u m e

    t h a t e a c h l e a f n o d e w i l l c o n t a i n s a m p l e s b e l o n g i n g t o a c o m m o n c l a s s . T h i s p r o b l e m m a y b e a d d r e s s e d b y e m p l o y i n g

    a p r e c i s i o n o r c l a s s i c a t i o n t h r e s h o l d . F u r t h e r p a r t i t i o n i n g o f t h e d a t a s u b s e t a t a g i v e n n o d e i s t e r m i n a t e d i f

    t h e p e r c e n t a g e o f s a m p l e s b e l o n g i n g t o a n y g i v e n c l a s s a t t h a t n o d e e x c e e d s t h i s t h r e s h o l d .

    A d a t a m i n i n g q u e r y l a n g u a g e m a y b e u s e d t o s p e c i f y a n d f a c i l i t a t e t h e e n h a n c e d d e c i s i o n t r e e i n d u c t i o n m e t h o d .

    S u p p o s e t h a t t h e d a t a m i n i n g t a s k i s t o p r e d i c t t h e c r e d i t r i s k o f c u s t o m e r s a g e d 3 0 - 4 0 , b a s e d o n t h e i r i n c o m e a n d

    o c c u p a t i o n . T h i s m a y b e s p e c i e d a s t h e f o l l o w i n g d a t a m i n i n g q u e r y :

    m i n e c l a s s i c a t i o n

    a n a l y z e c r e d i t r i s k

    i n r e l e v a n c e t o i n c o m e , o c c u p a t i o n

    f r o m C u s t o m e r d b

    w h e r e a g e = 3 0 a n d a g e 4 0

    d i s p l a y a s r u l e s

  • 8/12/2019 Ch7 Classication and Prediction

    15/47

    7 . 4 . B A Y E S I A N C L A S S I F I C A T I O N 1 5

    T h e a b o v e q u e r y , e x p r e s s e d i n D M Q L

    1

    , e x e c u t e s a r e l a t i o n a l q u e r y o n C u s t o m e r d b t o r e t r i e v e t h e t a s k - r e l e v a n t

    d a t a . T u p l e s n o t s a t i s f y i n g t h e w h e r e c l a u s e a r e i g n o r e d , a n d o n l y t h e d a t a c o n c e r n i n g t h e a t t r i b u t e s s p e c i e d i n t h e

    i n r e l e v a n c e t o c l a u s e , a n d t h e c l a s s l a b e l a t t r i b u t e c r e d i t r i s k a r e c o l l e c t e d . A O I i s t h e n p e r f o r m e d o n t h i s d a t a .

    S i n c e t h e q u e r y h a s n o t s p e c i e d w h i c h c o n c e p t h i e r a r c h i e s t o e m p l o y , d e f a u l t h i e r a r c h i e s a r e u s e d . A g r a p h i c a l u s e r

    i n t e r f a c e m a y b e d e s i g n e d t o f a c i l i t a t e u s e r s p e c i c a t i o n o f d a t a m i n i n g t a s k s v i a s u c h a d a t a m i n i n g q u e r y l a n g u a g e .

    I n t h i s w a y , t h e u s e r c a n h e l p g u i d e t h e a u t o m a t e d d a t a m i n i n g p r o c e s s .

    H e n c e , m a n y i d e a s f r o m d a t a w a r e h o u s i n g c a n b e i n t e g r a t e d w i t h c l a s s i c a t i o n a l g o r i t h m s , s u c h a s d e c i s i o n t r e e

    i n d u c t i o n , i n o r d e r t o f a c i l i t a t e d a t a m i n i n g . A t t r i b u t e - o r i e n t e d i n d u c t i o n e m p l o y s c o n c e p t h i e r a r c h i e s t o g e n e r a l i z e

    d a t a t o m u l t i p l e a b s t r a c t i o n l e v e l s , a n d c a n b e i n t e g r a t e d w i t h c l a s s i c a t i o n m e t h o d s i n o r d e r t o p e r f o r m m u l t i l e v e l

    m i n i n g . D a t a c a n b e s t o r e d i n m u l t i d i m e n s i o n a l d a t a c u b e s t o a l l o w q u i c k a c c e s s i n g t o a g g r e g a t e d a t a v a l u e s . F i n a l l y ,

    a d a t a m i n i n g q u e r y l a n g u a g e c a n b e u s e d t o a s s i s t u s e r s i n i n t e r a c t i v e d a t a m i n i n g .

    7 . 4 B a y e s i a n c l a s s i c a t i o n

    W h a t a r e B a y e s i a n c l a s s i e r s " ?

    B a y e s i a n c l a s s i e r s a r e s t a t i s t i c a l c l a s s i e r s . T h e y c a n p r e d i c t c l a s s m e m b e r s h i p p r o b a b i l i t i e s , s u c h a s t h e p r o b -

    a b i l i t y t h a t a g i v e n s a m p l e b e l o n g s t o a p a r t i c u l a r c l a s s .

    B a y e s i a n c l a s s i c a t i o n i s b a s e d o n B a y e s t h e o r e m , d e s c r i b e d b e l o w . S t u d i e s c o m p a r i n g c l a s s i c a t i o n a l g o r i t h m s

    h a v e f o u n d a s i m p l e B a y e s i a n c l a s s i e r k n o w n a s t h e n a i v e B a y e s i a n c l a s s i e r t o b e c o m p a r a b l e i n p e r f o r m a n c e w i t h

    d e c i s i o n t r e e a n d n e u r a l n e t w o r k c l a s s i e r s . B a y e s i a n c l a s s i e r s h a v e a l s o e x h i b i t e d h i g h a c c u r a c y a n d s p e e d w h e n

    a p p l i e d t o l a r g e d a t a b a s e s .

    N a i v e B a y e s i a n c l a s s i e r s a s s u m e t h a t t h e e e c t o f a n a t t r i b u t e v a l u e o n a g i v e n c l a s s i s i n d e p e n d e n t o f t h e

    v a l u e s o f t h e o t h e r a t t r i b u t e s . T h i s a s s u m p t i o n i s c a l l e d c l a s s c o n d i t i o n a l i n d e p e n d e n c e . I t i s m a d e t o s i m p l i f y t h e

    c o m p u t a t i o n s i n v o l v e d , a n d i n t h i s s e n s e , i s c o n s i d e r e d n a i v e " . B a y e s i a n b e l i e f n e t w o r k s a r e g r a p h i c a l m o d e l s , w h i c h

    u n l i k e n a i v e B a y e s i a n c l a s s i e r s , a l l o w t h e r e p r e s e n t a t i o n o f d e p e n d e n c i e s a m o n g s u b s e t s o f a t t r i b u t e s . B a y e s i a n b e l i e f

    n e t w o r k s c a n a l s o b e u s e d f o r c l a s s i c a t i o n .

    S e c t i o n 7 . 4 . 1 r e v i e w s b a s i c p r o b a b i l i t y n o t a t i o n a n d B a y e s t h e o r e m . Y o u w i l l t h e n l e a r n n a i v e B a y e s i a n c l a s s i -

    c a t i o n i n S e c t i o n 7 . 4 . 2 . B a y e s i a n b e l i e f n e t w o r k s a r e d e s c r i b e d i n S e c t i o n 7 . 4 . 3 .

    7 . 4 . 1 B a y e s t h e o r e m

    L e t X b e a d a t a s a m p l e w h o s e c l a s s l a b e l i s u n k n o w n . L e t H b e s o m e h y p o t h e s i s , s u c h a s t h a t t h e d a t a s a m p l e X

    b e l o n g s t o a s p e c i e d c l a s s C . F o r c l a s s i c a t i o n p r o b l e m s , w e w a n t t o d e t e r m i n e P H X , t h e p r o b a b i l i t y t h a t t h e

    h y p o t h e s i s H h o l d s g i v e n t h e o b s e r v e d d a t a s a m p l e X

    P H X i s t h e p o s t e r i o r p r o b a b i l i t y o r a p o s t e r i o r i p r o b a b i l i t y o f H c o n d i t i o n e d o n X . F o r e x a m p l e , s u p p o s e

    t h e w o r l d o f d a t a s a m p l e s c o n s i s t s o f f r u i t s , d e s c r i b e d b y t h e i r c o l o r a n d s h a p e . S u p p o s e t h a t X i s r e d a n d r o u n d ,

    a n d t h a t H i s t h e h y p o t h e s i s t h a t X i s a n a p p l e . T h e n P H X r e e c t s o u r c o n d e n c e t h a t X i s a n a p p l e g i v e n t h a t

    w e h a v e s e e n t h a t X i s r e d a n d r o u n d . I n c o n t r a s t , P H i s t h e p r i o r p r o b a b i l i t y o r a p r i o r i p r o b a b i l i t y o f H

    F o r o u r e x a m p l e , t h i s i s t h e p r o b a b i l i t y t h a t a n y g i v e n d a t a s a m p l e i s a n a p p l e , r e g a r d l e s s o f h o w t h e d a t a s a m p l e

    l o o k s . T h e p o s t e r i o r p r o b a b i l i t y , P H X i s b a s e d o n m o r e i n f o r m a t i o n s u c h a s b a c k g r o u n d k n o w l e d g e t h a n t h e

    p r i o r p r o b a b i l i t y , P H , w h i c h i s i n d e p e n d e n t o f X

    S i m i l a r l y , P X H i s t h e p o s t e r i o r p r o b a b i l i t y o f X c o n d i t i o n e d o n H . T h a t i s , i t i s t h e p r o b a b i l i t y t h a t X i s

    r e d a n d r o u n d g i v e n t h a t w e k n o w t h a t i t i s t r u e t h a t X i s a n a p p l e . P X i s t h e p r i o r p r o b a b i l i t y o f X . U s i n g o u r

    e x a m p l e , i t i s t h e p r o b a b i l i t y t h a t a d a t a s a m p l e f r o m o u r s e t o f f r u i t s i s r e d a n d r o u n d .

    H o w a r e t h e s e p r o b a b i l i t i e s e s t i m a t e d ? " P X P H , a n d P X H m a y b e e s t i m a t e d f r o m t h e g i v e n d a t a , a s w e

    s h a l l s e e b e l o w . B a y e s t h e o r e m i s u s e f u l i n t h a t i t p r o v i d e s a w a y o f c a l c u l a t i n g t h e p o s t e r i o r p r o b a b i l i t y , P H X

    f r o m P H P X , a n d P X H . B a y e s t h e o r e m i s :

    P H X =

    P X H P H

    P X

    7 . 4

    I n t h e n e x t s e c t i o n , y o u w i l l l e a r n h o w B a y e s t h e o r e m i s u s e d i n t h e n a i v e B a y e s i a n c l a s s i e r .

    1

    T h e u s e o f a d a t a m i n i n g q u e r y l a n g u a g e t o s p e c i f y d a t a m i n i n g q u e r i e s i s d i s c u s s e d i n C h a p t e r 4 , u s i n g t h e S Q L - b a s e d D M Q L

    l a n g u a g e .

  • 8/12/2019 Ch7 Classication and Prediction

    16/47

    1 6 C H A P T E R 7 . C L A S S I F I C A T I O N A N D P R E D I C T I O N

    7 . 4 . 2 N a i v e B a y e s i a n c l a s s i c a t i o n

    T h e n a i v e B a y e s i a n c l a s s i e r , o r s i m p l e B a y e s i a n c l a s s i e r , w o r k s a s f o l l o w s :

    1 . E a c h d a t a s a m p l e i s r e p r e s e n t e d b y a n n - d i m e n s i o n a l f e a t u r e v e c t o r , X = x

    1

    x

    2

    ; : : : ; x

    n

    , d e p i c t i n g n m e a -

    s u r e m e n t s m a d e o n t h e s a m p l e f r o m n a t t r i b u t e s , r e s p e c t i v e l y A

    1

    A

    2

    ; : : ; A

    n

    2 . S u p p o s e t h a t t h e r e a r e m