Medial Code Documentation
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions | Variables
xgboost::tree Namespace Reference

Copyright 2021-2023 by XGBoost Contributors. More...

Data Structures

class  BoundedHistCollection
 A persistent cache for CPU histogram. More...
 
class  ColMaker
 column-wise update to construct a tree More...
 
struct  ColMakerTrainParam
 
class  ColumnSplitHelper
 
class  CommonRowPartitioner
 
struct  CPUExpandEntry
 
class  Driver
 
struct  ExpandEntryImpl
 Structure for storing tree split candidate. More...
 
class  GloablApproxBuilder
 
class  GlobalApproxUpdater
 Implementation for the approx tree method. More...
 
class  HistEvaluator
 
struct  HistMakerTrainParam
 
class  HistMultiEvaluator
 
class  HistogramBuilder
 
class  HistUpdater
 Tree updater for single-target trees. More...
 
struct  MultiExpandEntry
 
class  MultiHistogramBuilder
 Histogram builder that can handle multiple targets. More...
 
class  MultiTargetHistBuilder
 Updater for building multi-target trees. More...
 
class  QuantileHistMaker
 construct a tree using quantized feature values More...
 
struct  RandomReplace
 
struct  SplitEntryContainer
 statistics that is helpful to store and represent a split solution for the tree More...
 
class  TestCategoricalSplitWithMissing
 
class  TestPartitionBasedSplit
 Enumerate all possible partitions for categorical split. More...
 
struct  TrainParam
 training parameters for regression tree More...
 
class  TreeEvaluator
 
class  TreePruner
 pruner that prunes a tree after growing finishes More...
 
class  TreeRefresher
 pruner that prunes a tree after growing finishes More...
 
class  TreeSyncher
 syncher that synchronize the tree in all distributed nodes can implement various strategies, so far it is always set to node 0's tree More...
 

Typedefs

using SplitEntry = SplitEntryContainer< GradStats >
 

Enumerations

enum  SplitType { kNum = 0 , kOneHot = 1 , kPart = 2 }
 

Functions

template<typename ExpandEntryT >
bool DepthWise (const ExpandEntryT &lhs, const ExpandEntryT &rhs)
 
template<typename ExpandEntryT >
bool LossGuide (const ExpandEntryT &lhs, const ExpandEntryT &rhs)
 
void FitStump (Context const *ctx, MetaInfo const &info, HostDeviceVector< GradientPair > const &gpair, bst_target_t n_targets, linalg::Vector< float > *out)
 Fit a tree stump as an estimation of base_score.
 
template<typename T >
XGBOOST_DEVICE double CalcUnregularizedWeight (T sum_grad, T sum_hess)
 
template<typename Partitioner >
void UpdatePredictionCacheImpl (Context const *ctx, RegTree const *p_last_tree, std::vector< Partitioner > const &partitioner, linalg::VectorView< float > out_preds)
 CPU implementation of update prediction cache, which calculates the leaf value for the last tree and accumulates it to prediction vector.
 
template<typename Partitioner >
void UpdatePredictionCacheImpl (Context const *ctx, RegTree const *p_last_tree, std::vector< Partitioner > const &partitioner, linalg::MatrixView< float > out_preds)
 
void AssignNodes (RegTree const *p_tree, std::vector< MultiExpandEntry > const &valid_candidates, common::Span< bst_node_t > nodes_to_build, common::Span< bst_node_t > nodes_to_sub)
 Decide which node as the build node for multi-target trees.
 
void AssignNodes (RegTree const *p_tree, std::vector< CPUExpandEntry > const &candidates, common::Span< bst_node_t > nodes_to_build, common::Span< bst_node_t > nodes_to_sub)
 Decide which node as the build node.
 
template<typename Partitioner >
common::BlockedSpace2d ConstructHistSpace (Partitioner const &partitioners, std::vector< bst_node_t > const &nodes_to_build)
 
 DMLC_REGISTER_PARAMETER (HistMakerTrainParam)
 
void SampleGradient (Context const *ctx, TrainParam param, linalg::MatrixView< GradientPair > out)
 
template<typename TrainingParams , typename T >
XGBOOST_DEVICECalcGainGivenWeight (const TrainingParams &p, T sum_grad, T sum_hess, T w)
 
template<typename TrainingParams , typename T >
XGBOOST_DEVICECalcWeight (const TrainingParams &p, T sum_grad, T sum_hess)
 
template<typename TrainingParams , typename T >
XGBOOST_DEVICECalcGain (const TrainingParams &p, T sum_grad, T sum_hess)
 
template<typename TrainingParams , typename StatT , typename T = decltype(StatT().GetHess())>
XGBOOST_DEVICECalcGain (const TrainingParams &p, StatT stat)
 
template<typename TrainingParams , typename GpairT >
XGBOOST_DEVICE float CalcWeight (const TrainingParams &p, GpairT sum_grad)
 
void CalcWeight (TrainParam const &p, linalg::VectorView< GradientPairPrecise const > grad_sum, float eta, linalg::VectorView< float > out_w)
 multi-target weight, calculated with learning rate.
 
void CalcWeight (TrainParam const &p, linalg::VectorView< GradientPairPrecise const > grad_sum, linalg::VectorView< float > out_w)
 multi-target weight
 
double CalcGainGivenWeight (TrainParam const &p, linalg::VectorView< GradientPairPrecise const > sum_grad, linalg::VectorView< float const > weight)
 
struct XGBOOST_ALIGNAS (16) GradStats
 core statistics used for tree construction
 
template<typename T , typename U >
std::vector< T > & CopyStats (linalg::VectorView< U > const &src, std::vector< T > *dst)
 
GradStats & CopyStats (GradStats const &src, GradStats *dst)
 
 DMLC_REGISTER_PARAMETER (TrainParam)
 
 DMLC_REGISTRY_LINK_TAG (updater_colmaker)
 
 DMLC_REGISTRY_LINK_TAG (updater_refresh)
 
 DMLC_REGISTRY_LINK_TAG (updater_prune)
 
 DMLC_REGISTRY_LINK_TAG (updater_quantile_hist)
 
 DMLC_REGISTRY_LINK_TAG (updater_approx)
 
 DMLC_REGISTRY_LINK_TAG (updater_sync)
 
 DMLC_REGISTRY_FILE_TAG (updater_approx)
 
 DMLC_REGISTRY_FILE_TAG (grow_histmaker)
 
 describe ("Tree constructor that uses approximate histogram construction " "for each node.") .set_body([](Context const *ctx
 
 DMLC_REGISTRY_FILE_TAG (updater_colmaker)
 
 DMLC_REGISTER_PARAMETER (ColMakerTrainParam)
 
 describe ("Grow tree with parallelization over columns.") .set_body([](Context const *ctx
 
 DMLC_REGISTRY_FILE_TAG (updater_prune)
 
 describe ("Pruner that prune the tree according to statistics.") .set_body([](Context const *ctx
 
 DMLC_REGISTRY_FILE_TAG (updater_quantile_hist)
 
BatchParam HistBatch (TrainParam const *param)
 
template<typename ExpandEntry , typename Updater >
void UpdateTree (common::Monitor *monitor_, linalg::MatrixView< GradientPair const > gpair, Updater *updater, DMatrix *p_fmat, TrainParam const *param, HostDeviceVector< bst_node_t > *p_out_position, RegTree *p_tree)
 
 describe ("Grow tree using quantized histogram.") .set_body([](Context const *ctx
 
 DMLC_REGISTRY_FILE_TAG (updater_refresh)
 
 describe ("Refresher that refreshes the weight and statistics according to data.") .set_body([](Context const *ctx
 
 DMLC_REGISTRY_FILE_TAG (updater_sync)
 
 describe ("Syncher that synchronize the tree in all distributed nodes.") .set_body([](Context const *ctx
 
void TestEvaluateSplits (bool force_read_by_column)
 
 TEST (HistEvaluator, Evaluate)
 
 TEST (HistMultiEvaluator, Evaluate)
 
 TEST (HistEvaluator, Apply)
 
 TEST_F (TestPartitionBasedSplit, CPUHist)
 
 TEST (HistEvaluator, Categorical)
 
 TEST_F (TestCategoricalSplitWithMissing, HistEvaluator)
 
void TestAddHistRows (bool is_distributed)
 
 TEST (CPUHistogram, AddRows)
 
void TestSyncHist (bool is_distributed)
 
 TEST (CPUHistogram, SyncHist)
 
void TestBuildHistogram (bool is_distributed, bool force_read_by_column, bool is_col_split)
 
 TEST (CPUHistogram, BuildHist)
 
 TEST (CPUHistogram, BuildHistColSplit)
 
 TEST (CPUHistogram, Categorical)
 
 TEST (CPUHistogram, ExternalMemory)
 
 TEST_P (OverflowTest, Overflow)
 
 INSTANTIATE_TEST_SUITE_P (CPUHistogram, OverflowTest, ::testing::ValuesIn(MakeParamsForTest()))
 
 TEST (Sampler, Basic)
 
 TEST (Approx, Partitioner)
 
 TEST (Approx, PartitionerColSplit)
 
 TEST (CommonRowPartitioner, LeafPartition)
 
 TEST (CPUFeatureInteractionConstraint, Empty)
 
 TEST (CPUFeatureInteractionConstraint, Basic)
 
 TEST (CPUMonoConstraint, Basic)
 
auto MakeCutsForTest (std::vector< float > values, std::vector< uint32_t > ptrs, std::vector< float > min_values, int32_t device)
 
 TEST (InitEstimation, FitStump)
 
 TEST (InitEstimation, FitStumpColumnSplit)
 
std::shared_ptr< DMatrixGenerateDMatrix (std::size_t rows, std::size_t cols, bool categorical=false)
 
 TEST (GrowHistMaker, InteractionConstraint)
 
 TEST (GrowHistMaker, ColumnSplitNumerical)
 
 TEST (GrowHistMaker, ColumnSplitCategorical)
 
void GetSplit (RegTree *tree, float split_value, std::vector< CPUExpandEntry > *candidates)
 
void GetMultiSplitForTest (RegTree *tree, float split_value, std::vector< MultiExpandEntry > *candidates)
 
 TEST (Updater, Prune)
 
 TEST (QuantileHist, Partitioner)
 
 TEST (QuantileHist, MultiPartitioner)
 
 TEST (QuantileHist, PartitionerColSplit)
 
 TEST (QuantileHist, MultiPartitionerColSplit)
 
 TEST (QuantileHist, ColumnSplit)
 
 TEST (QuantileHist, ColumnSplitMultiTarget)
 
 TEST (Updater, Refresh)
 

Variables

ObjInfo const * task
 
 auto { return new ColMaker(ctx)
 

Detailed Description

Copyright 2021-2023 by XGBoost Contributors.

Copyright 2018-2023 by XGBoost Contributors.

Copyright 2019-2023 by XGBoost Contributors.

Copyright 2022-2023 by XGBoost Contributors.

Copyright 2022-2023 by XGBoost contributors.

Copyright 2018-2023 by Contributors.

Copyright 2021-2023 by XGBoost contributors.

Copyright 2021-2023, XGBoost Contributors.

Copyright 2023 by XGBoost Contributors.

Copyright 2021-2023 XGBoost contributors.

Implementation for the approx tree method.

Function Documentation

◆ UpdatePredictionCacheImpl()

template<typename Partitioner >
void xgboost::tree::UpdatePredictionCacheImpl ( Context const *  ctx,
RegTree const *  p_last_tree,
std::vector< Partitioner > const &  partitioner,
linalg::VectorView< float >  out_preds 
)

CPU implementation of update prediction cache, which calculates the leaf value for the last tree and accumulates it to prediction vector.

Parameters
p_last_treeThe last tree being updated by tree updater

◆ UpdateTree()

template<typename ExpandEntry , typename Updater >
void xgboost::tree::UpdateTree ( common::Monitor monitor_,
linalg::MatrixView< GradientPair const >  gpair,
Updater *  updater,
DMatrix p_fmat,
TrainParam const *  param,
HostDeviceVector< bst_node_t > *  p_out_position,
RegTree p_tree 
)

Note for update position Root: Not applied: No need to update position as initialization has got all the rows ordered. Applied: Update position is run on applied nodes so the rows are partitioned. Non-root: Not applied: That node is root of the subtree, same rule as root. Applied: Ditto

◆ XGBOOST_ALIGNAS()

struct xgboost::tree::XGBOOST_ALIGNAS ( 16  )

core statistics used for tree construction

sum gradient statistics

sum hessian statistics

accumulate statistics

Parameters
pthe gradient pair

add statistics to the data

same as add, reduce is used in All Reduce

set current value to a - b

Returns
whether the statistics is not used yet

add statistics to the data

Variable Documentation

◆ task

ObjInfo const * xgboost::tree::task
Initial value:
{
return new GlobalApproxUpdater(ctx, task)