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

interface of objective function More...

#include <objective.h>

Collaboration diagram for xgboost::ObjFunction:
Collaboration graph

Public Member Functions

virtual ~ObjFunction ()=default
 virtual destructor More...
 
template<typename PairIter >
void Configure (PairIter begin, PairIter end)
 set configuration from pair iterators. 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...
 

Static Public Member Functions

static ObjFunctionCreate (const std::string &name)
 Create an objective function according to name. More...
 

Detailed Description

interface of objective function

Constructor & Destructor Documentation

◆ ~ObjFunction()

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

virtual destructor

Member Function Documentation

◆ Configure() [1/2]

template<typename PairIter >
void xgboost::ObjFunction::Configure ( PairIter  begin,
PairIter  end 
)
inline

set configuration from pair iterators.

Parameters
beginThe beginning iterator.
endThe end iterator.
Template Parameters
PairIteriterator<std::pair<std::string, std::string> >

◆ Configure() [2/2]

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)
static

Create an objective function according to name.

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

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