|
xgboost
|
The interface of objective function. More...
#include <objective.h>


Public Member Functions | |
| ~ObjFunction () override=default | |
| virtual void | Configure (Args const &args)=0 |
| Configure the objective with the specified parameters. More... | |
| virtual void | GetGradient (HostDeviceVector< float > const &preds, MetaInfo const &info, std::int32_t iter, linalg::Matrix< GradientPair > *out_gpair)=0 |
| Get gradient over each of predictions, given existing information. More... | |
| virtual const char * | DefaultEvalMetric () const =0 |
| virtual Json | DefaultMetricConfig () const |
| Return the configuration for the default metric. More... | |
| virtual void | PredTransform (HostDeviceVector< float > *) const |
| Apply inverse link (activation) function to prediction values. More... | |
| virtual void | EvalTransform (HostDeviceVector< float > *io_preds) |
| Apply inverse link (activation) function to prediction values. More... | |
| virtual void | ProbToMargin (linalg::Vector< float > *) const |
| Apply the link function to the intercept. More... | |
| virtual void | InitEstimation (MetaInfo const &info, linalg::Vector< float > *base_score) const |
| Obtain the initial estimation of prediction (intercept). More... | |
| virtual struct ObjInfo | Task () const =0 |
| Return task of this objective. More... | |
| virtual bst_target_t | Targets (MetaInfo const &info) const |
| Return number of targets for input matrix. Right now XGBoost supports only multi-target regression. More... | |
| Context const * | Ctx () const |
| Getter of the context. More... | |
| virtual void | UpdateTreeLeaf (HostDeviceVector< bst_node_t > const &, MetaInfo const &, float, HostDeviceVector< float > const &, bst_target_t, RegTree *) const |
| Update the leaf values after a tree is built. Needed for objectives with 0 hessian. More... | |
Public Member Functions inherited from xgboost::Configurable | |
| virtual | ~Configurable ()=default |
| virtual void | LoadConfig (Json const &in)=0 |
| Load configuration from JSON object. More... | |
| virtual void | SaveConfig (Json *out) const =0 |
| Save configuration to JSON object. More... | |
Static Public Member Functions | |
| static constexpr float | DefaultBaseScore () |
| static ObjFunction * | Create (const std::string &name, Context const *ctx) |
| Create an objective function according to the name. More... | |
Protected Attributes | |
| Context const * | ctx_ {nullptr} |
The interface of objective function.
|
overridedefault |
|
pure virtual |
Configure the objective with the specified parameters.
| args | arguments to the objective function. |
|
static |
Create an objective function according to the name.
| name | Name of the objective. |
| ctx | Pointer to the context. |
|
inline |
Getter of the context.
|
inlinestaticconstexpr |
|
pure virtual |
|
inlinevirtual |
Return the configuration for the default metric.
|
inlinevirtual |
Apply inverse link (activation) function to prediction values.
This is only called when Eval is called, usually it redirect to PredTransform
| [in,out] | io_preds | prediction values, saves to this vector as well. |
|
pure virtual |
Get gradient over each of predictions, given existing information.
| preds | Raw prediction (before applying the inverse link) of the 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 |
|
virtual |
Obtain the initial estimation of prediction (intercept).
The output in base_score represents prediction after apply the inverse link function (valid prediction instead of raw).
| info | MetaInfo that contains label. |
| base_score | Output estimation. |
|
inlinevirtual |
Apply inverse link (activation) function to prediction values.
This is only called when Prediction is called
| [in,out] | io_preds | prediction values, saves to this vector as well. |
|
inlinevirtual |
Apply the link function to the intercept.
This is an inverse of PredTransform for most of the objectives (if there's a valid inverse). It's used to transform user-set base_score back to margin used by gradient boosting. The method converts objective-based valid outputs like probability back to raw model outputs.
| [in,out] | base_score | The intercept to transform. |
|
inlinevirtual |
Return number of targets for input matrix. Right now XGBoost supports only multi-target regression.
|
pure virtual |
Return task of this objective.
|
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. |
|
protected |