xgboost

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

interface of evaluation metric used to evaluate model performance. This has nothing to do with training, but merely act as evaluation purpose. More...

`#include <metric.h>`

Inheritance diagram for xgboost::Metric:
Collaboration diagram for xgboost::Metric:

## Public Member Functions
virtual void | Configure (const std::vector< std::pair< std::string, std::string > > &args)
| Configure the Metric with the specified parameters. More...
void | LoadConfig (Json const &in) override
| Load configuration from JSON object By default, metric has no internal configuration; override this function to maintain internal configuration. More...
void | SaveConfig (Json *out) const override
| Save configuration to JSON object By default, metric has no internal configuration; override this function to maintain internal configuration. More...
virtual bst_float | Eval (const HostDeviceVector< bst_float > &preds, const MetaInfo &info, bool distributed)=0
| evaluate a specific metric More...
virtual const char * | Name () const =0
| ~Metric () override=default
| virtual destructor More...
Public Member Functions inherited from xgboost::Configurable
virtual | ~Configurable ()=default

## Static Public Member Functions
static Metric * | Create (const std::string &name, GenericParameter const *tparam)
| create a metric according to name. More...

## Protected Attributes
GenericParameter const * | tparam_

## Detailed Description

interface of evaluation metric used to evaluate model performance. This has nothing to do with training, but merely act as evaluation purpose.

## Constructor & Destructor Documentation

## ◆ ~Metric()

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

virtual destructor

## Member Function Documentation

## ◆ Configure()

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

Configure the Metric with the specified parameters.

Parameters

  args | arguments to the objective function.

## ◆ Create()

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

create a metric according to name.

Parameters

  name | name of the metric. name can be in form metric[@]param and the name will be matched in the registry.
  tparam | A global generic parameter

Returns
  the created metric.

## ◆ Eval()

virtual bst_float xgboost::Metric::Eval | ( | const HostDeviceVector< bst_float > & | preds,
|  | const MetaInfo & | info,
|  | bool | distributed
| ) |  |
| pure virtual

evaluate a specific metric

Parameters

  preds | prediction
  info | information, including label etc.
  distributed | whether a call to Allreduce is needed to gather the average statistics across all the node, this is only supported by some metrics

## ◆ LoadConfig()

void xgboost::Metric::LoadConfig | ( | Json const & | in | ) |
| inline override virtual

Load configuration from JSON object By default, metric has no internal configuration; override this function to maintain internal configuration.

Parameters

  in | JSON object containing the configuration

Implements xgboost::Configurable.

## ◆ Name()

virtual const char* xgboost::Metric::Name | ( |  | ) | const
| pure virtual

Returns
  name of metric

## ◆ SaveConfig()

void xgboost::Metric::SaveConfig | ( | Json * | out | ) | const
| inline override virtual

Save configuration to JSON object By default, metric has no internal configuration; override this function to maintain internal configuration.

Parameters

  out | pointer to output JSON object

Implements xgboost::Configurable.

## Member Data Documentation

## ◆ tparam_

GenericParameter const* xgboost::Metric::tparam_
| protected

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

- /workspace/include/xgboost/metric.h