GEGELATI
Loading...
Searching...
No Matches
classificationSelectionMetrics.h
1
36#ifndef CLASSIFICATION_SELECTION_METRICS_H
37#define CLASSIFICATION_SELECTION_METRICS_H
38
39#include <numeric>
40
41#include "selector/selectionMetrics.h"
42
43namespace Selector {
52 {
53 protected:
58 std::vector<double> scorePerClass;
59
64 std::vector<size_t> nbEvalPerClass;
65
66 public:
71
81 const std::vector<double>& scorePerClass,
82 const std::vector<size_t>& nbEvalPerClass)
83 : SelectionMetrics(std::accumulate(scorePerClass.cbegin(),
84 scorePerClass.cend(), 0.0) /
85 scorePerClass.size()),
87 {
88 if (scorePerClass.size() != nbEvalPerClass.size()) {
89 throw std::runtime_error("Number of class missmatch.");
90 }
91 };
92
96 virtual const std::vector<double>& getScorePerClass() const;
97
101 virtual const std::vector<size_t>& getNbEvalPerClassPerClass() const;
102
106 void initMetrics(
107 const TPG::TPGVertex* agent,
108 const Learn::LearningEnvironment& learningEnvironment) override;
109
115 const TPG::TPGVertex* agent, size_t nbStepsExecuted,
116 const Learn::LearningEnvironment& learningEnvironment) override;
117
122 virtual void weightedSum(std::shared_ptr<SelectionMetrics> other,
123 size_t nbEvaluation,
124 size_t nbEvaluationOther) override;
125 };
126
127}; // namespace Selector
128
129#endif // CLASSIFICATION_SELECTION_METRICS_H
Interface for creating a Learning Environment.
Definition learningEnvironment.h:81
Class to extract metrics from either the agent or the environment.
Definition classificationSelectionMetrics.h:52
virtual const std::vector< size_t > & getNbEvalPerClassPerClass() const
Definition classificationSelectionMetrics.cpp:95
ClassificationSelectionMetrics(const std::vector< double > &scorePerClass, const std::vector< size_t > &nbEvalPerClass)
Constructor with score and utility initialization.
Definition classificationSelectionMetrics.h:80
void initMetrics(const TPG::TPGVertex *agent, const Learn::LearningEnvironment &learningEnvironment) override
Specialization of the initialisation of the metrics.
Definition classificationSelectionMetrics.cpp:41
std::vector< size_t > nbEvalPerClass
Vector storing a size_t value per class representing the number of evaluation per class.
Definition classificationSelectionMetrics.h:64
ClassificationSelectionMetrics()=default
Default constructor.
virtual const std::vector< double > & getScorePerClass() const
Definition classificationSelectionMetrics.cpp:89
void extractMetricsEpisode(const TPG::TPGVertex *agent, size_t nbStepsExecuted, const Learn::LearningEnvironment &learningEnvironment) override
Specialization of the extraction of the metrics at the end of an episode.
Definition classificationSelectionMetrics.cpp:49
std::vector< double > scorePerClass
Vector storing a double score per class (i.e. per Action) of a classification LearningEnvironment.
Definition classificationSelectionMetrics.h:58
virtual void weightedSum(std::shared_ptr< SelectionMetrics > other, size_t nbEvaluation, size_t nbEvaluationOther) override
Specialization of weightedSum method to add the score per class and nbEvalPerClass.
Definition classificationSelectionMetrics.cpp:100
Class to extract metrics from either the agent or the environment.
Definition selectionMetrics.h:52
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition mapElitesArchiveLogger.h:45