On Sun, 13 Nov 2011, RMSOPS wrote:

Hello everybody

I'm having some difficulties to design the decision tree algorithm J48.
I am using the following code and when I run it gives me the following
message
plot(m1)
Error in plot.Weka_tree(m1) :
 Plotting of trees with multi-way splits is currently not implemented.

The package "partykit" which recently was released to CRAN should be able to help here:

library("partykit")
plot(as.party(m1))

Furthermore, write_to_dot(m1, "m1.dot") can always be used as described in

  Kurt Hornik, Christian Buchta, Achim Zeileis (2009) Open-Source
  Machine Learning: R Meets Weka. Computational Statistics, 24(2),
  225-232. doi:10.1007/s00180-008-0119-7

Either use Graphviz directoy on the .dot file or employ Rgraphviz which is hosted at Bioconductor:

  http://www.Bioconductor.org/packages/release/bioc/html/Rgraphviz.html


#The code
library(RWeka)
library(randomForest)
library(party)
if(require(mlbench, quietly = TRUE) && require(party, quietly = TRUE))
m1 <- J48(income2 ~ age+workclass+native.country, data = dataset)
m1
plot(m1)
and results
#M1 Results
workclass = ?: <=50K (1433.0/120.0)
workclass = Federal-gov: <=50K (696.0/281.0)
workclass = Local-gov: <=50K (1542.0/469.0)
workclass = Never-worked: <=50K (5.0)
workclass = Private: <=50K (16939.0/3705.0)
workclass = Self-emp-inc
|   age <= 36: <=50K (205.0/65.0)
|   age > 36: >50K (652.0/247.0)
workclass = Self-emp-not-inc: <=50K (1926.0/525.0)
workclass = State-gov: <=50K (1010.0/262.0)
workclass = Without-pay: <=50K (13.0/2.0)

Number of Leaves  :     10

Size of the tree :      12

I tried installing the package RGraphviz, but is not available in CRAN
repository.
I wonder if there is a package that lets you draw decision trees in a way
more effective than the library(party)

which the classification algorithms more efficient in R

Thanks

--
View this message in context: 
http://r.789695.n4.nabble.com/libary-Rweka-J48-design-tree-tp4037704p4037704.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to