7 #ifndef XGBOOST_METRIC_H_
8 #define XGBOOST_METRIC_H_
10 #include <dmlc/registry.h>
39 const std::vector<std::pair<std::string, std::string> >&) {}
65 std::shared_ptr<DMatrix> p_fmat) = 0;
68 virtual const char*
Name()
const = 0;
88 :
public dmlc::FunctionRegEntryBase<MetricReg,
89 std::function<Metric* (const char*)> > {
105 #define XGBOOST_REGISTER_METRIC(UniqueId, Name) \
106 ::xgboost::MetricReg& __make_ ## MetricReg ## _ ## UniqueId ## __ = \
107 ::dmlc::Registry< ::xgboost::MetricReg>::Get()->__REGISTER__(Name)
Defines configuration macros and basic types for xgboost.
Data structure representing JSON format.
Definition: json.h:357
interface of evaluation metric used to evaluate model performance. This has nothing to do with traini...
Definition: metric.h:29
void SaveConfig(Json *p_out) const override
Save configuration to JSON object By default, metric has no internal configuration; override this fun...
Definition: metric.h:53
virtual void Configure(const std::vector< std::pair< std::string, std::string > > &)
Configure the Metric with the specified parameters.
Definition: metric.h:38
void LoadConfig(Json const &) override
Load configuration from JSON object By default, metric has no internal configuration; override this f...
Definition: metric.h:46
virtual const char * Name() const =0
static Metric * Create(const std::string &name, Context const *ctx)
create a metric according to name.
Context const * ctx_
Definition: metric.h:31
~Metric() override=default
virtual destructor
virtual double Evaluate(HostDeviceVector< bst_float > const &preds, std::shared_ptr< DMatrix > p_fmat)=0
Evaluate a metric with DMatrix as input.
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:90
JsonString String
Definition: json.h:595
Runtime context for XGBoost. Contains information like threads and device.
Definition: context.h:84
Registry entry for Metric factory functions. The additional parameter const char* param gives the val...
Definition: metric.h:89