简体   繁体   中英

Using Weka to Create a Decision Tree

I'm reading the Book Jason Bell - Machine Learning - Hands-On for Developers and Technical Professionals. EAN 9781119642251 Verlag John Wiley & Sons

Mr. Bell has Examples in the Book which the reader is supposed to do on himself.

I have Problems with the Example of Chapter 5 - Using Weka to Create a Decision Tree. The target is to create a decision tree with WEKA Toolkit . I use Version 3.8.5. The training set is provided here .

The only steps I must do are the following:

  1. Open the Weka program
  2. Click the Explorer button.
  3. Click the Open File button and select the data file called ladygaga.arff.
  4. Click the Classify button in the top row of buttons.
  5. In the Classifier pane, click the Choose button and select the J48 option under the Trees menu heading.
  6. click the Start button and watch the Classifier output window

And here my problem begins. My Output is completely different than the one in the book.

Book:

J48 pruned tree
------------------
placement = end_rack: yes (5.0/1.0)
placement = cd_spec
| pricing <= 80: yes (2.0)
| pricing > 80: no (2.0)
placement = std_rack
| eye_level = TRUE: yes (2.0)
| eye_level = FALSE: no (3.0)
Number of Leaves : 5
Size of the tree : 8

My Output:

J48 pruned tree
------------------

eye_level = TRUE: yes (6.0/2.0)
eye_level = FALSE: no (8.0/3.0)

Number of Leaves:   2

Size of the tree :  3

And that's completely different. :-DI don't understand why.

比较,我的树和示例应该生成的树

Has anybody done that example too? Have I missed an instruction step in the book? Or is a necessary setting not written in the book?

The supplied data file is wrong, if you change the data according to this you will get the same result as the book.

@relation ladygaga
 
@attribute placement {end_rack, cd_spec, std_rack}
@attribute prominence numeric
@attribute pricing numeric
@attribute eye_level {TRUE, FALSE}
@attribute customer_purchase {yes, no}
 
@data
end_rack,85,85,FALSE,yes
end_rack,80,90,TRUE,yes
cd_spec,83,86,FALSE,no
std_rack,70,96,FALSE,no
std_rack,68,80,FALSE,no
std_rack,65,70,TRUE,yes
cd_spec,64,65,TRUE,yes
end_rack,72,95,FALSE,yes
end_rack,69,70,FALSE,yes
std_rack,75,80,FALSE,no
end_rack,75,70,TRUE,no
cd_spec,72,90,TRUE,no
cd_spec,81,75,FALSE,yes
std_rack,71,91,TRUE,yes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM