Last data update: 2014.03.03

R: Plot a decision tree
plot.C5.0R Documentation

Plot a decision tree

Description

Plot a decision tree.

Usage

## S3 method for class 'C5.0'
plot(x, trial = 0, subtree = NULL, ...)

Arguments

x

an object of class C5.0

trial

an integer for how many boosting iterations are used for prediction. NOTE: the internals of C5.0 are zero-based so to get the initial decision tree you must use trial = 0. If trial is set too large, it is reset to the largest value and a warning is given.

subtree

an optional integer that can be used to isolate nodes below the specified split. See [.party for more details.

...

options passed to plot.party

Value

No value is returned; a plot is rendered.

Author(s)

Mark Culp, Max Kuhn

References

Quinlan R (1993). C4.5: Programs for Machine Learning. Morgan Kaufmann Publishers, http://www.rulequest.com/see5-unix.html

See Also

C5.0, [.party

Examples

mod1 <- C5.0(Species ~ ., data = iris)
plot(mod1)
plot(mod1, subtree = 3)


mod2 <- C5.0(Species ~ ., data = iris, trials = 10)
plot(mod2) ## should be the same as above

## plot first weighted tree
plot(mod2, trial = 1)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(C50)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/C50/plot.C5.0.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot.C5.0
> ### Title: Plot a decision tree
> ### Aliases: plot.C5.0
> ### Keywords: models
> 
> ### ** Examples
> 
> mod1 <- C5.0(Species ~ ., data = iris)
> plot(mod1)
> plot(mod1, subtree = 3)
> 
> 
> mod2 <- C5.0(Species ~ ., data = iris, trials = 10)
> plot(mod2) ## should be the same as above
> 
> ## plot first weighted tree
> plot(mod2, trial = 1)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>