DiSMEC++
metrics.cpp File Reference
#include "metrics.h"
#include "spdlog/fmt/fmt.h"
#include "utils/throw_error.h"
#include "utils/conversion.h"
#include <boost/predef.h>
#include <numeric>
#include <iostream>
#include "doctest.h"

Go to the source code of this file.

Namespaces

 anonymous_namespace{metrics.cpp}
 

Macros

#define IMPLEMENT_ADD_METRIC(METRIC, SHORTHAND)
 

Typedefs

using anonymous_namespace{metrics.cpp}::pred_mat_t = Eigen::Matrix< long, 1, Eigen::Dynamic >
 

Functions

std::vector< double > anonymous_namespace{metrics.cpp}::uniform_weights (long k)
 
constexpr const char * anonymous_namespace{metrics.cpp}::reduction_name (MacroMetricReporter::ReductionType type)
 
auto anonymous_namespace{metrics.cpp}::make_labels (std::initializer_list< long > init_list)
 
template<class T >
void anonymous_namespace{metrics.cpp}::update_metric (T &target, std::initializer_list< long > prediction, std::initializer_list< long > labels)
 
 TEST_CASE ("precision_at_k")
 
 TEST_CASE ("abandonment_at_k")
 

Macro Definition Documentation

◆ IMPLEMENT_ADD_METRIC

#define IMPLEMENT_ADD_METRIC (   METRIC,
  SHORTHAND 
)
Value:
void MacroMetricReporter::add_##METRIC(ReductionType reduction, std::string name) { \
auto fn = [](const ConfusionMatrix& cm){ return METRIC(cm); }; \
add_reduction_helper(std::move(name), "{}" SHORTHAND "@{}", reduction, fn); \
}

Definition at line 205 of file metrics.cpp.

Function Documentation

◆ TEST_CASE() [1/2]

TEST_CASE ( "abandonment_at_k"  )
Test:
Validate abandonment at k by using a few examples. Note that this test validates that the calculations are correct, but not that the code will also work when called from multiple threads.

Definition at line 356 of file metrics.cpp.

References anonymous_namespace{metrics.cpp}::update_metric().

◆ TEST_CASE() [2/2]

TEST_CASE ( "precision_at_k"  )
Test:
Validate precision at k by using a few examples. Note that this test validates that the calculations are correct, but not that the code will also work when called from multiple threads.

Definition at line 338 of file metrics.cpp.

References anonymous_namespace{metrics.cpp}::update_metric().