GEGELATI

Loading...
Searching...
No Matches
evaluationResult.h
1
37#ifndef EVALUATION_RESULT_H
38#define EVALUATION_RESULT_H
39
40#include <cmath>
41#include <memory>
42
43#include "selector/selectionMetrics.h"
44namespace Learn {
54 class EvaluationResult
55 {
56 protected:
60 std::shared_ptr<Selector::SelectionMetrics> selectionMetrics;
61
63 size_t nbEvaluation;
64
65 public:
69 EvaluationResult() = delete;
70
74 virtual ~EvaluationResult() = default;
75
83 EvaluationResult(
84 std::shared_ptr<Selector::SelectionMetrics> selectionMetrics,
85 const size_t& nbEval)
86 : selectionMetrics{selectionMetrics}, nbEvaluation{nbEval} {};
87
92 virtual std::shared_ptr<Selector::SelectionMetrics>
93 getSelectionMetrics() const;
94
99 virtual size_t getNbEvaluation() const;
100
108 virtual EvaluationResult& operator+=(const EvaluationResult& other);
109 };
110
115 bool operator<(const EvaluationResult& a, const EvaluationResult& b);
116} // namespace Learn
117
118namespace std {
120 template <> struct less<std::shared_ptr<Learn::EvaluationResult>>
121 {
123 bool operator()(const std::shared_ptr<Learn::EvaluationResult>& a,
124 const std::shared_ptr<Learn::EvaluationResult>& b) const
125 {
126 return *a < *b;
127 }
128 };
129}; // namespace std
130
131#endif
Learn::EvaluationResult
Base class for storing all result of a policy evaluation within a LearningEnvironment.
Definition evaluationResult.h:55
Learn::EvaluationResult::nbEvaluation
size_t nbEvaluation
Number of evaluation leading to this result.
Definition evaluationResult.h:63
Learn::EvaluationResult::getNbEvaluation
virtual size_t getNbEvaluation() const
Virtual method to get the default number of evaluation of the EvaluationResult.
Definition evaluationResult.cpp:46
Learn::EvaluationResult::~EvaluationResult
virtual ~EvaluationResult()=default
Virtual destructor for polymorphism.
Learn::EvaluationResult::operator+=
virtual EvaluationResult & operator+=(const EvaluationResult &other)
Polymorphic addition assignement operator for EvaluationResult.
Definition evaluationResult.cpp:51
Learn::EvaluationResult::EvaluationResult
EvaluationResult()=delete
Deleted default constructor.
Learn::EvaluationResult::selectionMetrics
std::shared_ptr< Selector::SelectionMetrics > selectionMetrics
Definition evaluationResult.h:60
Learn::EvaluationResult::EvaluationResult
EvaluationResult(std::shared_ptr< Selector::SelectionMetrics > selectionMetrics, const size_t &nbEval)
Construct a result from a simple double value.
Definition evaluationResult.h:83
Learn::EvaluationResult::getSelectionMetrics
virtual std::shared_ptr< Selector::SelectionMetrics > getSelectionMetrics() const
Virtual method to get the default double equivalent of the reward of the EvaluationResult.
Definition evaluationResult.cpp:41
Learn
Definition classificationLearningEnvironment.h:44
Learn::operator<
bool operator<(const EvaluationResult &a, const EvaluationResult &b)
Comparison function to enable sorting of EvaluationResult with STL.
Definition evaluationResult.cpp:75
std::less< std::shared_ptr< Learn::EvaluationResult > >::operator()
bool operator()(const std::shared_ptr< Learn::EvaluationResult > &a, const std::shared_ptr< Learn::EvaluationResult > &b) const
Comparison operator for sorted containers.
Definition evaluationResult.h:123