File vector_statistic_decomposable_dense.hpp

namespace seco
template<typename StatisticType>
class DenseDecomposableStatisticVectorView : public CompositeVector<AllocatedVector<StatisticType>, AllocatedVector<StatisticType>>
#include <vector_statistic_decomposable_dense.hpp>

An one-dimensional view that provides access to the number of examples for which a rule predicts individual labels correctly or incorrectly, respectively.

Template Parameters:

StatisticType – The type of the counts stored in the view

Public Types

using statistic_type = StatisticType

The type of the counts stored in the view.

using iterator = View<StatisticType>::iterator

An iterator that provides access to the counts in the view and allows to modify them.

using const_iterator = View<StatisticType>::const_iterator

An iterator that provides read-only access to the counts in the view.

Public Functions

DenseDecomposableStatisticVectorView(uint32 numElements, bool init = false)
Parameters:
  • numElements – The number of elements in the view

  • init – True, if all elements in the view should be value-initialized, false otherwise

View<StatisticType>::const_iterator correct_counts_cbegin() const

Returns a const_iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly.

Returns:

A const_iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::const_iterator correct_counts_cend() const

Returns a const_iterator to the end of the counts that correspond to examples for which a rule predicts correctly.

Returns:

A const_iterator to the end of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::iterator correct_counts_begin()

Returns an iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly.

Returns:

An iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::iterator correct_counts_end()

Returns an iterator to the end of the counts that correspond to examples for which a rule predicts correctly.

Returns:

An iterator to the end of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::const_iterator incorrect_counts_cbegin() const

Returns a const_iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

A const_iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly

View<StatisticType>::const_iterator incorrect_counts_cend() const

Returns a const_iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

A const_iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_counts_begin()

Returns an iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

An iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_counts_end()

Returns an iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

An iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly

uint32 getNumElements() const

Returns the number of elements in the view.

Returns:

The number of elements

template<typename StatisticType, typename VectorMath>
class DenseDecomposableStatisticVector : public ClearableViewDecorator<ViewDecorator<DenseDecomposableStatisticVectorView<StatisticType>>>
#include <vector_statistic_decomposable_dense.hpp>

An one-dimensional vector that stores the number of examples for which a rule predicts individual labels correctly or incorrectly, respectively, in two C-contiguous arrays.

Template Parameters:
  • StatisticType – The type of the counts stored in the vector

  • VectorMath – The type that implements basic operations for calculating with numerical arrays

Public Functions

DenseDecomposableStatisticVector(uint32 numElements, bool init = false)
Parameters:
  • numElements – The number of elements in the vector

  • init – True, if all elements in the vector should be value-initialized, false otherwise

DenseDecomposableStatisticVector(const DenseDecomposableStatisticVector<StatisticType, VectorMath> &other)
Parameters:

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

View<StatisticType>::const_iterator correct_counts_cbegin() const

Returns a const_iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly.

Returns:

A const_iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::const_iterator correct_counts_cend() const

Returns a const_iterator to the end of the counts that correspond to examples for which a rule predicts correctly.

Returns:

A const_iterator to the end of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::iterator correct_counts_begin()

Returns an iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly.

Returns:

An iterator to the beginning of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::iterator correct_counts_end()

Returns an iterator to the end of the counts that correspond to examples for which a rule predicts correctly.

Returns:

An iterator to the end of the counts that correspond to examples for which a rule predicts correctly

View<StatisticType>::const_iterator incorrect_counts_cbegin() const

Returns a const_iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

A const_iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly

View<StatisticType>::const_iterator incorrect_counts_cend() const

Returns a const_iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

A const_iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_counts_begin()

Returns an iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

An iterator to the beginning of the counts that correspond to examples for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_counts_end()

Returns an iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly.

Returns:

An iterator to the end of the counts that correspond to examples for which a rule predicts incorrectly

uint32 getNumElements() const

Returns the number of elements in the view.

Returns:

The number of elements

void add(const DenseDecomposableStatisticVectorView<StatisticType> &other)

Adds all counts in another vector to this vector.

Parameters:

other – A reference to an object of type DenseDecomposableStatisticVectorView that stores the counts to be added to this vector

void add(const SparseDecomposableStatisticView &view, uint32 row, StatisticType weight = 1)

Increases the counts in this vector based on a specific row in a SparseDecomposableStatisticView. The increments of the counts are multiplied by a given weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView

  • row – The index of the row to be used for updating this vector

  • weight – The weight, the increments of the counts should be multiplied by

void remove(const SparseDecomposableStatisticView &view, uint32 row, StatisticType weight = 1)

Decreases the counts in this vector based on a specific row in a SparseDecomposableStatisticView. The decrements of the counts are multiplied by a given weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView

  • row – The index of the row to be used for updating this vector

  • weight – The weight, the decrements of the counts should be multiplied by

void addToSubset(const SparseDecomposableStatisticView &view, uint32 row, const CompleteIndexVector &indices, StatisticType weight = 1)

Increments the counts in this vector based on certain elements of a specific row in a SparseDecomposableStatisticView, whose positions are given as a CompleteIndexVector. The increments of the counts are multiplied by a given weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView

  • row – The index of the row to be used for updating this vector

  • indices – A reference to a CompleteIndexVector that provides access to the indices

  • weight – The weight, the increments of the counts should be multiplied by

void addToSubset(const SparseDecomposableStatisticView &view, uint32 row, const PartialIndexVector &indices, StatisticType weight = 1)

Increments the counts in this vector based on certain elements of a specific row in a SparseDecomposableStatisticView, whose positions are given as a PartialIndexVector. The increments of the counts are multiplied by a given weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView

  • row – The index of the row to be used for updating this vector

  • indices – A reference to a PartialIndexVector that provides access to the indices

  • weight – The weight, the increments of the counts should be multiplied by

void difference(const DenseDecomposableStatisticVectorView<StatisticType> &first, const CompleteIndexVector &firstIndices, const DenseDecomposableStatisticVectorView<StatisticType> &second)

Sets the counts in this vector to the difference first - second between the elements in two other vectors, considering only the elements in the first vector that correspond to the positions provided by a CompleteIndexVector.

Parameters:
void difference(const DenseDecomposableStatisticVectorView<StatisticType> &first, const PartialIndexVector &firstIndices, const DenseDecomposableStatisticVectorView<StatisticType> &second)

Sets the counts in this vector to the difference first - second between the elements in two other vectors, considering only the elements in the first vector that correspond to the positions provided by a PartialIndexVector.

Parameters: