File vector_statistic_decomposable_dense.hpp¶
-
namespace boosting
-
template<typename StatisticType>
class DenseDecomposableStatisticVectorView : public AllocatedVector<StatisticType>¶ - #include <vector_statistic_decomposable_dense.hpp>
A one-dimensional view that provides access to aggregated gradients and Hessians that have been calculated using a decomposable loss function and are stored in pre-allocated arrays.
- Template Parameters:
StatisticType – The type of the gradient and Hessians
Public Types
-
using statistic_type = StatisticType¶
The type of the gradients and Hessians.
-
using gradient_iterator = View<StatisticType>::iterator¶
An iterator that provides access to the gradients in the view and allows to modify them.
-
using gradient_const_iterator = View<StatisticType>::const_iterator¶
An iterator that provides read-only access to the gradients in the view.
-
using hessian_iterator = View<StatisticType>::iterator¶
An iterator that provides access to the Hessians in the view and allows to modify them.
-
using hessian_const_iterator = View<StatisticType>::const_iterator¶
An iterator that provides read-only access to the Hessians 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
-
gradient_iterator gradients_begin()¶
Returns a
gradient_iteratorto the beginning of the gradients.- Returns:
A
gradient_iteratorto the beginning
-
gradient_iterator gradients_end()¶
Returns a
gradient_iteratorto the end of the gradients.- Returns:
A
gradient_iteratorto the end
-
gradient_const_iterator gradients_cbegin() const¶
Returns a
gradient_const_iteratorto the beginning of the gradients.- Returns:
A
gradient_const_iteratorto the beginning
-
gradient_const_iterator gradients_cend() const¶
Returns a
gradient_const_iteratorto the end of the gradients.- Returns:
A
gradient_const_iteratorto the end
-
hessian_iterator hessians_begin()¶
Returns a
hessian_iteratorto the beginning of the Hessians.- Returns:
A
hessian_iteratorto the beginning
-
hessian_iterator hessians_end()¶
Returns a
hessian_iteratorto the end of the Hessians.- Returns:
A
hessian_iteratorto the end
-
hessian_const_iterator hessians_cbegin() const¶
Returns a
hessian_const_iteratorto the beginning of the Hessians.- Returns:
A
hessian_const_iteratorto the beginning
-
hessian_const_iterator hessians_cend() const¶
Returns a
hessian_const_iteratorto the end of the Hessians.- Returns:
A
hessian_const_iteratorto the end
-
template<typename StatisticType, typename VectorMath>
class DenseDecomposableStatisticVector : public ClearableViewDecorator<ViewDecorator<DenseDecomposableStatisticVectorView<StatisticType>>>¶ - #include <vector_statistic_decomposable_dense.hpp>
An one-dimensional vector that stores aggregated gradients and Hessians that have been calculated using a decomposable loss function in a C-contiguous array. For each element in the vector a single gradient and Hessian is stored.
- Template Parameters:
StatisticType – The type of the gradient and Hessians
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 gradients and Hessians in the vector
init – True, if all gradients and Hessians in the vector should be initialized with zero, false otherwise
-
DenseDecomposableStatisticVector(const DenseDecomposableStatisticVector<StatisticType, VectorMath> &other)¶
- Parameters:
other – A reference to an object of type
DenseDecomposableStatisticVectorto be copied
-
uint32 getNumElements() const¶
Returns the number of elements in the vector.
- Returns:
The number of elements
-
void add(const DenseDecomposableStatisticVectorView<StatisticType> &vector)¶
Adds all gradients and Hessians in another vector to this vector.
- Parameters:
vector – A reference to an object of type
DenseDecomposableStatisticVectorViewthat stores the gradients and Hessians to be added to this vector
-
void add(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row)¶
Adds all gradients and Hessians in a single row of a
DenseDecomposableStatisticViewto this vector.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be added to this vectorrow – The index of the row to be added to this vector
-
void add(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row, StatisticType weight)¶
Adds all gradients and Hessians in a single row of a
DenseDecomposableStatisticViewto this vector. The gradients and Hessians to be added are multiplied by a specific weight.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be added to this vectorrow – The index of the row to be added to this vector
weight – The weight, the gradients and Hessians should be multiplied by
-
void remove(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row)¶
Removes all gradients and Hessians in a single row of a
DenseDecomposableStatisticViewfrom this vector.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be removed from this vectorrow – The index of the row to be removed from this vector
-
void remove(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row, StatisticType weight)¶
Removes all gradients and Hessians in a single row of a
DenseDecomposableStatisticViewfrom this vector. The gradients and Hessians to be removed are multiplied by a specific weight.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be removed from this vectorrow – The index of the row to be removed from this vector
weight – The weight, the gradients and Hessians should be multiplied by
-
void addToSubset(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row, const CompleteIndexVector &indices)¶
Adds certain gradients and Hessians in a single row of a
DenseDecomposableStatisticView, whose positions are given as aCompleteIndexVector, to this vector.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be added to this vectorrow – The index of the row to be added to this vector
indices – A reference to a
CompleteIndexVectorthat provides access to the indices
-
void addToSubset(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row, const PartialIndexVector &indices)¶
Adds certain gradients and Hessians in single row of a
DenseDecomposableStatisticView, whose positions are given as aPartialIndexVector, to this vector.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be added to this vectorrow – The index of the row to be added to this vector
indices – A reference to a
PartialIndexVectorthat provides access to the indices
-
void addToSubset(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row, const CompleteIndexVector &indices, StatisticType weight)¶
Adds certain gradients and Hessians in a single row of a
DenseDecomposableStatisticView, whose positions are given as aCompleteIndexVector, to this vector. The gradients and Hessians to be added are multiplied by a specific weight.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be added to this vectorrow – The index of the row to be added to this vector
indices – A reference to a
CompleteIndexVectorthat provides access to the indicesweight – The weight, the gradients and Hessians should be multiplied by
-
void addToSubset(const DenseDecomposableStatisticView<StatisticType> &view, uint32 row, const PartialIndexVector &indices, StatisticType weight)¶
Adds certain gradients and Hessians in single row of a
DenseDecomposableStatisticView, whose positions are given as aPartialIndexVector, to this vector. The gradients and Hessians to be added are multiplied by a specific weight.- Parameters:
view – A reference to an object of type
DenseDecomposableStatisticViewthat stores the gradients and Hessians to be added to this vectorrow – The index of the row to be added to this vector
indices – A reference to a
PartialIndexVectorthat provides access to the indicesweight – The weight, the gradients and Hessians should be multiplied by
-
void difference(const DenseDecomposableStatisticVectorView<StatisticType> &first, const CompleteIndexVector &firstIndices, const DenseDecomposableStatisticVectorView<StatisticType> &second)¶
Sets the gradients and Hessians in this vector to the difference
first - secondbetween the gradients and Hessians in two other vectors, considering only the gradients and Hessians in the first vector that correspond to the positions provided by aCompleteIndexVector.- Parameters:
first – A reference to an object of type
DenseDecomposableStatisticVectorViewthat stores the gradients and Hessians in the first vectorfirstIndices – A reference to an object of type
CompleteIndexVectorthat provides access to the indicessecond – A reference to an object of type
DenseDecomposableStatisticVectorViewthat stores the gradients and Hessians in the second vector
-
void difference(const DenseDecomposableStatisticVectorView<StatisticType> &first, const PartialIndexVector &firstIndices, const DenseDecomposableStatisticVectorView<StatisticType> &second)¶
Sets the gradients and Hessians in this vector to the difference
first - secondbetween the gradients and Hessians in two other vectors, considering only the gradients and Hessians in the first vector that correspond to the positions provided by aPartialIndexVector.- Parameters:
first – A reference to an object of type
DenseDecomposableStatisticVectorViewthat stores the gradients and Hessians in the first vectorfirstIndices – A reference to an object of type
PartialIndexVectorthat provides access to the indicessecond – A reference to an object of type
DenseDecomposableStatisticVectorViewthat stores the gradients and Hessians in the second vector
-
template<typename StatisticType>