GEGELATI

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Selector::ClassificationSelector Class Reference

Specialization of the selection class for classification purposes. More...

`#include <classificationSelector.h>`

Inheritance diagram for Selector::ClassificationSelector:

## Public Member Functions
| ClassificationSelector (std::shared_ptr< TPG::TPGGraph > graph, const Learn::LearningParameters &params, uint64_t nbActions)
| Constructor for ClassificationSelector.
virtual std::shared_ptr< SelectionMetrics > | createSelectionMetrics () override
virtual void | doSelection (std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results, Mutator::RNG &rng) override
| Specialization of the doSelection method for classification purposes.
Public Member Functions inherited from Selector::Selector
| Selector (std::shared_ptr< TPG::TPGGraph > graph, const Learn::LearningParameters &params)
| Constructor for Selector.
virtual void | launchSelection (std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results, Mutator::RNG &rng)
| This method execute the doSelection method.
virtual void | keepBestPolicy ()
| This method keeps only the bes tRoot policy in the TPGGraph.
virtual void | updateEvaluationRecords (const std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
| Update the bestRoot and resultsPerRoot attributes.
virtual void | updateResultsPerRoot (const std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
| Update the resultsPerRoot.
virtual void | updateBestRoot (const std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
| Update the bestRoot attribute.
virtual const std::pair< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > & | getBestRoot () const
| Get the best root TPG::Vertex encountered since the last init.
virtual std::shared_ptr< TPG::TPGGraph > | getGraph ()
| Getter for the TPGGraph built by the LearningAgent.
virtual void | forgetPreviousResults ()
| This method resets the previous registered scores per root.
virtual const std::map< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > & | getResultsPerRoot () const
| Return the resultsPerRoot map.
virtual const SelectionContext & | updateContext ()
| Update the SelectionContext structure and return it.
virtual void | updateAfterPopulate ()
| Method to call at the end of TPGMutator::populateTPG.

## Protected Attributes
uint64_t | nbActions
| Number of actions in the LearningEnvironment.
Protected Attributes inherited from Selector::Selector
std::shared_ptr< TPG::TPGGraph > | graph
| TPGGraph on which the TPGVertex can be selected or deleted.
const Learn::LearningParameters & | params
| Parameters for the selection.
std::pair< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > | bestRoot {nullptr, nullptr}
std::map< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > | resultsPerRoot
| Map associating root TPG::TPGVertex to their EvaluationResult.
SelectionContext | context
| context used by the TPGMutator to populate the TPGGraph.

## Detailed Description

Specialization of the selection class for classification purposes.

## Constructor & Destructor Documentation

## ◆ ClassificationSelector()

Selector::ClassificationSelector::ClassificationSelector | ( | std::shared_ptr< TPG::TPGGraph > | graph,
|  | const Learn::LearningParameters & | params,
|  | uint64_t | nbActions )
| inline

Constructor for ClassificationSelector.

Parameters

  [in] | graph | shared pointer of the graph on which the selection is done.
  [in] | params | parameters used by the Selector.
  [in] | nbActions | number of actions in the LearningEnvironment.

## Member Function Documentation

## ◆ createSelectionMetrics()

std::shared_ptr< Selector::SelectionMetrics > Selector::ClassificationSelector::createSelectionMetrics | ( |  | ) |
| overridevirtual

Specialization of createSelectionMetrics

Creates and return an instance of ClassificationSelectionMetrics

Reimplemented from Selector::Selector.

## ◆ doSelection()

void Selector::ClassificationSelector::doSelection | ( | std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > & | results,
|  | Mutator::RNG & | rng )
| overridevirtual

Specialization of the doSelection method for classification purposes.

During the decimation process, roughly half of the roots are kept based on their score for individual class of the ClassificationLearningEnvironment. To do so, for each class of the ClassificationLearningEnvironment, the roots provided the best score are preserved during the decimation process even if their global score over all classes is not among the best.

The remaining half of preserved roots is selected using the general score obtained over all classes.

This per-class preservation is activated only if there is a sufficient number of root vertices in the TPGGraph after decimation to guarantee that all classes are preserved equally. In other word, the same number of root is marked for preservation for each class, which can only be achieved if the number of roots to preserve during the decimation process is superior or equal to twice the number of actions of the ClassificationLearningEnvironment. If an insufficient number of root is preserved during the decimation process, all roots are preserved based on their general score.

The results map is updated by the method to keep only the results of non-decimated roots.

Reimplemented from Selector::Selector.

The documentation for this class was generated from the following files:

- D:/a/gegelati/gegelati/gegelatilib/include/selector/classificationSelector.h
- D:/a/gegelati/gegelati/gegelatilib/src/selector/classificationSelector.cpp