getRules: parse a decision tree in randomForest into list of path as...

Description Usage Arguments Value Examples

View source: R/getRules.R

Description

parse a decision tree in randomForest into list of path as data.frame

Usage

1
getRules(forest, ktree = NULL, resample = FALSE)

Arguments

forest

an object of ensemble trees to be parsed. See randomForest or xgboost.

ktree

an integer. number of decision tree to be parsed. If ktree=NULL (default), all tree will be parsed.

resample

Logical. If TRUE, trees are ramdomly selected. If FALSE, trees are selected according to head(ktree) from forest.

Value

a list of trees (list).

Examples

1
2
3
4
5
6
7
8
## Not run: 
X <- iris[, 1:(ncol(iris)-1)]
true.y <- iris[, ncol(iris)]

rf.iris <- randomForest(X, true.y, ntree=30)
getRules(rf.iris, ktree=15)

## End(Not run)

katokohaku/featureTweakR documentation built on May 17, 2019, 11:17 p.m.