File score_vector_binned_dense.hpp

template<typename IndexVector>
class DenseBinnedScoreVector : public BinnedVectorDecorator<ViewDecorator<CompositeVector<AllocatedVector<uint32>, ResizableVector<float64>>>>, public virtual IScoreVector
#include <score_vector_binned_dense.hpp>

An one dimensional vector that stores the scores that may be predicted by a rule, corresponding to bins for which the same prediction is made, as well as a numerical score that assesses the overall quality of the rule, in a C-contiguous array.

Template Parameters:

IndexVector – The type of the vector that provides access to the indices of the labels for which the rule may predict

Public Types

typedef IndexVector::const_iterator index_const_iterator

An iterator that provides read-only access to the indices of the labels for which the rule predicts.

typedef BinnedConstIterator<float64> value_const_iterator

An iterator that provides read-only access to the predicted scores that correspond to individual labels.

typedef View<uint32>::iterator bin_index_iterator

An iterator that provides access to the indices that correspond to individual bins and allows to modify them.

typedef View<uint32>::const_iterator bin_index_const_iterator

An iterator that provides read-only access to the indices that correspond to individual bins.

typedef View<float64>::iterator bin_value_iterator

An iterator that provides access to the predicted scores that correspond to individual bins and allows to modify them.

typedef View<float64>::const_iterator bin_value_const_iterator

An iterator that provides read-only access to the predicted scores that correspond to individual bins.

Public Functions

DenseBinnedScoreVector(const IndexVector &labelIndices, uint32 numBins, bool sorted)
Parameters:
  • labelIndices – A reference to an object of template type IndexVector that provides access to the indices of the labels for which the rule may predict

  • numBins – The number of bins

  • sorted – True, if the indices of the labels for which the rule may predict are sorted in increasing order, false otherwise

index_const_iterator indices_cbegin() const

Returns an index_const_iterator to the beginning of the indices that correspond to individual labels.

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 that correspond to individual labels.

Returns:

An index_const_iterator to the end

value_const_iterator values_cbegin() const

Returns a value_const_iterator to the beginning of the predicted scores that correspond to individual labels.

Returns:

A value_const_iterator to the beginning

value_const_iterator values_cend() const

Returns a value_const_iterator to the end of the predicted scores that correspond to individual labels.

Returns:

A value_const_iterator to the end

bin_index_iterator bin_indices_begin()

Returns an bin_index_iterator to the beginning of the indices that correspond to individual bins.

Returns:

An bin_index_iterator to the beginning

bin_index_iterator bin_indices_end()

Returns an bin_index_iterator to the end of the indices that correspond to individual bins.

Returns:

An bin_index_iterator to the end

bin_index_const_iterator bin_indices_cbegin() const

Returns an bin_index_const_iterator to the beginning of the indices that correspond to individual bins.

Returns:

An bin_index_const_iterator to the beginning

bin_index_const_iterator bin_indices_cend() const

Returns an bin_index_const_iterator to the end of the indices that correspond to individual bins.

Returns:

An bin_index_const_iterator to the end

bin_value_iterator bin_values_begin()

Returns a bin_value_iterator to the beginning of the predicted scores that correspond to individual bins.

Returns:

A bin_value_iterator to the beginning

bin_value_iterator bin_values_end()

Returns a bin_value_iterator to the end of the predicted scores that correspond to individual bins.

Returns:

A bin_value_iterator to the end

bin_value_const_iterator bin_values_cbegin() const

Returns a bin_value_const_iterator to the beginning of the predicted scores that correspond to individual bins.

Returns:

A bin_value_const_iterator to the beginning

bin_value_const_iterator bin_values_cend() const

Returns a bin_value_const_iterator to the end of the predicted scores that correspond to individual bins.

Returns:

A bin_value_const_iterator to the end

uint32 getNumElements() const

Returns the number of elements in the vector.

Returns:

The number of elements

void setNumBins(uint32 numBins, bool freeMemory)

Sets the number of bins in the vector.

Parameters:
  • numBins – The number of bins to be set

  • freeMemory – True, if unused memory should be freed, if possible, false otherwise

bool isPartial() const

Returns whether the rule may only predict for a subset of the available labels, or not.

Returns:

True, if the rule may only predict for a subset of the available labels, false otherwise

bool isSorted() const

Returns whether the indices of the labels for which the rule may predict are sorted in increasing order, or not.

Returns:

True, if the indices of the labels for which the rule may predict are sorted in increasing order, false otherwise

virtual void updatePrediction(IPrediction &prediction) const override

Sets the scores of a specific prediction to the scores that are stored in this vector.

Parameters:

prediction – A reference to an object of type IPrediction that should be updated

virtual void processScores(ScoreProcessor &scoreProcessor) const override

Passes the scores to an ScoreProcessor in order to convert them into the head of a rule.

Parameters:

scoreProcessor – A reference to an object of type ScoreProcessor, the scores should be passed to

Private Members

const IndexVector &labelIndices_
const bool sorted_
uint32 maxCapacity_