File prediction_partial.hpp¶
-
class PartialPrediction : public ResizableVectorDecorator<VectorDecorator<ResizableVector<float64>>>, public IEvaluatedPrediction¶
- #include <prediction_partial.hpp>
Stores the scores that are predicted by a rule that predicts for a subset of the available labels.
Public Types
-
typedef View<float64>::iterator value_iterator¶
An iterator that provides access to the predicted scores and allows to modify them.
-
typedef View<float64>::const_iterator value_const_iterator¶
An iterator that provides read-only access to the predicted scores.
-
typedef PartialIndexVector::iterator index_iterator¶
An iterator that provides access to the indices for which the rule predicts and allows to modify them.
-
typedef PartialIndexVector::const_iterator index_const_iterator¶
An iterator that provides read-only access to the indices for which the rule predicts.
Public Functions
-
PartialPrediction(uint32 numElements, bool sorted)¶
- Parameters:
numElements – The number of labels for which the rule predicts
sorted – True, if the scores that are stored by this prediction are sorted in increasing order by the corresponding label indices, false otherwise
-
value_iterator values_begin()¶
Returns a
value_iterator
to the beginning of the predicted scores.- Returns:
A
value_iterator
to the beginning
-
value_iterator values_end()¶
Returns a
value_iterator
to the end of the predicted scores.- Returns:
A
value_iterator
to the end
-
value_const_iterator values_cbegin() const¶
Returns a
value_const_iterator
to the beginning of the predicted scores.- Returns:
A
value_const_iterator
to the beginning
-
value_const_iterator values_cend() const¶
Returns a
const_iterator
to the end of the predicted scores.- Returns:
A
const_iterator
to the end
-
index_iterator indices_begin()¶
Returns an
index_iterator
to the beginning of the indices for which the rule predicts.- Returns:
An
index_iterator
to the beginning
-
index_iterator indices_end()¶
Returns an
index_iterator
to the end of the indices for which the rule predicts.- Returns:
An
index_iterator
to the end
-
index_const_iterator indices_cbegin() const¶
Returns an
index_const_iterator
to the beginning of the indices for which the rule predicts.- Returns:
An
index_const_iterator
to the beginning
-
index_const_iterator indices_cend() const¶
Returns an
index_const_iterator
to the end of the indices for which the rule predicts.- Returns:
An
index_const_iterator
to the end
-
void setSorted(bool sorted)¶
Sets whether the scores that are stored by this prediction are sorted in increasing order by the corresponding label indices, or not.
- Parameters:
sorted – True, if the scores that are stored by this prediction are sorted in increasing order by the corresponding label indices, false otherwise
-
virtual uint32 getNumElements() const override¶
Returns the number of indices.
- Returns:
The number of indices
-
virtual void setNumElements(uint32 numElements, bool freeMemory) override¶
Sets the number of elements in the vector.
- Parameters:
numElements – The number of elements to be set
freeMemory – True, if unused memory should be freed, if possible, false otherwise
-
virtual void sort() override¶
Sorts the scores that are stored by this prediction in increasing order by the indices of the labels they correspond to.
-
virtual void postProcess(const IPostProcessor &postProcessor) override¶
Post-processes the scores that are stored by this prediction.
- Parameters:
postProcessor – A reference to an object of type
IPostProcessor
that sould be used for post-processing
-
virtual void set(View<float64>::const_iterator begin, View<float64>::const_iterator end) final override¶
Sets the scores that are stored by this prediction to the values in a given iterator.
- Parameters:
begin – An iterator to the beginning of the values to be set
end – An iterator to the end of the values to be set
-
virtual void set(BinnedConstIterator<float64> begin, BinnedConstIterator<float64> end) final override¶
Sets the scores that are stored by this prediction to the values in a given iterator.
- Parameters:
begin – An iterator to the beginning of the values to be set
end – An iterator to the end of the values to be set
-
virtual bool isPartial() const override¶
Returns whether the indices are partial, i.e., some indices in the range [0, getNumElements()) are missing, or not.
- Returns:
True, if the indices are partial, false otherwise
-
virtual uint32 getIndex(uint32 pos) const override¶
Returns the index at a specific position.
- Parameters:
pos – The position of the index. Must be in [0, getNumElements())
- Returns:
The index at the given position
-
virtual std::unique_ptr<IStatisticsSubset> createStatisticsSubset(const IStatistics &statistics, const EqualWeightVector &weights) const override¶
Creates and returns a new subset of the given statistics that only contains the labels whose indices are stored in this vector.
- Parameters:
statistics – A reference to an object of type
IStatistics
that should be used to create the subsetweights – A reference to an object of type
EqualWeightVector
that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IStatisticsSubset
that has been created
-
virtual std::unique_ptr<IStatisticsSubset> createStatisticsSubset(const IStatistics &statistics, const BitWeightVector &weights) const override¶
Creates and returns a new subset of the given statistics that only contains the labels whose indices are stored in this vector.
- Parameters:
statistics – A reference to an object of type
IStatistics
that should be used to create the subsetweights – A reference to an object of type
BitWeightVector
that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IStatisticsSubset
that has been created
-
virtual std::unique_ptr<IStatisticsSubset> createStatisticsSubset(const IStatistics &statistics, const DenseWeightVector<uint32> &weights) const override¶
Creates and returns a new subset of the given statistics that only contains the labels whose indices are stored in this vector.
- Parameters:
statistics – A reference to an object of type
IStatistics
that should be used to create the subsetweights – A reference to an object of type
DenseWeightVector<uint32>
that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IStatisticsSubset
that has been created
-
virtual std::unique_ptr<IStatisticsSubset> createStatisticsSubset(const IStatistics &statistics, const OutOfSampleWeightVector<EqualWeightVector> &weights) const override¶
Creates and returns a new subset of the given statistics that only contains the labels whose indices are stored in this vector.
- Parameters:
statistics – A reference to an object of type
IStatistics
that should be used to create the subsetweights – A reference to an object of type
OutOfSampleWeightVector<EqualWeightVector>
that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IStatisticsSubset
that has been created
-
virtual std::unique_ptr<IStatisticsSubset> createStatisticsSubset(const IStatistics &statistics, const OutOfSampleWeightVector<BitWeightVector> &weights) const override¶
Creates and returns a new subset of the given statistics that only contains the labels whose indices are stored in this vector.
- Parameters:
statistics – A reference to an object of type
IStatistics
that should be used to create the subsetweights – A reference to an object of type
OutOfSampleWeightVector<BitWeightVector>
that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IStatisticsSubset
that has been created
-
virtual std::unique_ptr<IStatisticsSubset> createStatisticsSubset(const IStatistics &statistics, const OutOfSampleWeightVector<DenseWeightVector<uint32>> &weights) const override¶
Creates and returns a new subset of the given statistics that only contains the labels whose indices are stored in this vector.
- Parameters:
statistics – A reference to an object of type
IStatistics
that should be used to create the subsetweights – A reference to an object of type
OutOfSampleWeightVector<DenseWeightVector<uint32>>
that provides access to the weights of individual training examples
- Returns:
An unique pointer to an object of type
IStatisticsSubset
that has been created
-
virtual std::unique_ptr<IRuleRefinement> createRuleRefinement(IFeatureSubspace &featureSubspace, uint32 featureIndex) const override¶
Creates and return a new instance of type
IRuleRefinement
that allows to search for the best refinement of an existing rule that predicts only for the labels whose indices are stored in this vector.- Parameters:
featureSubspace – A reference to an object of type
IFeatureSubspace
that should be to search for the refinementfeatureIndex – The index of the feature that should be considered when searching for the refinement
- Returns:
An unique pointer to an object of type
IRuleRefinement
that has been created
-
virtual void apply(IStatistics &statistics, uint32 statisticIndex) const override¶
Updates given statistics by applying this prediction.
- Parameters:
statistics – A reference to an object of type
IStatistics
to be updatedstatisticIndex – The index of the statistic to be updated
-
virtual void revert(IStatistics &statistics, uint32 statisticIndex) const override¶
Updates given statistics by reverting this prediction.
- Parameters:
statistics – A reference to an object of type
IStatistics
to be updatedstatisticIndex – The index of the statistic to be updated
-
typedef View<float64>::iterator value_iterator¶