DiSMEC++
dismec::prediction::MacroMetricReporter Class Reference

#include <metrics.h>

Inheritance diagram for dismec::prediction::MacroMetricReporter:
dismec::prediction::MetricReportInterface

Public Types

enum  ReductionType { MICRO , MACRO }
 
- Public Types inherited from dismec::prediction::MetricReportInterface
using metric_t = std::pair< std::string, double >
 

Public Member Functions

 MacroMetricReporter (const ConfusionMatrixRecorder *confusion)
 
std::vector< metric_tget_values () const override
 
void add_coverage (double threshold, std::string name={})
 
void add_precision (ReductionType reduction=MACRO, std::string name={})
 
void add_accuracy (ReductionType reduction=MACRO, std::string name={})
 
void add_specificity (ReductionType reduction=MACRO, std::string name={})
 
void add_balanced_accuracy (ReductionType reduction=MACRO, std::string name={})
 
void add_informedness (ReductionType reduction=MACRO, std::string name={})
 
void add_markedness (ReductionType reduction=MACRO, std::string name={})
 
void add_recall (ReductionType reduction=MACRO, std::string name={})
 
void add_fowlkes_mallows (ReductionType reduction=MACRO, std::string name={})
 
void add_negative_predictive_value (ReductionType reduction=MACRO, std::string name={})
 
void add_matthews (ReductionType reduction=MACRO, std::string name={})
 
void add_positive_likelihood_ratio (ReductionType reduction=MACRO, std::string name={})
 
void add_negative_likelihood_ratio (ReductionType reduction=MACRO, std::string name={})
 
void add_diagnostic_odds_ratio (ReductionType reduction=MACRO, std::string name={})
 
void add_f_measure (ReductionType reduction=MACRO, double beta=1.0, std::string name={})
 
void add_confusion_matrix ()
 
void add_reduction (std::string name, ReductionType type, std::function< double(const ConfusionMatrix &)>)
 
- Public Member Functions inherited from dismec::prediction::MetricReportInterface
virtual ~MetricReportInterface ()=default
 

Private Types

using reduction_fn = std::function< double(const ConfusionMatrix &)>
 

Private Member Functions

void add_reduction_helper (std::string name, const char *pattern, ReductionType type, std::function< double(const ConfusionMatrix &)> fn)
 

Private Attributes

std::vector< std::pair< std::string, reduction_fn > > m_MacroReductions
 
std::vector< std::pair< std::string, reduction_fn > > m_MicroReductions
 
const ConfusionMatrixRecorderm_ConfusionMatrix
 

Detailed Description

Definition at line 118 of file metrics.h.

Member Typedef Documentation

◆ reduction_fn

using dismec::prediction::MacroMetricReporter::reduction_fn = std::function<double(const ConfusionMatrix&)>
private

Definition at line 148 of file metrics.h.

Member Enumeration Documentation

◆ ReductionType

Enumerator
MICRO 
MACRO 

Definition at line 123 of file metrics.h.

Constructor & Destructor Documentation

◆ MacroMetricReporter()

MacroMetricReporter::MacroMetricReporter ( const ConfusionMatrixRecorder confusion)
explicit

Definition at line 264 of file metrics.cpp.

References THROW_EXCEPTION.

Member Function Documentation

◆ add_accuracy()

void dismec::prediction::MacroMetricReporter::add_accuracy ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_balanced_accuracy()

void dismec::prediction::MacroMetricReporter::add_balanced_accuracy ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_confusion_matrix()

void MacroMetricReporter::add_confusion_matrix ( )

◆ add_coverage()

void MacroMetricReporter::add_coverage ( double  threshold,
std::string  name = {} 
)

◆ add_diagnostic_odds_ratio()

void dismec::prediction::MacroMetricReporter::add_diagnostic_odds_ratio ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_f_measure()

void MacroMetricReporter::add_f_measure ( ReductionType  reduction = MACRO,
double  beta = 1.0,
std::string  name = {} 
)

◆ add_fowlkes_mallows()

void dismec::prediction::MacroMetricReporter::add_fowlkes_mallows ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_informedness()

void dismec::prediction::MacroMetricReporter::add_informedness ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_markedness()

void dismec::prediction::MacroMetricReporter::add_markedness ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_matthews()

void dismec::prediction::MacroMetricReporter::add_matthews ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_negative_likelihood_ratio()

void dismec::prediction::MacroMetricReporter::add_negative_likelihood_ratio ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_negative_predictive_value()

void dismec::prediction::MacroMetricReporter::add_negative_predictive_value ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_positive_likelihood_ratio()

void dismec::prediction::MacroMetricReporter::add_positive_likelihood_ratio ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_precision()

void dismec::prediction::MacroMetricReporter::add_precision ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_recall()

void dismec::prediction::MacroMetricReporter::add_recall ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ add_reduction()

void MacroMetricReporter::add_reduction ( std::string  name,
ReductionType  type,
std::function< double(const ConfusionMatrix &)>  fn 
)

Definition at line 256 of file metrics.cpp.

References m_MacroReductions, m_MicroReductions, and MACRO.

Referenced by add_confusion_matrix(), add_coverage(), and add_reduction_helper().

◆ add_reduction_helper()

void MacroMetricReporter::add_reduction_helper ( std::string  name,
const char *  pattern,
ReductionType  type,
std::function< double(const ConfusionMatrix &)>  fn 
)
private

◆ add_specificity()

void dismec::prediction::MacroMetricReporter::add_specificity ( ReductionType  reduction = MACRO,
std::string  name = {} 
)

◆ get_values()

Member Data Documentation

◆ m_ConfusionMatrix

const ConfusionMatrixRecorder* dismec::prediction::MacroMetricReporter::m_ConfusionMatrix
private

Definition at line 151 of file metrics.h.

Referenced by add_confusion_matrix(), add_coverage(), add_reduction_helper(), and get_values().

◆ m_MacroReductions

std::vector<std::pair<std::string, reduction_fn> > dismec::prediction::MacroMetricReporter::m_MacroReductions
private

Definition at line 149 of file metrics.h.

Referenced by add_reduction(), and get_values().

◆ m_MicroReductions

std::vector<std::pair<std::string, reduction_fn> > dismec::prediction::MacroMetricReporter::m_MicroReductions
private

Definition at line 150 of file metrics.h.

Referenced by add_reduction(), and get_values().


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