Medial Code Documentation
|
interface of objective function More...
#include <objective.h>
Public Member Functions | |
~ObjFunction () override=default | |
virtual destructor | |
virtual void | Configure (const std::vector< std::pair< std::string, std::string > > &args)=0 |
Configure the objective with the specified parameters. | |
virtual void | GetGradient (const HostDeviceVector< bst_float > &preds, const MetaInfo &info, int iteration, HostDeviceVector< GradientPair > *out_gpair)=0 |
Get gradient over each of predictions, given existing information. | |
virtual const char * | DefaultEvalMetric () const =0 |
virtual Json | DefaultMetricConfig () const |
Return the configuration for the default metric. | |
virtual void | PredTransform (HostDeviceVector< bst_float > *) const |
transform prediction values, this is only called when Prediction is called | |
virtual void | EvalTransform (HostDeviceVector< bst_float > *io_preds) |
transform prediction values, this is only called when Eval is called, usually it redirect to PredTransform | |
virtual bst_float | ProbToMargin (bst_float base_score) const |
transform probability value back to margin this is used to transform user-set base_score back to margin used by gradient boosting | |
virtual void | InitEstimation (MetaInfo const &info, linalg::Tensor< float, 1 > *base_score) const |
Make initialize estimation of prediction. | |
virtual struct ObjInfo | Task () const =0 |
Return task of this objective. | |
virtual bst_target_t | Targets (MetaInfo const &info) const |
Return number of targets for input matrix. | |
virtual void | UpdateTreeLeaf (HostDeviceVector< bst_node_t > const &, MetaInfo const &, float, HostDeviceVector< float > const &, std::int32_t, RegTree *) const |
Update the leaf values after a tree is built. | |
![]() | |
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 constexpr float | DefaultBaseScore () |
static ObjFunction * | Create (const std::string &name, Context const *ctx) |
Create an objective function according to name. | |
Protected Attributes | |
Context const * | ctx_ |
interface of objective function
|
pure virtual |
Configure the objective with the specified parameters.
args | arguments to the objective function. |
Implemented in xgboost::obj::LambdaRankObj< Loss, Cache >, xgboost::obj::LambdaRankObj< LambdaRankMAP, ltr::MAPCache >, xgboost::obj::LambdaRankObj< LambdaRankNDCG, ltr::NDCGCache >, xgboost::obj::LambdaRankObj< LambdaRankPairwise, ltr::RankingCache >, xgboost::obj::MyLogistic, and xgboost::obj::RegLossObjOneAPI< Loss >.
|
static |
Create an objective function according to name.
ctx | Pointer to runtime parameters. |
name | Name of the objective. |
|
pure virtual |
Implemented in xgboost::obj::MyLogistic, xgboost::obj::RegLossObjOneAPI< Loss >, xgboost::obj::LambdaRankNDCG, xgboost::obj::LambdaRankMAP, and xgboost::obj::LambdaRankPairwise.
|
inlinevirtual |
Return the configuration for the default metric.
Reimplemented in xgboost::obj::LambdaRankNDCG.
|
inlinevirtual |
transform prediction values, this is only called when Eval is called, usually it redirect to PredTransform
io_preds | prediction values, saves to this vector as well |
|
pure virtual |
Get gradient over each of predictions, given existing information.
preds | prediction of current round |
info | information about labels, weights, groups in rank |
iteration | current iteration number. |
out_gpair | output of get gradient, saves gradient and second order gradient in |
Implemented in xgboost::obj::RegLossObjOneAPI< Loss >.
|
virtual |
Make initialize estimation of prediction.
info | MetaInfo that contains label. |
base_score | Output estimation. |
|
inlinevirtual |
transform prediction values, this is only called when Prediction is called
io_preds | prediction values, saves to this vector as well |
Reimplemented in xgboost::obj::MyLogistic.
transform probability value back to margin this is used to transform user-set base_score back to margin used by gradient boosting
Reimplemented in xgboost::obj::MyLogistic, and xgboost::obj::RegLossObjOneAPI< Loss >.
|
inlinevirtual |
Return number of targets for input matrix.
Right now XGBoost supports only multi-target regression.
Reimplemented in xgboost::obj::LambdaRankObj< Loss, Cache >, xgboost::obj::LambdaRankObj< LambdaRankMAP, ltr::MAPCache >, xgboost::obj::LambdaRankObj< LambdaRankNDCG, ltr::NDCGCache >, and xgboost::obj::LambdaRankObj< LambdaRankPairwise, ltr::RankingCache >.
|
pure virtual |
Return task of this objective.
Implemented in xgboost::obj::MyLogistic, xgboost::obj::LambdaRankObj< Loss, Cache >, xgboost::obj::LambdaRankObj< LambdaRankMAP, ltr::MAPCache >, xgboost::obj::LambdaRankObj< LambdaRankNDCG, ltr::NDCGCache >, and xgboost::obj::LambdaRankObj< LambdaRankPairwise, ltr::RankingCache >.
|
inlinevirtual |
Update the leaf values after a tree is built.
Needed for objectives with 0 hessian.
Note that the leaf update is not well defined for distributed training as XGBoost computes only an average of quantile between workers. This breaks when some leaf have no sample assigned in a local worker.
position | The leaf index for each rows. |
info | MetaInfo providing labels and weights. |
learning_rate | The learning rate for current iteration. |
prediction | Model prediction after transformation. |
group_idx | The group index for this tree, 0 when it's not multi-target or multi-class. |
p_tree | Tree that needs to be updated. |