DiSMEC++
|
Base class for all metrics that can be calculated during the evaluation phase. More...
#include <metrics.h>
Public Types | |
using | gt_info_vec = std::vector< sTrueLabelInfo > |
using | pd_info_vec = std::vector< sPredLabelInfo > |
Public Member Functions | |
MetricCollectionInterface (long num_labels) | |
virtual | ~MetricCollectionInterface ()=default |
long | num_labels () const |
Gets the number of labels. More... | |
virtual void | update (const pd_info_vec &prediction, const gt_info_vec &labels)=0 |
virtual void | reduce (const MetricCollectionInterface &other)=0 |
virtual std::unique_ptr< MetricCollectionInterface > | clone () const =0 |
Private Attributes | |
long | m_NumLabels |
Base class for all metrics that can be calculated during the evaluation phase.
This is the interface that is used by the evaluation task to handle the individual metrics. This interface handles the data collection part. It provides the following operations: 1) Accumulating a new prediction into the metric 2) reducing multiple instances of the metric interface. The second operation is necessary to allow for efficient multithreaded calculation of the metric.
using dismec::prediction::MetricCollectionInterface::gt_info_vec = std::vector<sTrueLabelInfo> |
using dismec::prediction::MetricCollectionInterface::pd_info_vec = std::vector<sPredLabelInfo> |
|
explicit |
Constructor, gets the total number of labels, since these cannot be inferred from the sparse prediction and ground-truth arrays in the update step.
Definition at line 15 of file metrics.cpp.
References num_labels(), and THROW_EXCEPTION.
|
virtualdefault |
|
pure virtual |
|
inline |
Gets the number of labels.
Definition at line 38 of file metrics.h.
References m_NumLabels.
Referenced by dismec::prediction::ConfusionMatrixRecorder::clone(), dismec::prediction::InstanceRankedPositives::clone(), dismec::prediction::AbandonmentAtK::clone(), dismec::prediction::ConfusionMatrixRecorder::ConfusionMatrixRecorder(), dismec::prediction::MacroMetricReporter::get_values(), MetricCollectionInterface(), and dismec::prediction::ConfusionMatrixRecorder::reduce().
|
pure virtual |
Implemented in dismec::prediction::InstanceAveragedMetric, and dismec::prediction::ConfusionMatrixRecorder.
|
pure virtual |
|
private |
Definition at line 44 of file metrics.h.
Referenced by num_labels().