File statistics_update_candidate_common.hpp

class AbstractStatisticsUpdateCandidate : public IStatisticsUpdateCandidate
#include <statistics_update_candidate_common.hpp>

A base class for all classes that store scores that have been calculated based on statistics and allow to update these statistics accordingly.

Public Functions

inline explicit AbstractStatisticsUpdateCandidate(const IScoreVector &scoreVector)
Parameters:

scoreVector – A reference to an object of type IScoreVector that stores the calculated scores

inline virtual ~AbstractStatisticsUpdateCandidate() override
inline virtual void visit(BitVisitor<CompleteIndexVector> completeBitVisitor, BitVisitor<PartialIndexVector> partialBitVisitor, DenseVisitor<float32, CompleteIndexVector> completeDense32BitVisitor, DenseVisitor<float32, PartialIndexVector> partialDense32BitVisitor, DenseVisitor<float64, CompleteIndexVector> completeDense64BitVisitor, DenseVisitor<float64, PartialIndexVector> partialDense64BitVisitor, DenseBinnedVisitor<float32, CompleteIndexVector> completeDenseBinned32BitVisitor, DenseBinnedVisitor<float32, PartialIndexVector> partialDenseBinned32BitVisitor, DenseBinnedVisitor<float64, CompleteIndexVector> completeDenseBinned64BitVisitor, DenseBinnedVisitor<float64, PartialIndexVector> partialDenseBinned64BitVisitor) const final override

Invokes one of the given visitor functions, depending on which one is able to handle the particular type of vector that stores the calculated scores.

Parameters:

Protected Functions

inline virtual void invokeVisitor(BitVisitor<CompleteIndexVector> visitor, const BitScoreVector<CompleteIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given BitVisitor for handling objects of type BitScoreVector<CompleteIndexVector>.

Parameters:
inline virtual void invokeVisitor(BitVisitor<PartialIndexVector> visitor, const BitScoreVector<PartialIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given BitVisitor for handling objects of type BitScoreVector<PartialIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseVisitor<float32, CompleteIndexVector> visitor, const DenseScoreVector<float32, CompleteIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseVisitor for handling objects of type DenseScoreVector<float32, CompleteIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseVisitor<float32, PartialIndexVector> visitor, const DenseScoreVector<float32, PartialIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseVisitor for handling objects of type DenseScoreVector<float32, PartialIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseVisitor<float64, CompleteIndexVector> visitor, const DenseScoreVector<float64, CompleteIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseVisitor for handling objects of type DenseScoreVector<float64, CompleteIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseVisitor<float64, PartialIndexVector> visitor, const DenseScoreVector<float64, PartialIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseVisitor for handling objects of type DenseScoreVector<float64, PartialIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseBinnedVisitor<float32, CompleteIndexVector> visitor, const DenseBinnedScoreVector<float32, CompleteIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseBinnedVisitor for handling objects of type DenseBinnedScoreVector<float32, CompleteIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseBinnedVisitor<float32, PartialIndexVector> visitor, const DenseBinnedScoreVector<float32, PartialIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseBinnedVisitor for handling objects of type DenseBinnedScoreVector<float32, PartialIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseBinnedVisitor<float64, CompleteIndexVector> visitor, const DenseBinnedScoreVector<float64, CompleteIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseBinnedVisitor for handling objects of type DenseBinnedScoreVector<float64, CompleteIndexVector>.

Parameters:
inline virtual void invokeVisitor(DenseBinnedVisitor<float64, PartialIndexVector> visitor, const DenseBinnedScoreVector<float64, PartialIndexVector> &scoreVector) const

May be overridden by subclasses in order to invoke a given DenseBinnedVisitor for handling objects of type DenseBinnedScoreVector<float64, PartialIndexVector>.

Parameters:

Private Members

const IScoreVector &scoreVector_
template<typename State, typename IndexVector>
class StatisticsUpdate : public IStatisticsUpdate
#include <statistics_update_candidate_common.hpp>

Allows updating the statistics.

Template Parameters:
  • State – The type of the state of the statistics

  • IndexVector – The type of the vector that provides access to the indices of the outputs for which confusion matrices should be updated

Public Functions

inline StatisticsUpdate(State &state, typename IndexVector::const_iterator indicesBegin, typename IndexVector::const_iterator indicesEnd, typename View<typename State::score_type>::const_iterator scoresBegin, typename View<typename State::score_type>::const_iterator scoresEnd)
Parameters:
  • state – A reference to an object of template type State that should be updated

  • indicesBegin – An iterator to the beginning of the output indices for which statistics should be updated

  • indicesEnd – An iterator to the end of the output indices for which statistics should be updated

  • scoresBegin – An iterator to the beginning of the predicted scores, corresponding to the given output indices, that should be used for updating the statistics

  • scoresEnd – An iterator to the end of the predicted scores, corresponding to the given output indices, that should be used for updating the statistics

inline virtual void applyPrediction(uint32 statisticIndex) override

Updates a specific statistic.

This function must be called for each statistic that is covered by a new rule before learning the next rule.

Parameters:

statisticIndex – The index of the statistic that should be updated

inline virtual void revertPrediction(uint32 statisticIndex) override

Reverts a specific statistic that has previously been updated via the function applyPrediction.

Parameters:

statisticIndex – The index of the statistic that should be updated

Private Members

State &state_
IndexVector::const_iterator indicesBegin_
IndexVector::const_iterator indicesEnd_
View<typenameState::score_type>::const_iterator scoresBegin_
View<typenameState::score_type>::const_iterator scoresEnd_
template<typename State>
class StatisticsUpdateFactory : public IStatisticsUpdateFactory<State::score_type>
#include <statistics_update_candidate_common.hpp>

Allows to create instances of the type IStatisticsUpdate that allow updating the statistics.

Template Parameters:

State – The type of the state of the statistics

Public Functions

inline StatisticsUpdateFactory(State &state)
Parameters:

state – A reference to an object of template type State that should be updated

inline virtual std::unique_ptr<IStatisticsUpdate> create(CompleteIndexVector::const_iterator indicesBegin, CompleteIndexVector::const_iterator indicesEnd, typename View<typename State::score_type>::const_iterator scoresBegin, typename View<typename State::score_type>::const_iterator scoresEnd) override

inline std::unique_ptr<IStatisticsUpdate> create(PartialIndexVector::const_iterator indicesBegin, PartialIndexVector::const_iterator indicesEnd, typename View<typename State::score_type>::const_iterator scoresBegin, typename View<typename State::score_type>::const_iterator scoresEnd) override

Private Members

State &state_