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:
Inheritance graph
Collaboration diagram for xgboost::ObjFunction:
Collaboration graph

Public Member Functions

virtual ~ObjFunction ()=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 > *io_preds)
 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...
 
- 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 ObjFunctionCreate (const std::string &name, GenericParameter const *tparam)
 Create an objective function according to name. More...
 

Protected Attributes

GenericParameter const * tparam_
 

Detailed Description

interface of objective function

Constructor & Destructor Documentation

◆ ~ObjFunction()

virtual xgboost::ObjFunction::~ObjFunction ( )
virtualdefault

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
argsarguments 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
tparamGeneric parameters.
nameName 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)
inlinevirtual

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

Parameters
io_predsprediction 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
predsprediction of current round
infoinformation about labels, weights, groups in rank
iterationcurrent iteration number.
out_gpairoutput of get gradient, saves gradient and second order gradient in

◆ PredTransform()

virtual void xgboost::ObjFunction::PredTransform ( HostDeviceVector< bst_float > *  io_preds)
inlinevirtual

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

Parameters
io_predsprediction values, saves to this vector as well

◆ ProbToMargin()

virtual bst_float xgboost::ObjFunction::ProbToMargin ( bst_float  base_score) const
inlinevirtual

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

Member Data Documentation

◆ tparam_

GenericParameter const* xgboost::ObjFunction::tparam_
protected

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