File label_binning_equal_width.hpp

namespace boosting
class IEqualWidthLabelBinningConfig
#include <label_binning_equal_width.hpp>

Defines an interface for all classes that allow to configure a method that assigns labels to bins in a way such that each bin contains labels for which the predicted score is expected to belong to the same value range.

Subclassed by boosting::EqualWidthLabelBinningConfig

Public Functions

inline virtual ~IEqualWidthLabelBinningConfig()
virtual float32 getBinRatio() const = 0

Returns the percentage that specifies how many bins are used.

Returns:

The percentage that specifies how many bins are used

virtual IEqualWidthLabelBinningConfig &setBinRatio(float32 binRatio) = 0

Sets the percentage that specifies how many should be used.

Parameters:

binRatio – A percentage that specifies how many bins should be used, e.g., if 100 labels are available, a percentage of 0.5 means that ceil(0.5 * 100) = 50 bins should be used. Must be in (0, 1)

Returns:

A reference to an object of type EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

virtual uint32 getMinBins() const = 0

Returns the minimum number of bins that is used.

Returns:

The minimum number of bins that is used

virtual IEqualWidthLabelBinningConfig &setMinBins(uint32 minBins) = 0

Sets the minimum number of bins that should be used.

Parameters:

minBins – The minimum number of bins that should be used. Must be at least 1

Returns:

A reference to an object of type EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

virtual uint32 getMaxBins() const = 0

Returns the maximum number of bins that is used.

Returns:

The maximum number of bins that is used

virtual IEqualWidthLabelBinningConfig &setMaxBins(uint32 maxBins) = 0

Sets the maximum number of bins that should be used.

Parameters:

maxBins – The maximum number of bins that should be used. Must be at least the minimum number of bins or 0, if the maximum number of bins should not be restricted

Returns:

A reference to an object of type EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

class EqualWidthLabelBinningConfig : public boosting::ILabelBinningConfig, public boosting::IEqualWidthLabelBinningConfig
#include <label_binning_equal_width.hpp>

Allows to configure a method that assigns labels to bins in a way such that each bin contains labels for which the predicted score is expected to belong to the same value range.

Public Functions

EqualWidthLabelBinningConfig(const std::unique_ptr<IRegularizationConfig> &l1RegularizationConfigPtr, const std::unique_ptr<IRegularizationConfig> &l2RegularizationConfigPtr)
Parameters:
  • l1RegularizationConfigPtr – A reference to an unique pointer that stores the configuration of the L1 regularization

  • l2RegularizationConfigPtr – A reference to an unique pointer that stores the configuration of the L2 regularization

virtual float32 getBinRatio() const override

Returns the percentage that specifies how many bins are used.

Returns:

The percentage that specifies how many bins are used

virtual IEqualWidthLabelBinningConfig &setBinRatio(float32 binRatio) override

Sets the percentage that specifies how many should be used.

Parameters:

binRatio – A percentage that specifies how many bins should be used, e.g., if 100 labels are available, a percentage of 0.5 means that ceil(0.5 * 100) = 50 bins should be used. Must be in (0, 1)

Returns:

A reference to an object of type EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

virtual uint32 getMinBins() const override

Returns the minimum number of bins that is used.

Returns:

The minimum number of bins that is used

virtual IEqualWidthLabelBinningConfig &setMinBins(uint32 minBins) override

Sets the minimum number of bins that should be used.

Parameters:

minBins – The minimum number of bins that should be used. Must be at least 1

Returns:

A reference to an object of type EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

virtual uint32 getMaxBins() const override

Returns the maximum number of bins that is used.

Returns:

The maximum number of bins that is used

virtual IEqualWidthLabelBinningConfig &setMaxBins(uint32 maxBins) override

Sets the maximum number of bins that should be used.

Parameters:

maxBins – The maximum number of bins that should be used. Must be at least the minimum number of bins or 0, if the maximum number of bins should not be restricted

Returns:

A reference to an object of type EqualWidthLabelBinningConfig that allows further configuration of the method that assigns labels to bins

virtual std::unique_ptr<ILabelWiseRuleEvaluationFactory> createLabelWiseCompleteRuleEvaluationFactory() const override

Creates and returns a new object of type ILabelWiseRuleEvaluationFactory that allows to calculate the predictions of complete rules according to the specified configuration.

Returns:

An unique pointer to an object of type ILabelWiseRuleEvaluationFactory that has been created

virtual std::unique_ptr<ISparseLabelWiseRuleEvaluationFactory> createLabelWiseFixedPartialRuleEvaluationFactory(float32 labelRatio, uint32 minLabels, uint32 maxLabels) const override

Creates and returns a new object of type ISparseLabelWiseRuleEvaluationFactory that allows to calculate the prediction of partial rules, which predict for a predefined number of labels, according to the specified configuration.

Parameters:
  • labelRatio – A percentage that specifies for how many labels the rule heads should predict

  • minLabels – The minimum number of labels for which the rule heads should predict

  • maxLabels – The maximum number of labels for which the rule heads should predict

Returns:

An unique pointer to an object of type ISparseLabelWiseRuleEvaluationFactory that has been created

virtual std::unique_ptr<ISparseLabelWiseRuleEvaluationFactory> createLabelWiseDynamicPartialRuleEvaluationFactory(float32 threshold, float32 exponent) const override

Creates and returns a new object of type ISparseLabelWiseRuleEvaluationFactory that allows to calculate the prediction of partial rules, which predict for a subset of the available labels that is determined dynamically, according to the specified configuration.

Parameters:
  • threshold – A threshold that affects for how many labels the rule heads should predict

  • exponent – An exponent that is used to weigh the estimated predictive quality for individual labels

Returns:

An unique pointer to an object of type ISparseLabelWiseRuleEvaluationFactory that has been created

virtual std::unique_ptr<IExampleWiseRuleEvaluationFactory> createExampleWiseCompleteRuleEvaluationFactory(const Blas &blas, const Lapack &lapack) const override

Creates and returns a new object of type IExampleWiseRuleEvaluationFactory that allows to calculate the predictions of complete rules according to the specified configuration.

Parameters:
  • blas – A reference to an object of type Blas that allows to execute BLAS routines

  • lapack – A reference to an object of type Lapack that allows to execute LAPACK routines

Returns:

An unique pointer to an object of type IExampleWiseRuleEvaluationFactory that has been created

virtual std::unique_ptr<IExampleWiseRuleEvaluationFactory> createExampleWiseFixedPartialRuleEvaluationFactory(float32 labelRatio, uint32 minLabels, uint32 maxLabels, const Blas &blas, const Lapack &lapack) const override

Creates and returns a new object of type IExampleWiseRuleEvaluationFactory that allows to calculate the predictions of partial rules, which predict for a predefined number of labels, according to the specified configuration.

Parameters:
  • labelRatio – A percentage that specifies for how many labels the rule heads should predict

  • minLabels – The minimum number of labels for which the rule heads should predict

  • maxLabels – The maximum number of labels for which the rule heads should predict

  • blas – A reference to an object of type Blas that allows to execute BLAS routines

  • lapack – A reference to an object of type Lapack that allows to execute LAPACK routines

Returns:

An unique pointer to an object of type IExampleWiseRuleEvaluationFactory that has been created

virtual std::unique_ptr<IExampleWiseRuleEvaluationFactory> createExampleWiseDynamicPartialRuleEvaluationFactory(float32 threshold, float32 exponent, const Blas &blas, const Lapack &lapack) const override

Creates and returns a new object of type IExampleWiseRuleEvaluationFactory that allows to calculate the predictions of partial rules, which predict for a subset of the available labels that is determined dynamically, according to the specified configuration.

Parameters:
  • threshold – A threshold that affects for how many labels the rule heads should predict

  • exponent – An exponent that is used to weigh the estimated predictive quality for individual labels

  • blas – A reference to an object of type Blas that allows to execute BLAS routines

  • lapack – A reference to an object of type Lapack that allows to execute LAPACK routines

Returns:

An unique pointer to an object of type IExampleWiseRuleEvaluationFactory that has been created

Private Members

float32 binRatio_
uint32 minBins_
uint32 maxBins_
const std::unique_ptr<IRegularizationConfig> &l1RegularizationConfigPtr_
const std::unique_ptr<IRegularizationConfig> &l2RegularizationConfigPtr_