File statistic.hpp

namespace boosting
template<typename StatisticType>
struct Statistic
#include <statistic.hpp>

An individual label space statistic that consists of a gradient and a Hessian.

Template Parameters:

StatisticType – The type of the gradient and Hessian

Public Types

using statistic_type = StatisticType

The type of the gradient and Hessian.

Public Functions

inline Statistic()
inline Statistic(StatisticType gradient, StatisticType hessian)
Parameters:
  • gradient – The gradient

  • hessian – The Hessian

inline Statistic<StatisticType> &operator=(const StatisticType &rhs)

Assigns a specific value to the gradient and Hessian of this statistic.

Parameters:

rhs – A reference to the value to be assigned

Returns:

A reference to the modified statistic

inline Statistic<StatisticType> &operator+=(const StatisticType &rhs)

Adds a specific value to the gradient and Hessian of this statistic.

Parameters:

rhs – A reference to the value to be added

Returns:

A reference to the modified statistic

inline Statistic<StatisticType> &operator+=(const Statistic<StatisticType> &rhs)

Adds the gradient and Hessian of a given statistic to the gradient and Hessian of this statistic,

Parameters:

rhs – A reference to the statistic, whose gradient and Hessian should be added

Returns:

A reference to the modified statistic

inline Statistic<StatisticType> &operator-=(const StatisticType &rhs)

Subtracts a specific value from the gradient and Hessian of this statistic.

Parameters:

rhs – A reference to the value to be subtracted

Returns:

A reference to the modified statistic

inline Statistic<StatisticType> &operator-=(const Statistic<StatisticType> &rhs)

Subtracts the gradient and Hessian of a given statistic from the gradient and Hessian of this statistic.

Parameters:

rhs – A reference to the statistic, whose gradient and Hessian should be subtracted

Returns:

A reference to the modified statistic

inline Statistic<StatisticType> &operator*=(const StatisticType &rhs)

Multiplies the gradient and Hessian of this statistic with a specific value.

Parameters:

rhs – A reference to the value to be multiplied by

Returns:

A reference to the modified statistic

Public Members

StatisticType gradient

The gradient.

StatisticType hessian

The Hessian.

Friends

inline friend Statistic<StatisticType> operator+(Statistic<StatisticType> lhs, const StatisticType &rhs)

Creates and returns a new statistic that results from adding a specific value to the gradient and Hessian of an existing statistic.

Parameters:
  • lhs – The original statistic

  • rhs – A reference to the value to be added

Returns:

The statistic that has been created

inline friend Statistic<StatisticType> operator+(Statistic<StatisticType> lhs, const Statistic<StatisticType> &rhs)

Creates and returns a new statistic that results from adding the gradient and Hessian of a specific statistic to the gradient and Hessian of an existing statistic.

Parameters:
  • lhs – The original statistic

  • rhs – A reference to the statistic, whose gradient and Hessian should be added

Returns:

The statistic that has been created

inline friend Statistic<StatisticType> operator-(Statistic<StatisticType> lhs, const StatisticType &rhs)

Creates and returns a new statistic that results from subtracting a specific value from the gradient and Hessian of an existing statistic.

Parameters:
  • lhs – The original statistic

  • rhs – A reference to the value to be subtracted

Returns:

The statistic that has been created

inline friend Statistic<StatisticType> operator-(Statistic<StatisticType> lhs, const Statistic<StatisticType> &rhs)

Creates and returns a new statistic that results from subtracting the gradient and Hessian of a specific statistic from the gradient and Hessian of an existing statistic.

Parameters:
  • lhs – The original statistic

  • rhs – A reference to the value to be subtracted

Returns:

The statistic that has been created

inline friend Statistic<StatisticType> operator*(Statistic<StatisticType> lhs, const StatisticType &rhs)

Creates and returns a new statistic that results from multiplying the gradient and Hessian of an existing statistic with a specific value.

Parameters:
  • lhs – The original statistic

  • rhs – A reference to the value to be multiplied by

Returns:

The statistic that has been created