File score_vector_dense.hpp

template<typename IndexVector>
class DenseScoreVector : public ViewDecorator<AllocatedView<float64>>, public virtual IScoreVector
#include <score_vector_dense.hpp>

An one-dimensional vector that stores the scores that may be predicted by a rule, as well as an overall quality 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.

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.

Public Functions

DenseScoreVector(const IndexVector &labelIndices, 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

  • 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.

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.

Returns:

An index_const_iterator to the end

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 value_const_iterator to the end of the predicted scores.

Returns:

A value_const_iterator to the end

uint32 getNumElements() const

Returns the number of labels for which the rule may predict.

Returns:

The number of labels

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_