开发者

Problem with c4.5

I'm using the C4.开发者_JS百科5 algorithm (can be found here)

My names are here:

Play, Don't Play.

Sky: Sunny, Cloudy, Rainy.
AirTemp: Warm, Cold.
Humidity: Normal, High.
Wind: Strong, Weak.
Water: Warm, Cool.
Forecast: Same, Change.

And my data is here

Sunny, Warm, Normal, Strong, Warm, Same, Play
Sunny, Warm, High, Strong, Warm, Same, Play
Sunny, Warm, High, Strong, Cool, Change, Play
Rainy, Cold, High, Strong, Warm, Change, Don't Play

The output I get from the algorithm which I run with the command

c4.5.exe -f v2 -v 1  > v2.r3

is

C4.5 [release 8] decision tree generator Tue Jan 18 16:41:25 2011
----------------------------------------

    Options:
 File stem <v2>
 Verbosity level 1

Read 4 cases (6 attributes) from v2.data

4 items, total weight 4.0
 best attribute Forecast inf 1.000 gain 0.311 val 0.311
Collapse tree for 4 items to leaf Play

Decision Tree:
 Play (4.0/1.0)



Play (4.00:1.00/2.19)

Tree saved


Evaluation on training data (4 items):

  Before Pruning           After Pruning
 ----------------   ---------------------------
 Size      Errors   Size      Errors   Estimate

    1    1(25.0%)      1    1(25.0%)    (54.7%)   <<

My problem is that the tree is based on the feature forecast changed into a single node. I followed the pseudo code for the algorithm myself and I always end up with a tree that uses the feature Sky to decide whether to play or not. What am I doing wrong?

I think my problem is because I can't set the pruning confidence level. I've tried it but it won't accept my input, e.g.

c4.5.exe -f v2 -v 1 -c 0.5  > v2.r3

or

c4.5.exe -f v2 -v 1 -c 50%  > v2.r3

doesn't work.


You might want to try just -c 50 instead of -c 50%. I am not sure why it does not pick Airtemp because it should have the highest information gain.

I am also going to guess you are using the Machine Learning book by Tom Mitchell. His book should have some examples, try those and see how they compare.

Edit : Have you run the examples on the site you linked too and if so have they matched up?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜