File statistics_subset.hpp¶
Functions
-
template<typename StatisticVector, typename StatisticView>
static inline void addStatisticsToVector(StatisticVector &statisticVector, const EqualWeightVector &weights, const StatisticView &statisticView, uint32 row)¶ Adds the statistics at a specific row of a view to a given vector. The statistics are weighted according to given weights.
- Template Parameters:
StatisticVector – The type of the vector to be modified
StatisticView – The type of the view that provides access to the statistics
- Parameters:
statisticVector – A reference to an object of template type
StatisticVectorto be modifiedweights – A reference to an object of type
EqualWeightVectorthat provides access to the weightsstatisticView – A reference to an object of template type
StatisticViewthat provides access to the statisticsrow – The index of the row in the view to be added to the vector
-
template<typename StatisticVector, typename WeightVector, typename StatisticView>
static inline void addStatisticsToVector(StatisticVector &statisticVector, const WeightVector &weights, const StatisticView &statisticView, uint32 row)¶ Adds the statistics at a specific row of a view to a given vector. The statistics are weighted according to given weights.
- Template Parameters:
StatisticVector – The type of the vector to be modified
WeightVector – The type of the vector that provides access to the weights of statistics
StatisticView – The type of the view that provides access to the statistics
- Parameters:
statisticVector – A reference to an object of template type
StatisticVectorto be modifiedweights – A reference to an object of template type
WeightVectorthat provides access to the weightsstatisticView – A reference to an object of template type
StatisticViewthat provides access to the statisticsrow – The index of the row in the view to be added to the vector
-
template<typename StatisticVector, typename StatisticView>
static inline void removeStatisticsFromVector(StatisticVector &statisticVector, const EqualWeightVector &weights, const StatisticView &statisticView, uint32 row)¶ Removes the statistics at a specific row of a view from a given vector. The statistics are weighted according to given weights.
- Template Parameters:
StatisticVector – The type of the vector to be modified
StatisticView – The type of the view that provides access to the statistics
- Parameters:
statisticVector – A reference to an object of template type
StatisticVectorto be modifiedweights – A reference to an object of type
EqualWeightVectorthat provides access to the weightsstatisticView – A reference to an object of template type
StatisticViewthat provides access to the statisticsrow – The index of the row in the view to be removed from the vector
-
template<typename StatisticVector, typename WeightVector, typename StatisticView>
static inline void removeStatisticsFromVector(StatisticVector &statisticVector, const WeightVector &weights, const StatisticView &statisticView, uint32 row)¶ Removes the statistics at a specific row of a view from a given vector. The statistics are weighted according to given weights.
- Template Parameters:
StatisticVector – The type of the vector to be modified
WeightVector – The type of the vector that provides access to the weights of statistics
StatisticView – The type of the view that provides access to the statistics
- Parameters:
statisticVector – A reference to an object of template type
StatisticVectorto be modifiedweights – A reference to an object of template type
WeightVectorthat provides access to the weightsstatisticView – A reference to an object of template type
StatisticViewthat provides access to the statisticsrow – The index of the row in the view to be removed from the vector
-
template<typename StatisticVector, typename WeightVector, typename StatisticView, typename IndexIterator>
static inline void removeStatisticsFromVector(StatisticVector &statisticVector, const WeightVector &weights, const StatisticView &statisticView, IndexIterator indicesBegin, IndexIterator indicesEnd)¶ Removes the statistics at specific rows of a view from a given vector. The statistics are weighted according to given weights.
- Template Parameters:
StatisticVector – The type of the vector to be modified
WeightVector – The type of the vector that provides access to the weights of statistics
StatisticView – The type of the view that provides access to the statistics
IndexIterator – The type of the iterator that allows to access the indices of the rows
- Parameters:
statisticVector – A reference to an object of template type
StatisticVectorto be modifiedweights – A reference to an object of template type
WeightVectorthat provides access to the weightsstatisticView – A reference to an object of template type
StatisticViewthat provides access to the statisticsindicesBegin – An iterator to the binning of the indices
indicesEnd – An iterator to the end of the indices
-
template<typename StatisticVector, typename WeightVector, typename StatisticView>
static inline void setVectorToWeightedSumOfStatistics(StatisticVector &statisticVector, const WeightVector &weights, const StatisticView &statisticView)¶ Initializes a given vector by setting its element for each output to the weighted sum of the statistics in a specific view.
- Template Parameters:
StatisticVector – The type of the vector to be initialized
WeightVector – The type of the vector that provides access to the weights of statistics
StatisticView – The type of the view that provides access to the statistics
- Parameters:
statisticVector – A reference to an object of template type
StatisticVectorto be initializedweights – A reference to an object of template type
WeightVectorthat provides access to the weightsstatisticView – A reference to an object of template type
StatisticViewthat provides access to the statistics
-
class IStatisticsSubset¶
- #include <statistics_subset.hpp>
Defines an interface for all classes that provide access to a subset of the statistics and allows to calculate the scores to be predicted by rules that cover such a subset.
Subclassed by AbstractStatisticsSubset< State, StatisticVector, WeightVector, IndexVector >, IResettableStatisticsSubset
Public Functions
-
inline virtual ~IStatisticsSubset()¶
-
virtual bool hasNonZeroWeight(uint32 statisticIndex) const = 0¶
Returns whether the statistics at a specific index have a non-zero weight or not.
- Returns:
True, if the statistics at the given index have a non-zero weight, false otherwise
-
virtual void addToSubset(uint32 statisticIndex) = 0¶
Adds the statistics at a specific index to the subset in order to mark it as covered by the condition that is currently considered for refining a rule.
This function must be called repeatedly for each statistic that is covered by the current condition, immediately after the invocation of the function
IWeightedStatistics::createSubset. If a rule has already been refined, each of these statistics must have been marked as covered earlier via the functionIWeightedStatistics::addCoveredStatisticand must not have been marked as uncovered via the functionIWeightedStatistics::removeCoveredStatistic.This function is supposed to update any internal state of the subset that relates to the statistics that are covered by the current condition, 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
resetSubsetfor the next time.- Parameters:
statisticIndex – The index of the covered statistic
-
virtual std::unique_ptr<IStatisticsUpdateCandidate> calculateScores() = 0¶
Calculates and returns the scores to be predicted by a rule that covers all statistics that have been added to the subset via the function
addToSubset, as well as a numerical score that assesses the overall quality of the predicted scores.- Returns:
An unique pointer to an object of type
IStatisticsUpdateCandidatethat stores the scores to be predicted by the rule for each considered output, as well as a numerical score that assesses their overall quality
-
inline virtual ~IStatisticsSubset()¶
-
template<typename State, typename StatisticVector, typename WeightVector, typename IndexVector>
class AbstractStatisticsSubset : public virtual IStatisticsSubset¶ - #include <statistics_subset.hpp>
An abstract base class for all classes that provide access to a subset of the statistics and allows to calculate the scores to be predicted by rules that cover such a subset.
- Template Parameters:
State – The type of the state of the training process
StatisticVector – The type of the vector that is used to store the sums of statistics
WeightVector – The type of the vector that provides access to the weights of individual statistics
IndexVector – The type of the vector that provides access to the indices of the outputs that are included in the subset
Public Functions
-
inline AbstractStatisticsSubset(State &state, const WeightVector &weights, const IndexVector &outputIndices)¶
- Parameters:
state – A reference to an object of template type
Statethat represents the state of the training processweights – A reference to an object of template type
WeightVectorthat provides access to the weights of individual statisticsoutputIndices – A reference to an object of template type
IndexVectorthat provides access to the indices of the outputs that are included in the subset
-
inline virtual ~AbstractStatisticsSubset() override¶
Protected Attributes
-
State &state_¶
A reference to an object of template type
Statethat represents the state of the training process.
-
StatisticVector sumVector_¶
An object of template type
StatisticVectorthat stores the sums of statistics.
-
const WeightVector &weights_¶
A reference to an object of template type
WeightVectorthat provides access to the weights of individual statistics.
-
const IndexVector &outputIndices_¶
A reference to an object of template type
IndexVectorthat provides access to the indices of the outputs that are included in the subset.
Private Static Functions
-
static inline bool hasNonZeroWeightInternally(const EqualWeightVector &weights, uint32 statisticIndex)¶
-
template<typename Weights>
static inline bool hasNonZeroWeightInternally(const Weights &weights, uint32 statisticIndex)¶
-
template<typename StatisticView>
static inline void addStatisticToSubsetInternally(const EqualWeightVector &weights, const StatisticView &statisticView, StatisticVector &vector, const IndexVector &outputIndices, uint32 statisticIndex)¶
-
template<typename StatisticView, typename Weights>
static inline void addStatisticToSubsetInternally(const Weights &weights, const StatisticView &statisticView, StatisticVector &vector, const IndexVector &outputIndices, uint32 statisticIndex)¶