DiSMEC++
dismec::prediction::MetricCollectionInterface Class Referenceabstract

Base class for all metrics that can be calculated during the evaluation phase. More...

#include <metrics.h>

Inheritance diagram for dismec::prediction::MetricCollectionInterface:
dismec::prediction::ConfusionMatrixRecorder dismec::prediction::InstanceAveragedMetric dismec::prediction::AbandonmentAtK dismec::prediction::InstanceRankedPositives

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< MetricCollectionInterfaceclone () const =0
 

Private Attributes

long m_NumLabels
 

Detailed Description

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.

Definition at line 28 of file metrics.h.

Member Typedef Documentation

◆ gt_info_vec

◆ pd_info_vec

Constructor & Destructor Documentation

◆ MetricCollectionInterface()

MetricCollectionInterface::MetricCollectionInterface ( long  num_labels)
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.

◆ ~MetricCollectionInterface()

virtual dismec::prediction::MetricCollectionInterface::~MetricCollectionInterface ( )
virtualdefault

Member Function Documentation

◆ clone()

virtual std::unique_ptr<MetricCollectionInterface> dismec::prediction::MetricCollectionInterface::clone ( ) const
pure virtual

◆ num_labels()

◆ reduce()

virtual void dismec::prediction::MetricCollectionInterface::reduce ( const MetricCollectionInterface other)
pure virtual

◆ update()

virtual void dismec::prediction::MetricCollectionInterface::update ( const pd_info_vec prediction,
const gt_info_vec labels 
)
pure virtual

Member Data Documentation

◆ m_NumLabels

long dismec::prediction::MetricCollectionInterface::m_NumLabels
private

Definition at line 44 of file metrics.h.

Referenced by num_labels().


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