sklearn DecisionTree tree_

Sklearn API -
Understanding the decision tree structure

在这里插入图片描述

Array-based representation of a binary decision tree.
The binary tree is represented as a number of parallel arrays. The i-th
element of each array holds information about the node i. Node 0 is the tree’s root. You can find a detailed description of all arrays in _tree.pxd. NOTE: Some of the arrays only apply to either leaves or split nodes, resp. In this case the values of nodes of the other type are arbitrary!

Attributes

  • node_count : int
    The number of nodes (internal nodes + leaves) in the tree.
    总节点数(叶节点+内部结点+根节点)
  • capacity : int
    The current capacity (i.e., size) of the arrays, which is at least as
    great as node_count.
  • max_depth : int
    The depth of the tree, i.e. the maximum depth of its leaves.
    树的深度
  • children_left : array of int, shape [node_count]
    children_left[i] holds the node id of the left child of node i.
    For leaves, children_left[i] == TREE_LEAF. Otherwise,
    children_left[i] > i. This child handles the case where
    X[:, feature[i]] <= threshold[i].
    Note:TREE_LEAF = -1
    the “children_left” array mean
  • children_right : array of int, shape [node_count]
    children_right[i] holds the node id of the right child of node i.
    For leaves, children_right[i] == TREE_LEAF. Otherwise,
    children_right[i] > i. This child handles the case where
    X[:, feature[i]] > threshold[i].
  • feature : array of int, shape [node_count]
    feature[i] holds the feature to split on, for the internal node i.
    第i个节点(内部结点)的分割特征
  • threshold : array of double, shape [node_count]
    threshold[i] holds the threshold for the internal node i.
    结合feature,第i个节点分割特征的阈值,eg,小于该阈值归位左分支,大于该阈值,归位右分支。
  • value : array of double, shape [node_count, n_outputs, max_n_classes]
    Contains the constant prediction value of each node.
  • impurity : array of double, shape [node_count]
    impurity[i] holds the impurity (i.e., the value of the splitting
    criterion) at node i.
  • n_node_samples : array of int, shape [node_count]
    n_node_samples[i] holds the number of training samples reaching node i.
  • weighted_n_node_samples : array of int, shape [node_count]
    weighted_n_node_samples[i] holds the weighted number of training samples reaching node i.

后期会整理出用于中文文本分类的决策树的节点删除(人为后剪枝)和替换,有助于利用决策树提取规则,现在大家可以先参考此链接How to extract the decision rules from scikit-learn decision-tree?

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值