Medial Code Documentation
|
interface of tree update module, that performs update of a tree. More...
#include <tree_updater.h>
Public Member Functions | |
TreeUpdater (const Context *ctx) | |
~TreeUpdater () override=default | |
virtual destructor | |
virtual void | Configure (const Args &args)=0 |
Initialize the updater with given arguments. | |
virtual bool | CanModifyTree () const |
Whether this updater can be used for updating existing trees. | |
virtual bool | HasNodePosition () const |
Wether the out_position in Update is valid. This determines whether adaptive tree can be used. | |
virtual void | Update (tree::TrainParam const *param, HostDeviceVector< GradientPair > *gpair, DMatrix *data, common::Span< HostDeviceVector< bst_node_t > > out_position, const std::vector< RegTree * > &out_trees)=0 |
perform update to the tree models | |
virtual bool | UpdatePredictionCache (const DMatrix *, linalg::MatrixView< float >) |
determines whether updater has enough knowledge about a given dataset to quickly update prediction cache its training data and performs the update if possible. | |
virtual char const * | Name () const =0 |
![]() | |
virtual void | LoadConfig (Json const &in)=0 |
Load configuration from JSON object. | |
virtual void | SaveConfig (Json *out) const =0 |
Save configuration to JSON object. | |
Static Public Member Functions | |
static TreeUpdater * | Create (const std::string &name, Context const *ctx, ObjInfo const *task) |
Create a tree updater given name. | |
Protected Attributes | |
Context const * | ctx_ = nullptr |
interface of tree update module, that performs update of a tree.
|
inlinevirtual |
Whether this updater can be used for updating existing trees.
Some updaters are used for building new trees (like hist
), while some others are used for modifying existing trees (like prune
). Return true if it can modify existing trees.
Reimplemented in xgboost::tree::TreePruner, and xgboost::tree::TreeRefresher.
|
pure virtual |
Initialize the updater with given arguments.
args | arguments to the objective function. |
Implemented in xgboost::tree::GlobalApproxUpdater, xgboost::tree::QuantileHistMaker, xgboost::tree::TreeRefresher, xgboost::tree::TreeSyncher, xgboost::tree::ColMaker, and xgboost::tree::TreePruner.
|
static |
Create a tree updater given name.
name | Name of the tree updater. |
ctx | A global runtime parameter |
task | Infomation about the objective. |
|
inlinevirtual |
Wether the out_position in Update
is valid. This determines whether adaptive tree can be used.
Reimplemented in xgboost::tree::GlobalApproxUpdater, and xgboost::tree::QuantileHistMaker.
|
pure virtual |
perform update to the tree models
param | Hyper-parameter for constructing trees. |
gpair | the gradient pair statistics of the data |
data | The data matrix passed to the updater. |
out_position | The leaf index for each row. The index is negated if that row is removed during sampling. So the 3th node is ~3. |
out_trees | references the trees to be updated, updater will change the content of trees note: all the trees in the vector are updated, with the same statistics, but maybe different random seeds, usually one tree is passed in at a time, there can be multiple trees when we train random forest style model |
Implemented in xgboost::tree::TreeSyncher, xgboost::tree::ColMaker, xgboost::tree::GlobalApproxUpdater, xgboost::tree::TreePruner, xgboost::tree::QuantileHistMaker, and xgboost::tree::TreeRefresher.
|
inlinevirtual |
determines whether updater has enough knowledge about a given dataset to quickly update prediction cache its training data and performs the update if possible.
data | data matrix |
out_preds | prediction cache to be updated |
Reimplemented in xgboost::tree::GlobalApproxUpdater, and xgboost::tree::QuantileHistMaker.