| xgboost | 
定义回归树为最常见的树模型。更多...
#include <tree_model.h>


| 类 | |
| 结构 | CategoricalSplitMatrix | 
| 用于分类拆分的类似 CSR 的矩阵。更多... | |
| 结构 | FVec | 
| 可由 RegTree 使用,并可由稀疏特征向量构造的稠密特征向量。更多... | |
| 类 | Node | 
| 树节点更多... | |
| 公共类型 | |
| 使用 | SplitCondT = bst_float | 
| 公共成员函数 | |
| void | ChangeToLeaf (int rid, bst_float value) | 
| 将非叶节点更改为叶节点,删除其子节点。更多... | |
| void | CollapseToLeaf (int rid, bst_float value) | 
| 将非叶节点折叠为叶节点,删除其子节点。更多... | |
| RegTree () | |
| RegTree (bst_target_t n_targets, bst_feature_t n_features) | |
| 使用形状初始化树模型的构造函数。更多... | |
| Node & | operator[] (int nid) | 
| 根据 nid 获取节点。更多... | |
| const Node & | operator[] (int nid) const | 
| 根据 nid 获取节点。更多... | |
| const std::vector< Node > & | GetNodes () const | 
| 获取节点的常量引用。更多... | |
| const std::vector< RTreeNodeStat > & | GetStats () const | 
| 获取统计信息的常量引用。更多... | |
| RTreeNodeStat & | Stat (int nid) | 
| 根据 nid 获取节点统计信息。更多... | |
| const RTreeNodeStat & | Stat (int nid) const | 
| 根据 nid 获取节点统计信息。更多... | |
| void | LoadModel (Json const &in) override | 
| 从 JSON 对象加载模型。更多... | |
| void | SaveModel (Json *out) const override | 
| 将模型配置保存到 JSON 对象。更多... | |
| bool | operator== (const RegTree &b) const | 
| template<typename Func > | |
| void | WalkTree (Func func) const | 
| bool | Equal (const RegTree &b) const | 
| 从用户角度比较两棵树是否相等。相等性仅比较未删除的节点。更多... | |
| void | ExpandNode (bst_node_t nid, unsigned split_index, bst_float split_value, bool default_left, bst_float base_weight, bst_float left_leaf_weight, bst_float right_leaf_weight, bst_float loss_change, float sum_hess, float left_sum, float right_sum, bst_node_t leaf_right_child=kInvalidNodeId) | 
| 将叶节点扩展为两个额外的叶节点。更多... | |
| void | ExpandNode (bst_node_t nidx, bst_feature_t split_index, float split_cond, bool default_left, linalg::VectorView< float const > base_weight, linalg::VectorView< float const > left_weight, linalg::VectorView< float const > right_weight) | 
| 将叶节点扩展为多目标树的两个额外叶节点。更多... | |
| void | ExpandCategorical (bst_node_t nid, bst_feature_t split_index, common::Span< const uint32_t > split_cat, bool default_left, bst_float base_weight, bst_float left_leaf_weight, bst_float right_leaf_weight, bst_float loss_change, float sum_hess, float left_sum, float right_sum) | 
| 将叶节点扩展为带有类别。更多... | |
| bool | HasCategoricalSplit () const | 
| 此树是否有分类拆分。更多... | |
| bool | IsMultiTarget () const | 
| 这是否是多目标树。更多... | |
| bst_target_t | NumTargets () const | 
| 叶权重的大小。更多... | |
| auto | GetMultiTargetTree () const | 
| 获取多目标树的底层实现。更多... | |
| bst_feature_t | NumFeatures () const noexcept | 
| 获取特征数量。更多... | |
| bst_node_t | NumNodes () const noexcept | 
| 获取此树中包括已删除节点在内的总节点数。更多... | |
| bst_node_t | NumValidNodes () const noexcept | 
| 获取此树中有效节点的总数。更多... | |
| bst_node_t | NumExtraNodes () const noexcept | 
| 除根节点外的额外节点数量。更多... | |
| bst_node_t | GetNumLeaves () const | 
| bst_node_t | GetNumSplitNodes () const | 
| std::int32_t | GetDepth (bst_node_t nid) const | 
| 获取当前深度。更多... | |
| void | SetLeaf (bst_node_t nidx, linalg::VectorView< float const > weight) | 
| 为多目标树设置叶权重。更多... | |
| int | MaxDepth (int nid) const | 
| 获取最大深度。更多... | |
| int | MaxDepth () | 
| 获取最大深度。更多... | |
| std::string | DumpModel (const FeatureMap &fmap, bool with_stats, std::string format) const | 
| 以请求的格式将模型转储为文本字符串。更多... | |
| FeatureType | NodeSplitType (bst_node_t nidx) const | 
| 获取节点的拆分类型。更多... | |
| std::vector< FeatureType > const & | GetSplitTypes () const | 
| 获取所有节点的拆分类型。更多... | |
| common::Span< uint32_t const > | GetSplitCategories () const | 
| common::Span< uint32_t const > | NodeCats (bst_node_t nidx) const | 
| 获取类别的位存储。更多... | |
| auto const & | GetSplitCategoriesPtr () const | 
| CategoricalSplitMatrix | GetCategoriesMatrix () const | 
| bst_feature_t | SplitIndex (bst_node_t nidx) const | 
| float | SplitCond (bst_node_t nidx) const | 
| bool | DefaultLeft (bst_node_t nidx) const | 
| bst_node_t | DefaultChild (bst_node_t nidx) const | 
| bool | IsRoot (bst_node_t nidx) const | 
| bool | IsLeaf (bst_node_t nidx) const | 
| bst_node_t | Parent (bst_node_t nidx) const | 
| bst_node_t | LeftChild (bst_node_t nidx) const | 
| bst_node_t | RightChild (bst_node_t nidx) const | 
| bool | IsLeftChild (bst_node_t nidx) const | 
| bst_node_t | Size () const | 
|  从 xgboost::Model 继承的公共成员函数 | |
| virtual | ~Model ()=default | 
| 静态公共属性 | |
| static constexpr bst_node_t | kInvalidNodeId {MultiTargetTree::InvalidNodeId()} | 
| static constexpr uint32_t | kDeletedNodeMarker = std::numeric_limits<uint32_t>::max() | 
| static constexpr bst_node_t | kRoot {0} | 
将回归树定义为最常见的树模型。
这是 xgboost 主要树模型中使用的数据结构。
| 
 | inline | 
| 
 | 内联显式 | 
使用形状初始化树模型的构造函数。
| 
 | inline | 
将非叶节点更改为叶节点,删除其子节点。
| rid | 节点的节点 ID。 | 
| value | 新的叶值。 | 
| 
 | inline | 
将非叶节点折叠为叶节点,删除其子节点。
| rid | 节点的节点 ID。 | 
| value | 新的叶值。 | 
| 
 | inline | 
| 
 | inline | 
| std::string xgboost::RegTree::DumpModel | ( | const FeatureMap & | fmap, | 
| bool | with_stats, | ||
| std::string | format | ||
| ) | const | 
以请求的格式将模型转储为文本字符串。
| fmap | 可能有助于解释特征的特征图 | 
| with_stats | 是否也转储统计信息。 | 
| format | 转储模型的格式 | 
| bool xgboost::RegTree::Equal | ( | const RegTree & | b | ) | const | 
从用户角度比较两棵树是否相等。相等性仅比较未删除的节点。
| b | 另一棵树。 | 
| void xgboost::RegTree::ExpandCategorical | ( | bst_node_t | nid, | 
| bst_feature_t | split_index, | ||
| common::Span< const uint32_t > | split_cat, | ||
| bool | default_left, | ||
| bst_float | base_weight, | ||
| bst_float | left_leaf_weight, | ||
| bst_float | right_leaf_weight, | ||
| bst_float | loss_change, | ||
| float | sum_hess, | ||
| float | left_sum, | ||
| float | right_sum | ||
| ) | 
将叶节点扩展为带有类别。
| nid | 要扩展的节点索引。 | 
| split_index | 拆分的特征索引。 | 
| split_cat | 包含类别的位集。 | 
| default_left | 默认为左边。 | 
| base_weight | 学习率之前的基本权重。 | 
| left_leaf_weight | 用于预测的左叶权重,由学习率修改。 | 
| right_leaf_weight | 用于预测的右叶权重,由学习率修改。 | 
| loss_change | 损失变化。 | 
| sum_hess | Hessian 和。 | 
| left_sum | 左叶的 Hessian 和。 | 
| right_sum | 右叶的 Hessian 和。 | 
| void xgboost::RegTree::ExpandNode | ( | bst_node_t | nid, | 
| unsigned | split_index, | ||
| bst_float | split_value, | ||
| bool | default_left, | ||
| bst_float | base_weight, | ||
| bst_float | left_leaf_weight, | ||
| bst_float | right_leaf_weight, | ||
| bst_float | loss_change, | ||
| float | sum_hess, | ||
| float | left_sum, | ||
| float | right_sum, | ||
| bst_node_t | leaf_right_child = kInvalidNodeId | ||
| ) | 
将叶节点扩展为两个额外的叶节点。
| nid | 要扩展的节点索引。 | 
| split_index | 拆分的特征索引。 | 
| split_value | 拆分条件。 | 
| default_left | 默认为左边。 | 
| base_weight | 学习率之前的基本权重。 | 
| left_leaf_weight | 用于预测的左叶权重,由学习率修改。 | 
| right_leaf_weight | 用于预测的右叶权重,由学习率修改。 | 
| loss_change | 损失变化。 | 
| sum_hess | Hessian 和。 | 
| left_sum | 左叶的 Hessian 和。 | 
| right_sum | 右叶的 Hessian 和。 | 
| leaf_right_child | 叶的右子节点索引,默认为 kInvalidNodeId,一些更新器使用叶的右子节点索引作为标记。 | 
| void xgboost::RegTree::ExpandNode | ( | bst_node_t | nidx, | 
| bst_feature_t | split_index, | ||
| float | split_cond, | ||
| bool | default_left, | ||
| linalg::VectorView< float const > | base_weight, | ||
| linalg::VectorView< float const > | left_weight, | ||
| linalg::VectorView< float const > | right_weight | ||
| ) | 
将叶节点扩展为多目标树的两个额外叶节点。
| 
 | inline | 
| 
 | inline | 
获取当前深度。
| nid | 节点 ID。 | 
| 
 | inline | 
获取多目标树的底层实现。
| 
 | inline | 
获取节点的常量引用。
| bst_node_t xgboost::RegTree::GetNumLeaves | ( | ) | const | 
| bst_node_t xgboost::RegTree::GetNumSplitNodes | ( | ) | const | 
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
获取所有节点的拆分类型。
| 
 | inline | 
获取统计信息的常量引用。
| 
 | inline | 
此树是否有分类拆分。
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
这是否是多目标树。
| 
 | inline | 
| 
 | inline | 
| 
 | overridevirtual | 
| 
 | inline | 
获取最大深度。
| 
 | inline | 
获取最大深度。
| nid | 节点 ID。 | 
| 
 | inline | 
获取类别的位存储。
| 
 | inline | 
获取节点的拆分类型。
| nidx | 节点索引。 | 
| 
 | inlinenoexcept | 
除根节点外的额外节点数量。
| 
 | inlinenoexcept | 
获取特征数量。
| 
 | inlinenoexcept | 
获取此树中包括已删除节点在内的总节点数。
| 
 | inline | 
叶权重的大小。
| 
 | inlinenoexcept | 
获取此树中有效节点的总数。
| 
 | inline | 
| 
 | inline | 
根据 nid 获取节点。
| 
 | inline | 
根据 nid 获取节点。
| 
 | inline | 
| 
 | inline | 
| 
 | overridevirtual | 
| 
 | inline | 
为多目标树设置叶权重。
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
根据 nid 获取节点统计信息。
| 
 | inline | 
根据 nid 获取节点统计信息。
| 
 | inline | 
| 
 | staticconstexpr | 
| 
 | staticconstexpr | 
| 
 | staticconstexpr |