File vector_statistic_label_wise_dense.hpp

namespace boosting
class DenseLabelWiseStatisticVector : public ClearableViewDecorator<DenseVectorDecorator<AllocatedVector<Tuple<float64>>>>
#include <vector_statistic_label_wise_dense.hpp>

An one-dimensional vector that stores aggregated gradients and Hessians that have been calculated using a label-wise decomposable loss function in a C-contiguous array. For each element in the vector a single gradient and Hessian is stored.

Public Functions

DenseLabelWiseStatisticVector(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

DenseLabelWiseStatisticVector(const DenseLabelWiseStatisticVector &other)
Parameters:

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

void add(const DenseLabelWiseStatisticVector &vector)

Adds all gradients and Hessians in another vector to this vector.

Parameters:

vector – A reference to an object of type DenseLabelWiseStatisticVector that stores the gradients and Hessians to be added to this vector

void add(const CContiguousView<Tuple<float64>> &view, uint32 row)

Adds all gradients and Hessians in a single row of a CContiguousView to this vector.

Parameters:
  • view – A reference to an object of type CContiguousView that stores the gradients and Hessians to be added to this vector

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

void add(const CContiguousView<Tuple<float64>> &view, uint32 row, float64 weight)

Adds all gradients and Hessians in a single row of a CContiguousView 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 CContiguousView that stores the gradients and Hessians to be added to this vector

  • row – 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 CContiguousView<Tuple<float64>> &view, uint32 row)

Removes all gradients and Hessians in a single row of a CContiguousView from this vector.

Parameters:
  • view – A reference to an object of type CContiguousView that stores the gradients and Hessians to be removed from this vector

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

void remove(const CContiguousView<Tuple<float64>> &view, uint32 row, float64 weight)

Removes all gradients and Hessians in a single row of a CContiguousView from this vector. The gradients and Hessians to be removed are multiplied by a specific weight.

Parameters:
  • view – A reference to an object of type CContiguousView that stores the gradients and Hessians to be removed from this vector

  • row – 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 CContiguousView<Tuple<float64>> &view, uint32 row, const CompleteIndexVector &indices)

Adds certain gradients and Hessians in a single row of a CContiguousView, whose positions are given as a CompleteIndexVector, to this vector.

Parameters:
  • view – A reference to an object of type CContiguousView that stores the gradients and Hessians to be added to this vector

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

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

void addToSubset(const CContiguousView<Tuple<float64>> &view, uint32 row, const PartialIndexVector &indices)

Adds certain gradients and Hessians in single row of a CContiguousView, whose positions are given as a PartialIndexVector, to this vector.

Parameters:
  • view – A reference to an object of type CContiguousView that stores the gradients and Hessians to be added to this vector

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

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

void addToSubset(const CContiguousView<Tuple<float64>> &view, uint32 row, const CompleteIndexVector &indices, float64 weight)

Adds certain gradients and Hessians in a single row of a CContiguousView, whose positions are given as a CompleteIndexVector, 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 CContiguousView that stores the gradients and Hessians to be added to this vector

  • 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 gradients and Hessians should be multiplied by

void addToSubset(const CContiguousView<Tuple<float64>> &view, uint32 row, const PartialIndexVector &indices, float64 weight)

Adds certain gradients and Hessians in single row of a CContiguousView, whose positions are given as a PartialIndexVector, 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 CContiguousView that stores the gradients and Hessians to be added to this vector

  • 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 gradients and Hessians should be multiplied by

void difference(const DenseLabelWiseStatisticVector &first, const CompleteIndexVector &firstIndices, const DenseLabelWiseStatisticVector &second)

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 a CompleteIndexVector.

Parameters:
  • first – A reference to an object of type DenseLabelWiseStatisticVector that stores the gradients and Hessians 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 DenseLabelWiseStatisticVector that stores the gradients and Hessians in the second vector

void difference(const DenseLabelWiseStatisticVector &first, const PartialIndexVector &firstIndices, const DenseLabelWiseStatisticVector &second)

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 a PartialIndexVector.

Parameters:
  • first – A reference to an object of type DenseLabelWiseStatisticVector that stores the gradients and Hessians 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 DenseLabelWiseStatisticVector that stores the gradients and Hessians in the second vector