Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
LightGBM::TreeLearner Class Referenceabstract

Interface for tree learner. More...

#include <tree_learner.h>

Inheritance diagram for LightGBM::TreeLearner:
LightGBM::SerialTreeLearner LightGBM::GPUTreeLearner

Public Member Functions

virtual ~TreeLearner ()
 virtual destructor
 
virtual void Init (const Dataset *train_data, bool is_constant_hessian)=0
 Initialize tree learner with training dataset.
 
virtual void ResetTrainingData (const Dataset *train_data)=0
 
virtual void ResetConfig (const Config *config)=0
 Reset tree configs.
 
virtual TreeTrain (const score_t *gradients, const score_t *hessians, bool is_constant_hessian, Json &forced_split_json)=0
 training tree model on dataset
 
virtual TreeFitByExistingTree (const Tree *old_tree, const score_t *gradients, const score_t *hessians) const =0
 use a existing tree to fit the new gradients and hessians.
 
virtual TreeFitByExistingTree (const Tree *old_tree, const std::vector< int > &leaf_pred, const score_t *gradients, const score_t *hessians)=0
 
virtual void SetBaggingData (const data_size_t *used_indices, data_size_t num_data)=0
 Set bagging data.
 
virtual void AddPredictionToScore (const Tree *tree, double *out_score) const =0
 Using last trained tree to predict score then adding to out_score;.
 
virtual void RenewTreeOutput (Tree *tree, const ObjectiveFunction *obj, const double *prediction, data_size_t total_num_data, const data_size_t *bag_indices, data_size_t bag_cnt) const =0
 
virtual void RenewTreeOutput (Tree *tree, const ObjectiveFunction *obj, double prediction, data_size_t total_num_data, const data_size_t *bag_indices, data_size_t bag_cnt) const =0
 
TreeLearneroperator= (const TreeLearner &)=delete
 Disable copy.
 
 TreeLearner (const TreeLearner &)=delete
 Disable copy.
 

Static Public Member Functions

static TreeLearnerCreateTreeLearner (const std::string &learner_type, const std::string &device_type, const Config *config)
 Create object of tree learner.
 

Detailed Description

Interface for tree learner.

Member Function Documentation

◆ AddPredictionToScore()

virtual void LightGBM::TreeLearner::AddPredictionToScore ( const Tree tree,
double *  out_score 
) const
pure virtual

Using last trained tree to predict score then adding to out_score;.

Parameters
out_scoreoutput score

Implemented in LightGBM::SerialTreeLearner.

◆ CreateTreeLearner()

TreeLearner * LightGBM::TreeLearner::CreateTreeLearner ( const std::string &  learner_type,
const std::string &  device_type,
const Config config 
)
static

Create object of tree learner.

Parameters
learner_typeType of tree learner
device_typeType of tree learner
configconfig of tree

◆ FitByExistingTree()

virtual Tree * LightGBM::TreeLearner::FitByExistingTree ( const Tree old_tree,
const score_t gradients,
const score_t hessians 
) const
pure virtual

use a existing tree to fit the new gradients and hessians.

Implemented in LightGBM::SerialTreeLearner.

◆ Init()

virtual void LightGBM::TreeLearner::Init ( const Dataset train_data,
bool  is_constant_hessian 
)
pure virtual

Initialize tree learner with training dataset.

Parameters
train_dataThe used training data
is_constant_hessianTrue if all hessians share the same value

Implemented in LightGBM::SerialTreeLearner.

◆ ResetConfig()

virtual void LightGBM::TreeLearner::ResetConfig ( const Config config)
pure virtual

Reset tree configs.

Parameters
configconfig of tree

Implemented in LightGBM::SerialTreeLearner.

◆ SetBaggingData()

virtual void LightGBM::TreeLearner::SetBaggingData ( const data_size_t used_indices,
data_size_t  num_data 
)
pure virtual

Set bagging data.

Parameters
used_indicesUsed data indices
num_dataNumber of used data

Implemented in LightGBM::SerialTreeLearner.

◆ Train()

virtual Tree * LightGBM::TreeLearner::Train ( const score_t gradients,
const score_t hessians,
bool  is_constant_hessian,
Json forced_split_json 
)
pure virtual

training tree model on dataset

Parameters
gradientsThe first order gradients
hessiansThe second order gradients
is_constant_hessianTrue if all hessians share the same value
Returns
A trained tree

Implemented in LightGBM::SerialTreeLearner.


The documentation for this class was generated from the following files: