extract.rules {ranktreeEnsemble} | R Documentation |
Extract Interpretable Decision Rules from a Random Forest Model
Description
Extract rules from a random forest (rfsrc)
object
Usage
extract.rules(object, subtrees = 5,
treedepth = 2,
digit = 2,
pairs = TRUE)
Arguments
object |
A random forest |
subtrees |
Number of trees to extract rules |
treedepth |
Tree depth. The larger the number, the longer the extracted rules are. |
digit |
Digit to be displayed in the extracted rules. |
pairs |
Are varibles in |
Value
rule |
Interpretable extracted rules. Note that the performance score displayed is inaccurate based on few samples. |
rule.raw |
Rules directly extracted from trees for prediction purpose |
data |
Data used to grow trees from the argument |
Author(s)
Ruijie Yin (Maintainer,<ruijieyin428@gmail.com>), Chen Ye and Min Lu
References
Lu M. Yin R. and Chen X.S. Ensemble Methods of Rank-Based Trees for Single Sample Classification with Gene Expression Profiles. Journal of Translational Medicine. 22, 140 (2024). doi: 10.1186/s12967-024-04940-2
Examples
data(tnbc)
obj <- rforest(subtype~., data = tnbc[1:100,c(1:5,337)])
objr <- extract.rules(obj)
objr$rule[,1:3]
#### extract rules from a regular random forest
library(randomForestSRC)
obj2 <- rfsrc(subtype~., data = tnbc[1:100,c(1:5,337)])
objr2 <- extract.rules(obj2, pairs = FALSE)
objr2$rule[,1:3]