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 a fixed number of confusion matrices in a pre-allocated C-contiguous array.

Template Parameters:

StatisticType – The type of the elements stored in the confusion matrices

Public Types

using statistic_type = StatisticType

The type of the confusion matrix elements.

using iterator = View<StatisticType>::iterator

An iterator that provides access to confusion matrix elements in the view and allows to modify them.

using const_iterator = View<StatisticType>::const_iterator

An iterator that provides read-only access to confusion matrix elements 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_indices_cbegin() const

Returns a const_iterator to the beginning of the label indices for which a rule predicts correctly.

Returns:

A const_iterator to the beginning of the label indices for which a rule predicts correctly

View<StatisticType>::const_iterator correct_indices_cend() const

Returns a const_iterator to the end of the label indices for which a rule predicts correctly.

Returns:

A const_iterator to the end of the label indices for which a rule predicts correctly

View<StatisticType>::iterator correct_indices_begin()

Returns an iterator to the beginning of the label indices for which a rule predicts correctly.

Returns:

An iterator to the beginning of the label indices for which a rule predicts correctly

View<StatisticType>::iterator correct_indices_end()

Returns an iterator to the end of the label indices for which a rule predicts correctly.

Returns:

An iterator to the end of the label indices for which a rule predicts correctly

View<StatisticType>::const_iterator incorrect_indices_cbegin() const

Returns a const_iterator to the beginning of the label indices for which a rule predicts incorrectly.

Returns:

A const_iterator to the beginning of the label indices for which a rule predicts incorrectly

View<StatisticType>::const_iterator incorrect_indices_cend() const

Returns a const_iterator to the end of the label indices for which a rule predicts incorrectly.

Returns:

A const_iterator to the end of the label indices for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_indices_begin()

Returns an iterator to the beginning of the label indices for which a rule predicts incorrectly.

Returns:

An iterator to the beginning of the label indices for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_indices_end()

Returns an iterator to the end of the label indices for which a rule predicts incorrectly.

Returns:

An iterator to the end of the label indices for which a rule predicts incorrectly

uint32 getNumElements() const

Returns the number of elements in the view.

Returns:

The number of elements

void clear()

Sets all values stored in the view to zero.

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

An one-dimensional vector that stores a fixed number of confusion matrices in a C-contiguous array.

Template Parameters:
  • StatisticType – The type of the elements stored in the confusion matrices

  • 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 the elements of all confusion matrices should be value-initialized

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

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

View<StatisticType>::const_iterator correct_indices_cbegin() const

Returns a const_iterator to the beginning of the label indices for which a rule predicts correctly.

Returns:

A const_iterator to the beginning of the label indices for which a rule predicts correctly

View<StatisticType>::const_iterator correct_indices_cend() const

Returns a const_iterator to the end of the label indices for which a rule predicts correctly.

Returns:

A const_iterator to the end of the label indices for which a rule predicts correctly

View<StatisticType>::iterator correct_indices_begin()

Returns an iterator to the beginning of the label indices for which a rule predicts correctly.

Returns:

An iterator to the beginning of the label indices for which a rule predicts correctly

View<StatisticType>::iterator correct_indices_end()

Returns an iterator to the end of the label indices for which a rule predicts correctly.

Returns:

An iterator to the end of the label indices for which a rule predicts correctly

View<StatisticType>::const_iterator incorrect_indices_cbegin() const

Returns a const_iterator to the beginning of the label indices for which a rule predicts incorrectly.

Returns:

A const_iterator to the beginning of the label indices for which a rule predicts incorrectly

View<StatisticType>::const_iterator incorrect_indices_cend() const

Returns a const_iterator to the end of the label indices for which a rule predicts incorrectly.

Returns:

A const_iterator to the end of the label indices for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_indices_begin()

Returns an iterator to the beginning of the label indices for which a rule predicts incorrectly.

Returns:

An iterator to the beginning of the label indices for which a rule predicts incorrectly

View<StatisticType>::iterator incorrect_indices_end()

Returns an iterator to the end of the label indices for which a rule predicts incorrectly.

Returns:

An iterator to the end of the label indices 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 confusion matrix elements in another vector to this vector.

Parameters:

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

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

Adds the confusion matrix elements that correspond to an example at a specific index to this vector. The confusion matrix elements to be added are multiplied by a specific weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView that provides access to the confusion matrices of the training examples

  • row – The index of the row to be added to this vector

  • weight – The weight, the confusion matrix elements should be multiplied by

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

Removes the confusion matrix elements at a specific row of a view from this vector. The confusion matrix elements to be added are multiplied by a specific weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView that provides access to the confusion matrices of the training examples

  • row – The index of the row to be removed from this vector

  • weight – The weight, the confusion matrix elements should be multiplied by

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

Adds certain confusion matrix elements in a specific row of a view, whose positions are given as a CompleteIndexVector, to this vector. The confusion matrix elements to be added are multiplied by a specific weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView that provides access to the confusion matrices of the training examples

  • row – The index of the row to be added to this vector

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

  • weight – The weight, the confusion matrix elements should be multiplied by

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

Adds certain confusion matrix elements in a specific row of a view, whose positions are given as a CompleteIndexVector, to this vector. The confusion matrix elements to be added are multiplied by a specific weight.

Parameters:
  • view – A reference to an object of type SparseDecomposableStatisticView that provides access to the confusion matrices of the training examples

  • row – The index of the row to be added to this vector

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

  • weight – The weight, the confusion matrix elements should be multiplied by

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

Sets the confusion matrix elements 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:
  • first – A reference to an object of type DenseDecomposableStatisticVectorView that stores the confusion matrices in the first vector

  • firstIndices – A reference to an object of type CompleteIndexVector that provides access to the indices

  • second – A reference to an object of type DenseDecomposableStatisticVectorView that stores the confusion matrices in the second vector

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

Sets the confusion matrix elements 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:
  • first – A reference to an object of type DenseDecomposableStatisticVectorView that stores the confusion matrices in the first vector

  • firstIndices – A reference to an object of type PartialIndexVector that provides access to the indices

  • second – A reference to an object of type DenseDecomposableStatisticVectorView that stores the confusion matrices in the second vector