【发布时间】:2019-04-16 06:38:37
【问题描述】:
在 sci-kit learn 中,可以访问整个树结构,即树的每个节点。这允许探索在树的每个拆分处使用的属性以及用于测试的值
The binary tree structure has 5 nodes and has the following tree structure:
node=0 test node: go to node 1 if X[:, 3] <= 0.800000011920929 else to node 2.
node=1 leaf node.
node=2 test node: go to node 3 if X[:, 2] <= 4.950000047683716 else to node 4.
node=3 leaf node.
node=4 leaf node.
Rules used to predict sample 0:
decision id node 0 : (X_test[0, 3] (= 2.4) > 0.800000011920929)
decision id node 2 : (X_test[0, 2] (= 5.1) > 4.950000047683716)
对于随机森林,你可以通过遍历所有决策树来获得相同的信息
for tree in model.estimators_:
# extract info from tree
是否可以从 LightGBM 模型中提取相同的信息?也就是说,您可以访问:a) 每棵树和 b) 树的每个节点吗?
【问题讨论】:
标签: nodes random-forest decision-tree lightgbm