mlpack 3.4.2
f1.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_CORE_CV_METRICS_F1_HPP
13#define MLPACK_CORE_CV_METRICS_F1_HPP
14
15#include <type_traits>
16
17#include <mlpack/core.hpp>
19
20namespace mlpack {
21namespace cv {
22
44template<AverageStrategy AS, size_t PositiveClass = 1>
45class F1
46{
47 public:
55 template<typename MLAlgorithm, typename DataType>
56 static double Evaluate(MLAlgorithm& model,
57 const DataType& data,
58 const arma::Row<size_t>& labels);
59
64 static const bool NeedsMinimization = false;
65
66 private:
70 template<AverageStrategy _AS,
71 typename MLAlgorithm,
72 typename DataType,
74 static double Evaluate(MLAlgorithm& model,
75 const DataType& data,
76 const arma::Row<size_t>& labels);
77
81 template<AverageStrategy _AS,
82 typename MLAlgorithm,
83 typename DataType,
85 typename = void>
86 static double Evaluate(MLAlgorithm& model,
87 const DataType& data,
88 const arma::Row<size_t>& labels);
89
93 template<AverageStrategy _AS,
94 typename MLAlgorithm,
95 typename DataType,
97 typename = void,
98 typename = void>
99 static double Evaluate(MLAlgorithm& model,
100 const DataType& data,
101 const arma::Row<size_t>& labels);
102};
103
104} // namespace cv
105} // namespace mlpack
106
107// Include implementation.
108#include "f1_impl.hpp"
109
110#endif
F1 is a metric of performance for classification algorithms that for binary classification is equal t...
Definition: f1.hpp:46
static const bool NeedsMinimization
Information for hyper-parameter tuning code.
Definition: f1.hpp:64
static double Evaluate(MLAlgorithm &model, const DataType &data, const arma::Row< size_t > &labels)
Run classification and calculate F1.
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...
AverageStrategy
This enum declares possible strategies for averaging that can be used in some metrics like precision,...
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
typename enable_if< B, T >::type enable_if_t
Definition: prereqs.hpp:70