7 #ifndef XGBOOST_OBJECTIVE_H_
8 #define XGBOOST_OBJECTIVE_H_
10 #include <dmlc/registry.h>
42 virtual void Configure(
const std::vector<std::pair<std::string, std::string> >& args) = 0;
98 LOG(FATAL) <<
"multioutput is not supported by current objective function";
133 :
public dmlc::FunctionRegEntryBase<ObjFunctionReg,
134 std::function<ObjFunction* ()> > {
149 #define XGBOOST_REGISTER_OBJECTIVE(UniqueId, Name) \
150 static DMLC_ATTRIBUTE_UNUSED ::xgboost::ObjFunctionReg & \
151 __make_ ## ObjFunctionReg ## _ ## UniqueId ## __ = \
152 ::dmlc::Registry< ::xgboost::ObjFunctionReg>::Get()->__REGISTER__(Name)
defines configuration macros of xgboost.
interface of objective function
Definition: objective.h:28
virtual void PredTransform(HostDeviceVector< bst_float > *) const
transform prediction values, this is only called when Prediction is called
Definition: objective.h:62
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 marg...
Definition: objective.h:78
virtual void UpdateTreeLeaf(HostDeviceVector< bst_node_t > const &, MetaInfo const &, HostDeviceVector< float > const &, RegTree *) const
Update the leaf values after a tree is built. Needed for objectives with 0 hessian.
Definition: objective.h:116
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.
static constexpr float DefaultBaseScore()
Definition: objective.h:33
virtual void EvalTransform(HostDeviceVector< bst_float > *io_preds)
transform prediction values, this is only called when Eval is called, usually it redirect to PredTran...
Definition: objective.h:69
virtual uint32_t Targets(MetaInfo const &info) const
Return number of targets for input matrix. Right now XGBoost supports only multi-target regression.
Definition: objective.h:96
Context const * ctx_
Definition: objective.h:30
virtual void Configure(const std::vector< std::pair< std::string, std::string > > &args)=0
Configure the objective with the specified parameters.
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.
~ObjFunction() override=default
virtual destructor
virtual const char * DefaultEvalMetric() const =0
static ObjFunction * Create(const std::string &name, GenericParameter const *tparam)
Create an objective function according to name.
define regression tree to be the most common tree model. This is the data structure used in xgboost's...
Definition: tree_model.h:131
auto Shape() const
Definition: linalg.h:775
The input data structure of xgboost.
A device-and-host vector abstraction layer.
Defines the abstract interface for different components in XGBoost.
namespace of xgboost
Definition: base.h:110
float bst_float
float type, used for storing statistics
Definition: base.h:119
Definition: generic_parameters.h:15
Registry entry for objective factory functions.
Definition: objective.h:134
A struct returned by objective, which determines task at hand. The struct is not used by any algorith...
Definition: task.h:24