DiSMEC++
|
#include <metrics.h>
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_t > | get_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 ConfusionMatrixRecorder * | m_ConfusionMatrix |
|
private |
|
explicit |
Definition at line 264 of file metrics.cpp.
References THROW_EXCEPTION.
void dismec::prediction::MacroMetricReporter::add_accuracy | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_balanced_accuracy | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void MacroMetricReporter::add_confusion_matrix | ( | ) |
Definition at line 237 of file metrics.cpp.
References add_reduction(), dismec::prediction::ConfusionMatrixRecorder::get_k(), m_ConfusionMatrix, and MICRO.
void MacroMetricReporter::add_coverage | ( | double | threshold, |
std::string | name = {} |
||
) |
Definition at line 179 of file metrics.cpp.
References add_reduction(), dismec::prediction::ConfusionMatrixRecorder::get_k(), m_ConfusionMatrix, MACRO, and dismec::confusion_matrix_detail::recall().
Referenced by add_macro_metrics().
void dismec::prediction::MacroMetricReporter::add_diagnostic_odds_ratio | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void MacroMetricReporter::add_f_measure | ( | ReductionType | reduction = MACRO , |
double | beta = 1.0 , |
||
std::string | name = {} |
||
) |
Definition at line 225 of file metrics.cpp.
References dismec::confusion_matrix_detail::f_beta(), and anonymous_namespace{metrics.cpp}::reduction_name().
void dismec::prediction::MacroMetricReporter::add_fowlkes_mallows | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_informedness | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_markedness | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_matthews | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_negative_likelihood_ratio | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_negative_predictive_value | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_positive_likelihood_ratio | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_precision | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
void dismec::prediction::MacroMetricReporter::add_recall | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
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().
|
private |
Definition at line 248 of file metrics.cpp.
References add_reduction(), dismec::prediction::ConfusionMatrixRecorder::get_k(), m_ConfusionMatrix, and anonymous_namespace{metrics.cpp}::reduction_name().
void dismec::prediction::MacroMetricReporter::add_specificity | ( | ReductionType | reduction = MACRO , |
std::string | name = {} |
||
) |
|
overridevirtual |
Implements dismec::prediction::MetricReportInterface.
Definition at line 270 of file metrics.cpp.
References dismec::prediction::ConfusionMatrixRecorder::get_confusion_matrix(), m_ConfusionMatrix, m_MacroReductions, m_MicroReductions, dismec::prediction::MetricCollectionInterface::num_labels(), and dismec::ssize().
|
private |
Definition at line 151 of file metrics.h.
Referenced by add_confusion_matrix(), add_coverage(), add_reduction_helper(), and get_values().
|
private |
Definition at line 149 of file metrics.h.
Referenced by add_reduction(), and get_values().
|
private |
Definition at line 150 of file metrics.h.
Referenced by add_reduction(), and get_values().