File vector_math_decomposable.hpp

namespace boosting
struct SequentialDecomposableVectorMath
#include <vector_math_decomposable.hpp>

Implements basic operations for calculating with arrays of gradients and Hessians by applying the respective operations to each element in the arrays sequentially.

Public Static Functions

template<typename StatisticType>
static inline void calculateOutputWiseScores(const StatisticType *gradients, const StatisticType *hessians, StatisticType *outputs, uint32 numElements, float32 l1RegularizationWeight, float32 l2RegularizationWeight)

Calculates the optimal scores to be predicted for several outputs, based on the corresponding gradients and Hessians and taking L1 and L2 regularization into account, and writes them to an output array.

Template Parameters:

StatisticType – The type of the gradients and Hessians

Parameters:
  • gradients – A pointer to an array that store the gradients that correspond to individual outputs

  • hessians – A pointer to an array that stores the Hessians that corresponds to individual outputs

  • outputs – A pointer to the array into which the optimal scores should be written

  • numElements – The number of elements in the arrays gradients, hessians and output

  • l1RegularizationWeight – The weight of the L1 regularization

  • l2RegularizationWeight – The weight of the L2 regularization

template<typename StatisticType>
static inline void calculateOutputWiseScoresWeighted(const StatisticType *gradients, const StatisticType *hessians, const uint32 *weights, StatisticType *outputs, uint32 numElements, float32 l1RegularizationWeight, float32 l2RegularizationWeight)

Calculates the optimal scores to be predicted for several outputs, based on the corresponding gradients and Hessians and taking L1 and L2 regularization into account, and writes them to an output array. The L1 and L2 regularization weight for individual outputs is multiplied by given weights.

Template Parameters:

StatisticType – The type of the gradients and Hessians

Parameters:
  • gradients – A pointer to an array that store the gradients that correspond to individual outputs

  • hessians – A pointer to an array that stores the Hessians that correspond to individual outputs

  • weights – A pointer to an array that stores weights that correspond to individual outputs

  • outputs – A pointer to the array into which the optimal scores should be written

  • numElements – The number of elements in the arrays gradients, hessians and output

  • l1RegularizationWeight – The weight of the L1 regularization

  • l2RegularizationWeight – The weight of the L2 regularization

template<typename StatisticType>
static inline StatisticType aggregateOutputWiseQualities(const StatisticType *scores, const StatisticType *gradients, const StatisticType *hessians, uint32 numElements, float32 l1RegularizationWeight, float32 l2RegularizationWeight)

Calculates the qualities of predictions for several outputs, taking L1 and L2 regularization into account, and returns the overall quality aggregated over all predictions.

Template Parameters:

StatisticType – The type of the gradients and Hessians

Parameters:
  • scores – A pointer to an array that stores the predictions for individual outputs

  • gradients – A pointer to an array that stores the gradients that correspond to individual outputs

  • hessians – A pointer to an array that stores the Hessians that correspond to individual outputs

  • numElements – The number of elements in the array scores, gradients and hessians

  • l1RegularizationWeight – The weight of the L1 regularization

  • l2RegularizationWeight – The weight of the L2 regularization

Returns:

The overall quality

template<typename StatisticType>
static inline StatisticType aggregateOutputWiseQualitiesWeighted(const StatisticType *scores, const StatisticType *gradients, const StatisticType *hessians, const uint32 *weights, uint32 numElements, float32 l1RegularizationWeight, float32 l2RegularizationWeight)

Calculates the qualities of predictions for several outputs, taking L1 and L2 regularization into account, and returns the overall quality aggregated over all predictions. The L1 and L2 regularization weight for individual outputs multiplied by given weights.

Template Parameters:

StatisticType – The type of the gradients and Hessians

Parameters:
  • scores – A pointer to an array that stores the predictions for individual outputs

  • gradients – A pointer to an array that stores the gradients that correspond to individual outputs

  • hessians – A pointer to an array that stores the Hessians that correspond to individual outputs

  • weights – A pointer to an array that stores the weights that correspond to individual outputs

  • numElements – The number of elements in the array scores, gradients and hessians

  • l1RegularizationWeight – The weight of the L1 regularization

  • l2RegularizationWeight – The weight of the L2 regularization

Returns:

The overall quality