I am using rpart for building a decision tree classifier. I wish to use my own pruning function based on certain parameters of the leaf nodes corresponding to a subtree. For this, I think I need to traverse the tree. I explored the documentation of rpart, but could not come up with a way to do it. Please help.
我正在使用rpart构建决策树分类器。我希望使用我自己的修剪函数,基于与子树对应的叶节点的某些参数。为此,我认为我需要遍历这棵树。我研究了rpart的文档,但是没有找到一种方法。请帮助。
1 个解决方案
#1
2
Take a look at the tree traversal code I had at extracting predictors from ctree object
看看我从ctree对象中提取谓词的树遍历代码
Potentially, this will be useful.
这可能是有用的。
#1
2
Take a look at the tree traversal code I had at extracting predictors from ctree object
看看我从ctree对象中提取谓词的树遍历代码
Potentially, this will be useful.
这可能是有用的。