xgboost

Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
xgboost::ObjFunction Class Referenceabstract

interface of objective function More...

`#include <objective.h>`

Inheritance diagram for xgboost::ObjFunction:
Collaboration diagram for xgboost::ObjFunction:

## Public Member Functions
| ~ObjFunction () override=default
| virtual destructor More...
virtual void | Configure (const std::vector< std::pair< std::string, std::string > > &args)=0
| Configure the objective with the specified parameters. More...
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. More...
virtual const char * | DefaultEvalMetric () const =0
virtual void | PredTransform (HostDeviceVector< bst_float > *) const
| transform prediction values, this is only called when Prediction is called More...
virtual void | EvalTransform (HostDeviceVector< bst_float > *io_preds)
| transform prediction values, this is only called when Eval is called, usually it redirect to PredTransform More...
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 More...
virtual struct ObjInfo | Task () const =0
| Return task of this objective. More...
virtual uint32_t | Targets (MetaInfo const &info) const
| Return number of targets for input matrix. Right now XGBoost supports only multi-target regression. 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 ObjFunction * | Create (const std::string &name, GenericParameter const *tparam)
| Create an objective function according to name. More...

## Protected Attributes
GenericParameter const * | ctx_

## Detailed Description

interface of objective function

## Constructor & Destructor Documentation

## ◆ ~ObjFunction()

xgboost::ObjFunction::~ObjFunction | ( |  | ) |
| override default

virtual destructor

## Member Function Documentation

## ◆ Configure()

virtual void xgboost::ObjFunction::Configure | ( | const std::vector< std::pair< std::string, std::string > > & | args | ) |
| pure virtual

Configure the objective with the specified parameters.

Parameters

  args | arguments to the objective function.

## ◆ Create()

static ObjFunction* xgboost::ObjFunction::Create | ( | const std::string & | name,
|  | GenericParameter const * | tparam
| ) |  |
| static

Create an objective function according to name.

Parameters

  tparam | Generic parameters.
  name | Name of the objective.

## ◆ DefaultEvalMetric()

virtual const char* xgboost::ObjFunction::DefaultEvalMetric | ( |  | ) | const
| pure virtual

Returns
  the default evaluation metric for the objective

## ◆ EvalTransform()

virtual void xgboost::ObjFunction::EvalTransform | ( | HostDeviceVector< bst_float > * | io_preds | ) |
| inline virtual

transform prediction values, this is only called when Eval is called, usually it redirect to PredTransform

Parameters

  io_preds | prediction values, saves to this vector as well

## ◆ GetGradient()

virtual void xgboost::ObjFunction::GetGradient | ( | const HostDeviceVector< bst_float > & | preds,
|  | const MetaInfo & | info,
|  | int | iteration,
|  | HostDeviceVector< GradientPair > * | out_gpair
| ) |  |
| pure virtual

Get gradient over each of predictions, given existing information.

Parameters

  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

## ◆ PredTransform()

virtual void xgboost::ObjFunction::PredTransform | ( | HostDeviceVector< bst_float > * |  | ) | const
| inline virtual

transform prediction values, this is only called when Prediction is called

Parameters

  io_preds | prediction values, saves to this vector as well

## ◆ ProbToMargin()

virtual bst_float xgboost::ObjFunction::ProbToMargin | ( | bst_float | base_score | ) | const
| inline virtual

transform probability value back to margin this is used to transform user-set base_score back to margin used by gradient boosting

Returns
  transformed value

## ◆ Targets()

virtual uint32_t xgboost::ObjFunction::Targets | ( | MetaInfo const & | info | ) | const
| inline virtual

Return number of targets for input matrix. Right now XGBoost supports only multi-target regression.

## ◆ Task()

virtual struct ObjInfo xgboost::ObjFunction::Task | ( |  | ) | const
| pure virtual

Return task of this objective.

## Member Data Documentation

## ◆ ctx_

GenericParameter const* xgboost::ObjFunction::ctx_
| protected

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

- /home/runner/work/xgboost/xgboost/include/xgboost/objective.h