File statistics_weighted.hpp

class IWeightedStatistics : public virtual IStatisticsSpace
#include <statistics_weighted.hpp>

Defines an interface for all classes that provide access to statistics about the quality of predictions for training examples, which serve as the basis for learning a new rule or refining an existing one, and also provide functions that allow to only use a sub-sample of the available statistics.

Subclassed by AbstractWeightedStatistics< State, StatisticVector, WeightVector >

Public Functions

inline virtual ~IWeightedStatistics() override
virtual std::unique_ptr<IWeightedStatistics> copy() const = 0

Creates and returns a copy of this object.

Returns:

An unique pointer to an object of type IWeightedStatistics that has been created

virtual void resetCoveredStatistics() = 0

Resets the statistics which should be considered in the following for refining an existing rule. The indices of the respective statistics must be provided via subsequent calls to the function addCoveredStatistic.

This function must be invoked each time an existing rule has been refined, i.e., when a new condition has been added to its body, because this results in a subset of the statistics being covered by the refined rule.

This function is supposed to reset any non-global internal state that only holds for a certain subset of the available statistics and therefore becomes invalid when a different subset of the statistics should be used.

virtual void addCoveredStatistic(uint32 statisticIndex) = 0

Adds a specific statistic to the subset that is covered by an existing rule and therefore should be considered in the following for refining an existing rule.

This function must be called repeatedly for each statistic that is covered by the existing rule, immediately after the invocation of the function resetCoveredStatistics.

This function is supposed to update any internal state that relates to the considered statistics, i.e., to compute and store local information that is required by the other functions that will be called later. Any information computed by this function is expected to be reset when invoking the function resetCoveredStatistics for the next time.

Parameters:

statisticIndex – The index of the statistic that should be added

virtual void removeCoveredStatistic(uint32 statisticIndex) = 0

Removes a specific statistic from the subset that is covered by an existing rule and therefore should not be considered in the following for refining an existing rule.

This function must be called repeatedly for each statistic that is not covered anymore by the existing rule.

This function is supposed to update any internal state that relates to the considered statistics, i.e., to compute and store local information that is required by the other functions that will be called later. Any information computed by this function is expected to be reset when invoking the function resetCoveredStatistics for the next time.

Parameters:

statisticIndex – The index of the statistic that should be removed

virtual std::unique_ptr<IResettableStatisticsSubset> createSubset(const BinaryDokVector &excludedStatisticIndices, const CompleteIndexVector &outputIndices) const = 0

Creates and returns a new object of type IResettableStatisticsSubset that includes only those outputs, whose indices are provided by a specific CompleteIndexVector.

Parameters:
  • excludedStatisticIndices – A reference to an object of type BinaryDokVector that provides access to the indices of the statistics that should be excluded from the subset

  • outputIndices – A reference to an object of type CompleteIndexVector that provides access to the indices of the outputs that should be included in the subset

Returns:

An unique pointer to an object of type IResettableStatisticsSubset that has been created

virtual std::unique_ptr<IResettableStatisticsSubset> createSubset(const BinaryDokVector &excludedStatisticIndices, const PartialIndexVector &outputIndices) const = 0

Creates and returns a new object of type IResettableStatisticsSubset that includes only those outputs, whose indices are provided by a specific PartialIndexVector.

Parameters:
  • excludedStatisticIndices – A reference to an object of type BinaryDokVector that provides access to the indices of the statistics that should be excluded from the subset

  • outputIndices – A reference to an object of type PartialIndexVector that provides access to the indices of the outputs that should be included in the subset

Returns:

An unique pointer to an object of type IResettableStatisticsSubset that has been created

template<typename State, typename StatisticVector, typename WeightVector>
class AbstractWeightedStatistics : public AbstractStatisticsSpace<State>, public virtual IWeightedStatistics
#include <statistics_weighted.hpp>

An abstract base class for all classes that provide access to statistics.

Template Parameters:
  • State – The type of the state of the training process

  • StatisticVector – The type of the vectors that are used to store statistics

  • WeightVector – The type of the vector that provides access to the weights of individual statistics

Public Functions

inline AbstractWeightedStatistics(State &state, const WeightVector &weights)
Parameters:
  • state – A reference to an object of template type State that represents the state of the training process

  • weights – A reference to an object of template type WeightVector that provides access to the weights of individual statistics

inline AbstractWeightedStatistics(const AbstractWeightedStatistics<State, StatisticVector, WeightVector> &other)
Parameters:

other – A reference to an object of type AbstractWeightedStatistics to be copied

inline virtual ~AbstractWeightedStatistics() override
inline virtual void resetCoveredStatistics() override

inline virtual void addCoveredStatistic(uint32 statisticIndex) override

inline virtual void removeCoveredStatistic(uint32 statisticIndex) override

Protected Attributes

const WeightVector &weights_

A reference to an object of template type WeightVector that provides access to the weights of individual statistics.

StatisticVector totalSumVector_

A reference to an object of template type WeightVector that provides access to the weights of individual statistics.