GEGELATI
Loading...
Searching...
No Matches
classificationSelectionMetrics.h
1
2
3#ifndef CLASSIFICATION_SELECTION_METRICS_H
4#define CLASSIFICATION_SELECTION_METRICS_H
5
6#include <numeric>
7
8#include "selector/selectionMetrics.h"
9
10namespace Selector {
19 {
20 protected:
25 std::vector<double> scorePerClass;
26
31 std::vector<size_t> nbEvalPerClass;
32
33 public:
38
48 const std::vector<double>& scorePerClass,
49 const std::vector<size_t>& nbEvalPerClass)
50 : SelectionMetrics(std::accumulate(scorePerClass.cbegin(),
51 scorePerClass.cend(), 0.0) /
52 scorePerClass.size()),
54 {
55 if (scorePerClass.size() != nbEvalPerClass.size()) {
56 throw std::runtime_error("Number of class missmatch.");
57 }
58 };
59
63 virtual const std::vector<double>& getScorePerClass() const;
64
68 virtual const std::vector<size_t>& getNbEvalPerClassPerClass() const;
69
73 void initMetrics(
74 const TPG::TPGVertex* agent,
75 const Learn::LearningEnvironment& learningEnvironment) override;
76
82 const TPG::TPGVertex* agent, size_t nbStepsExecuted,
83 const Learn::LearningEnvironment& learningEnvironment) override;
84
89 virtual void weightedSum(std::shared_ptr<SelectionMetrics> other,
90 size_t nbEvaluation,
91 size_t nbEvaluationOther) override;
92 };
93
94}; // namespace Selector
95
96#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:19
virtual const std::vector< size_t > & getNbEvalPerClassPerClass() const
Definition classificationSelectionMetrics.cpp:62
ClassificationSelectionMetrics(const std::vector< double > &scorePerClass, const std::vector< size_t > &nbEvalPerClass)
Constructor with score and utility initialization.
Definition classificationSelectionMetrics.h:47
void initMetrics(const TPG::TPGVertex *agent, const Learn::LearningEnvironment &learningEnvironment) override
Specialization of the initialisation of the metrics.
Definition classificationSelectionMetrics.cpp:8
std::vector< size_t > nbEvalPerClass
Vector storing a size_t value per class representing the number of evaluation per class.
Definition classificationSelectionMetrics.h:31
ClassificationSelectionMetrics()=default
Default constructor.
virtual const std::vector< double > & getScorePerClass() const
Definition classificationSelectionMetrics.cpp:56
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:16
std::vector< double > scorePerClass
Vector storing a double score per class (i.e. per Action) of a classification LearningEnvironment.
Definition classificationSelectionMetrics.h:25
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:67
Class to extract metrics from either the agent or the environment.
Definition selectionMetrics.h:18
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition mapElitesArchiveLogger.h:45