GEGELATI

Loading...
Searching...
No Matches
classificationEvaluationResult.h
1
36#ifndef CLASSIFICATION_EVALUATION_RESULT_H
37#define CLASSIFICATION_EVALUATION_RESULT_H
38
39#include <numeric>
40#include <vector>
41
42#include "learn/evaluationResult.h"
43
44 namespace Learn {
52 class ClassificationEvaluationResult : public EvaluationResult
53 {
54 protected:
59 std::vector<double> scorePerClass;
60
65 std::vector<size_t> nbEvaluationPerClass;
66
67 public:
82 ClassificationEvaluationResult(
83 const std::vector<double>& scores,
84 const std::vector<size_t>& nbEvalPerClass)
85 : EvaluationResult(
86 std::accumulate(scores.cbegin(), scores.cend(), 0.0) /
87 scores.size(),
88 std::accumulate(nbEvalPerClass.cbegin(),
89 nbEvalPerClass.cend(), size_t(0))),
90 scorePerClass(scores), nbEvaluationPerClass(nbEvalPerClass)
91 {
92 if (scores.size() != nbEvalPerClass.size()) {
93 throw std::runtime_error(
94 "Mismatch between scores and nbEvalPerClass vector sizes.");
95 }
96 };
97
101 const std::vector<double>& getScorePerClass() const;
102
106 const std::vector<size_t>& getNbEvaluationPerClass() const;
107
114 virtual EvaluationResult& operator+=(
115 const EvaluationResult& other) override;
116 };
117}; // namespace Learn
118
119#endif
Learn::ClassificationEvaluationResult
Specialization of the EvaluationResult class for classification LearningEnvironment.
Definition classificationEvaluationResult.h:53
Learn::ClassificationEvaluationResult::getNbEvaluationPerClass
const std::vector< size_t > & getNbEvaluationPerClass() const
Get a const ref to the nbEvaluationPerClass attribute.
Definition classificationEvaluationResult.cpp:46
Learn::ClassificationEvaluationResult::ClassificationEvaluationResult
ClassificationEvaluationResult(const std::vector< double > &scores, const std::vector< size_t > &nbEvalPerClass)
Main constructor of the ClassificationEvaluationResult class.
Definition classificationEvaluationResult.h:82
Learn::ClassificationEvaluationResult::scorePerClass
std::vector< double > scorePerClass
Vector storing a double score per class (i.e. per Action) of a classification LearningEnvironment.
Definition classificationEvaluationResult.h:59
Learn::ClassificationEvaluationResult::operator+=
virtual EvaluationResult & operator+=(const EvaluationResult &other) override
Override from EvaluationResult.
Definition classificationEvaluationResult.cpp:51
Learn::ClassificationEvaluationResult::getScorePerClass
const std::vector< double > & getScorePerClass() const
Get a const ref to the scorePerClass attribute.
Definition classificationEvaluationResult.cpp:40
Learn::ClassificationEvaluationResult::nbEvaluationPerClass
std::vector< size_t > nbEvaluationPerClass
Vector storing the number of evaluation for each class of the classification LearningEnvironment.
Definition classificationEvaluationResult.h:65
Learn::EvaluationResult
Base class for storing all result of a policy evaluation within a LearningEnvironment.
Definition evaluationResult.h:54
Learn
Definition adversarialEvaluationResult.h:45