Docsity

What is Decision Tree - Machine Learning and Data Mining | CS 434, Study notes of Computer Science

Partial preview of the text

Download What is Decision Tree - Machine Learning and Data Mining | CS 434 and more Study notes Computer Science in PDF only on Docsity!

Lecture 5 DT cont.

Oct 8 2008

Review of last lecture

-^

What is decision tree

-^

What decision boundaries do decision treesproduce– Syntactically different trees can represent the same

decision boundaries

  • In such cases, we prefer smaller trees– flexible

hypothesis space

-^

How to learn a decision tree?– A greedy approach– At each step, choose the test that reduce the most

uncertainty about class labels

Unfortunately, this measure does not always work well,because it does not detect cases where we are making“progress” toward a good tree

J=10 J=

A Better Heuristic from Information

Theory

-^

Let

X

have the following probability distribution

-^

The entropy of

X

, denoted

H(

X

) , is defined as

-^

log

P(X=

x)

measures the surprise of value

x:

If

P

( X

x )

is small,

x

is a surprising value to take,

log

P

( x

)^

is large

-^

Entropy

can be considered as the average surprise of a

random variable, which is also referred to as theuncertainty of a random variable

P(X = 1)=p

1

P(X = 0)=p

0

values

possible k are

there if k

k^

P P P P X H P P P P X H

2

0 2

0

1 2 1 0 2 0 log

...

log

) (

log

log

) (

− −

−

−

−

Mutual Information

-^

If we use entropy to measure uncertainty, we end up measuring themutual information between a candidate test variable

X

and class

label

Y:

-^

H(Y|X) is called the conditional entropy of Y given X–

Measures the uncertainty of Y after knowing the value of X

(^

X Y H Y H Y X

I^

=^

Uncertainty of Y Remaining uncertainty of Yafter knowing the value of X

log)

x X y Y P x X y Y P x X P

x X Y H x X P X Y H

x^

y x

∑

∑ ∑

The uncertainty of Y when X=x

The probability of X=x

X^1

P(X

=0)=0.6677 1

P(X

=1)=0.3333 1

H(Y|X

=0) 1

=-0.6log0.6-0.4log0.4=0.**

H(Y|X

=1) 1

=-0.8log0.8-0.2log0.2=0.**

H(Y|X

)= 1

0.66670.9710 + 0.33330.7219 = 0.8873 I(X1,Y)=0.**

Choosing the Best Feature: A General

View

U(S)

U(S

)L

U(S

)R

PL

PR

Benefit of split =

U(S) – [P

*U(SL

)+PL

*U(SR

)]R^

Expected RemainingUncertainty (Impurity)

Measures of Uncertainty

EntropyGini Index Error

Issues with Multi-nomial Features

-^

Multi-nomial features: more than 2 possible values

-^

Comparing two features, one is binary, the other has 100possible values, which one you expect to have highermutual information with Y?– The conditional entropy of Y given this feature will be low– But is this meaningful?– This bias will inherently prefer such multinomial features to binary

features

  • Method 1: To avoid this, we can rescale the conditional entropy:– Method 2: Test for one value versus all of the others– Method 3: Group the values into two disjoint sets and test one set

against the other

)

( log)

(

)

| ( )

(

min arg ) (

) | (

min arg

x X P x X P x X Y H x X P X H

X Y H

j

x

j

j

x

j

j

j j

j^

=

=

−

=

=

=^

∑ ∑

Over-fitting

-^

Decision tree has a very flexible hypothesis space

-^

As the nodes increase, we can represent arbitrarilycomplex decision boundaries

-^

This can lead to over-fitting

size^ size

t2t2 t3t

Possibly just noise, butPossibly just noise, butthe tree is grown largerthe tree is grown largerto capture these examplesto capture these examples

Over-fitting

Effect of Pruning

Revisit some of the issues

• Is decision tree robust to outliers?• Is decision tree sensitive to irrelevant

features?

• Is decision tree computational efficient?