File vector_statistic_example_wise_dense.hpp¶
-
namespace boosting
-
class DenseExampleWiseStatisticVector : public ClearableViewDecorator<ViewDecorator<CompositeVector<AllocatedVector<float64>, AllocatedVector<float64>>>>¶
- #include <vector_statistic_example_wise_dense.hpp>
An one-dimensional vector that stores gradients and Hessians that have been calculated using a non-decomposable loss function in C-contiguous arrays. For each element in the vector a single gradient, but multiple Hessians are stored. In a vector that stores
n
gradients(n * (n + 1)) / 2
Hessians are stored. The Hessians can be viewed as a symmetric Hessian matrix withn
rows and columns.Public Types
-
typedef View<float64>::iterator gradient_iterator¶
An iterator that provides access to the gradients in the vector and allows to modify them.
-
typedef View<float64>::const_iterator gradient_const_iterator¶
An iterator that provides read-only access to the gradients in the vector.
-
typedef View<float64>::iterator hessian_iterator¶
An iterator that provides access to the Hessians in the vector and allows to modify them.
-
typedef View<float64>::const_iterator hessian_const_iterator¶
An iterator that provides read-only access to the Hessians in the vector.
-
typedef DiagonalConstIterator<float64> hessian_diagonal_const_iterator¶
An iterator that provides read-only access to the Hessians that correspond to the diagonal of the Hessian matrix.
Public Functions
-
DenseExampleWiseStatisticVector(uint32 numGradients, bool init = false)¶
- Parameters:
numGradients – The number of gradients in the vector
init – True, if all gradients and Hessians in the vector should be initialized with zero, false otherwise
-
DenseExampleWiseStatisticVector(const DenseExampleWiseStatisticVector &other)¶
- Parameters:
other – A reference to an object of type
DenseExampleWiseStatisticVector
to be copied
-
gradient_iterator gradients_begin()¶
Returns a
gradient_iterator
to the beginning of the gradients.- Returns:
A
gradient_iterator
to the beginning
-
gradient_iterator gradients_end()¶
Returns a
gradient_iterator
to the end of the gradients.- Returns:
A
gradient_iterator
to the end
-
gradient_const_iterator gradients_cbegin() const¶
Returns a
gradient_const_iterator
to the beginning of the gradients.- Returns:
A
gradient_const_iterator
to the beginning
-
gradient_const_iterator gradients_cend() const¶
Returns a
gradient_const_iterator
to the end of the gradients.- Returns:
A
gradient_const_iterator
to the end
-
hessian_iterator hessians_begin()¶
Returns a
hessian_iterator
to the beginning of the Hessians.- Returns:
A
hessian_iterator
to the beginning
-
hessian_iterator hessians_end()¶
Returns a
hessian_iterator
to the end of the Hessians.- Returns:
A
hessian_iterator
to the end
-
hessian_const_iterator hessians_cbegin() const¶
Returns a
hessian_const_iterator
to the beginning of the Hessians.- Returns:
A
hessian_const_iterator
to the beginning
-
hessian_const_iterator hessians_cend() const¶
Returns a
hessian_const_iterator
to the end of the Hessians.- Returns:
A
hessian_const_iterator
to the end
-
hessian_diagonal_const_iterator hessians_diagonal_cbegin() const¶
Returns a
hessian_diagonal_const_iterator
to the beginning of the Hessians that correspond to the diagonal of the Hessian matrix.- Returns:
A
hessian_diagonal_const_iterator
to the beginning
-
hessian_diagonal_const_iterator hessians_diagonal_cend() const¶
Returns a
hessian_diagonal_const_iterator
to the end of the Hessians that correspond to the diagonal of the Hessian matrix.- Returns:
A
hessian_diagonal_const_iterator
to the end
-
uint32 getNumGradients() const¶
Returns the number of gradients in the vector.
- Returns:
The number of gradients
-
uint32 getNumHessians() const¶
Returns the number of Hessians in the vector.
- Returns:
The number of Hessians
-
void add(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd)¶
Adds all gradients and Hessians in another vector to this vector.
- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
-
void add(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd, float64 weight)¶
Adds all gradients and Hessians in another vector to this vector. The gradients and Hessians to be added are multiplied by a specific weight.
- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
weight – The weight, the gradients and Hessians should be multiplied by
-
void remove(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd)¶
Removes all gradients and Hessians in another vector from this vector.
- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
-
void remove(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd, float64 weight)¶
Removes all gradients and Hessians in another vector from this vector. The gradients and Hessians to be removed are multiplied by a specific weight.
- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
weight – The weight, the gradients and Hessians should be multiplied by
-
void addToSubset(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd, const CompleteIndexVector &indices)¶
Adds certain gradients and Hessians in another vector, whose positions are given as a
CompleteIndexVector
, to this vector.- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
indices – A reference to a
CompleteIndexVector
that provides access to the indices
-
void addToSubset(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd, const PartialIndexVector &indices)¶
Adds certain gradients and Hessians in another vector, whose positions are given as a
PartialIndexVector
, to this vector.- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
indices – A reference to a
PartialIndexVector
that provides access to the indices
-
void addToSubset(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd, const CompleteIndexVector &indices, float64 weight)¶
Adds certain gradients and Hessians in another vector, whose positions are given as a
CompleteIndexVector
, to this vector. The gradients and Hessians to be added are multiplied by a specific weight.- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
indices – A reference to a
CompleteIndexVector
that provides access to the indicesweight – The weight, the gradients and Hessians should be multiplied by
-
void addToSubset(View<float64>::const_iterator gradientsBegin, View<float64>::const_iterator gradientsEnd, View<float64>::const_iterator hessiansBegin, View<float64>::const_iterator hessiansEnd, const PartialIndexVector &indices, float64 weight)¶
Adds certain gradients and Hessians in another vector, whose positions are given as a
PartialIndexVector
, to this vector. The gradients and Hessians to be added are multiplied by a specific weight.- Parameters:
gradientsBegin – An iterator to the beginning of the gradients
gradientsEnd – An iterator to the end of the gradients
hessiansBegin – An iterator to the beginning of the Hessians
hessiansEnd – An iterator to the end of the Hessians
indices – A reference to a
PartialIndexVector
that provides access to the indicesweight – The weight, the gradients and Hessians should be multiplied by
-
void difference(View<float64>::const_iterator firstGradientsBegin, View<float64>::const_iterator firstGradientsEnd, View<float64>::const_iterator firstHessiansBegin, View<float64>::const_iterator firstHessiansEnd, const CompleteIndexVector &firstIndices, View<float64>::const_iterator secondGradientsBegin, View<float64>::const_iterator secondGradientsEnd, View<float64>::const_iterator secondHessiansBegin, View<float64>::const_iterator secondHessiansEnd)¶
Sets the gradients and Hessians in this vector to the difference
first - second
between 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:
firstGradientsBegin – An iterator to the beginning of the first gradients
firstGradientsEnd – An iterator to the end of the first gradients
firstHessiansBegin – An iterator to the beginning of the first Hessians
firstHessiansEnd – An iterator to the end of the first Hessians
firstIndices – A reference to an object of type
CompleteIndexVector
that provides access to the indicessecondGradientsBegin – An iterator to the beginning of the second gradients
secondGradientsEnd – An iterator to the end of the second gradients
secondHessiansBegin – An iterator to the beginning of the second Hessians
secondHessiansEnd – An iterator to the end of the second Hessians
-
void difference(View<float64>::const_iterator firstGradientsBegin, View<float64>::const_iterator firstGradientsEnd, View<float64>::const_iterator firstHessiansBegin, View<float64>::const_iterator firstHessiansEnd, const PartialIndexVector &firstIndices, View<float64>::const_iterator secondGradientsBegin, View<float64>::const_iterator secondGradientsEnd, View<float64>::const_iterator secondHessiansBegin, View<float64>::const_iterator secondHessiansEnd)¶
Sets the gradients and Hessians in this vector to the difference
first - second
between 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:
firstGradientsBegin – A iterator to the beginning of the first gradients
firstGradientsEnd – A iterator to the end of the first gradients
firstHessiansBegin – A iterator to the beginning of the first Hessians
firstHessiansEnd – A iterator to the end of the first Hessians
firstIndices – A reference to an object of type
PartialIndexVector
that provides access to the indicessecondGradientsBegin – An iterator to the beginning of the second gradients
secondGradientsEnd – An iterator to the end of the second gradients
secondHessiansBegin – An iterator to the beginning of the second Hessians
secondHessiansEnd – An iterator to the end of the second Hessians
-
typedef View<float64>::iterator gradient_iterator¶
-
class DenseExampleWiseStatisticVector : public ClearableViewDecorator<ViewDecorator<CompositeVector<AllocatedVector<float64>, AllocatedVector<float64>>>>¶