File head_type_partial_fixed.hpp

namespace boosting
class IFixedPartialHeadConfig
#include <head_type_partial_fixed.hpp>

Defines an interface for all classes that allow to configure partial rule heads that predict for a predefined number of labels.

Subclassed by boosting::FixedPartialHeadConfig

Public Functions

inline virtual ~IFixedPartialHeadConfig()
virtual float32 getLabelRatio() const = 0

Returns the percentage that specifies for how many labels the rule heads predict.

Returns:

The percentage that specifies for how many labels the rule heads predict or 0, if the percentage is calculated based on the average label cardinality

virtual IFixedPartialHeadConfig &setLabelRatio(float32 labelRatio) = 0

Sets the percentage that specifies for how many labels the rule heads should predict.

Parameters:

labelRatio – A percentage that specifies for how many labels the rule heads should predict, e.g., if 100 labels are available, a percentage of 0.5 means that the rule heads predict for a subset of ceil(0.5 * 100) = 50 labels. Must be in (0, 1) or 0, if the percentage should be calculated based on the average label cardinality

Returns:

A reference to an object of type IFixedPartialHeadConfig that allows further configuration of the rule heads

virtual uint32 getMinLabels() const = 0

Returns the minimum number of labels for which the rule heads predict.

Returns:

The minimum number of labels for which the rule heads predict

virtual IFixedPartialHeadConfig &setMinLabels(uint32 minLabels) = 0

Sets the minimum number of labels for which the rule heads should predict.

Parameters:

minLabels – The minimum number of labels for which the rule heads should predict. Must be at least 2

Returns:

A reference to an object of type IFixedPartialHeadConfig that allows further configuration of the rule heads

virtual uint32 getMaxLabels() const = 0

Returns the maximum number of labels for which the rule heads predict.

Returns:

The maximum number of labels for which the rule heads predict

virtual IFixedPartialHeadConfig &setMaxLabels(uint32 maxLabels) = 0

Sets the maximum number of labels for which the rule heads should predict.

Parameters:

maxLabels – The maximum number of labels for which the rule heads should predict. Must be at least the minimum number of labels or 0, if the maximum number of labels should not be restricted

Returns:

A reference to an object of type IFixedPartialHeadConfig that allows further configuration of the rule heads

class FixedPartialHeadConfig : public boosting::IHeadConfig, public boosting::IFixedPartialHeadConfig
#include <head_type_partial_fixed.hpp>

Allows to configure partial rule heads that predict for a predefined number of labels.

Public Functions

FixedPartialHeadConfig(const std::unique_ptr<ILabelBinningConfig> &labelBinningConfigPtr, const std::unique_ptr<IMultiThreadingConfig> &multiThreadingConfigPtr)
Parameters:
  • labelBinningConfigPtr – A reference to an unique pointer that stores the configuration of the method for assigning labels to bins

  • multiThreadingConfigPtr – A reference to an unique pointer that stores the configuration of the multi-threading behavior that should be used for the parallel update of statistics

virtual float32 getLabelRatio() const override

Returns the percentage that specifies for how many labels the rule heads predict.

Returns:

The percentage that specifies for how many labels the rule heads predict or 0, if the percentage is calculated based on the average label cardinality

virtual IFixedPartialHeadConfig &setLabelRatio(float32 labelRatio) override

Sets the percentage that specifies for how many labels the rule heads should predict.

Parameters:

labelRatio – A percentage that specifies for how many labels the rule heads should predict, e.g., if 100 labels are available, a percentage of 0.5 means that the rule heads predict for a subset of ceil(0.5 * 100) = 50 labels. Must be in (0, 1) or 0, if the percentage should be calculated based on the average label cardinality

Returns:

A reference to an object of type IFixedPartialHeadConfig that allows further configuration of the rule heads

virtual uint32 getMinLabels() const override

Returns the minimum number of labels for which the rule heads predict.

Returns:

The minimum number of labels for which the rule heads predict

virtual IFixedPartialHeadConfig &setMinLabels(uint32 minLabels) override

Sets the minimum number of labels for which the rule heads should predict.

Parameters:

minLabels – The minimum number of labels for which the rule heads should predict. Must be at least 2

Returns:

A reference to an object of type IFixedPartialHeadConfig that allows further configuration of the rule heads

virtual uint32 getMaxLabels() const override

Returns the maximum number of labels for which the rule heads predict.

Returns:

The maximum number of labels for which the rule heads predict

virtual IFixedPartialHeadConfig &setMaxLabels(uint32 maxLabels) override

Sets the maximum number of labels for which the rule heads should predict.

Parameters:

maxLabels – The maximum number of labels for which the rule heads should predict. Must be at least the minimum number of labels or 0, if the maximum number of labels should not be restricted

Returns:

A reference to an object of type IFixedPartialHeadConfig that allows further configuration of the rule heads

virtual std::unique_ptr<IStatisticsProviderFactory> createStatisticsProviderFactory(const IFeatureMatrix &featureMatrix, const IRowWiseLabelMatrix &labelMatrix, const ILabelWiseLossConfig &lossConfig) const override

Creates and returns a new object of type IStatisticsProviderFactory according to the specified configuration.

Parameters:
  • featureMatrix – A reference to an object of type IFeatureMatrix that provides access to the feature values of the training examples

  • labelMatrix – A reference to an object of type IRowWiseLabelMatrix that provides access to the labels of the training examples

  • lossConfig – A reference to an object of type ILabelWiseLossConfig that specifies the configuration of the loss function

Returns:

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

virtual std::unique_ptr<IStatisticsProviderFactory> createStatisticsProviderFactory(const IFeatureMatrix &featureMatrix, const IRowWiseLabelMatrix &labelMatrix, const ISparseLabelWiseLossConfig &lossConfig) const override

Creates and returns a new object of type IStatisticsProviderFactory according to the specified configuration.

Parameters:
  • featureMatrix – A reference to an object of type IFeatureMatrix that provides access to the feature values of the training examples

  • labelMatrix – A reference to an object of type IRowWiseLabelMatrix that provides access to the labels of the training examples

  • lossConfig – A reference to an object of type ISparseLabelWiseLossConfig that specifies the configuration of the loss function

Returns:

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

virtual std::unique_ptr<IStatisticsProviderFactory> createStatisticsProviderFactory(const IFeatureMatrix &featureMatrix, const IRowWiseLabelMatrix &labelMatrix, const IExampleWiseLossConfig &lossConfig, const Blas &blas, const Lapack &lapack) const override

Creates and returns a new object of type IStatisticsProviderFactory according to the specified configuration.

Parameters:
  • featureMatrix – A reference to an object of type IFeatureMatrix that provides access to the feature values of the training examples

  • labelMatrix – A reference to an object of type IRowWiseLabelMatrix that provides access to the labels of the training examples

  • lossConfig – A reference to an object of type IExampleWiseLossConfig that specifies the configuration of the loss function

  • 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 IStatisticsProviderFactory that has been created

virtual bool isPartial() const override

Returns, whether the heads of rules are partial, i.e., they predict for a subset of the available labels, or not.

Returns:

True, if the heads of rules are partial, false otherwise

virtual bool isSingleLabel() const override

Returns whether the rule heads predict for a single label or not.

Returns:

True, if the rule heads predict for a single label, false otherwise

Private Members

float32 labelRatio_
uint32 minLabels_
uint32 maxLabels_
const std::unique_ptr<ILabelBinningConfig> &labelBinningConfigPtr_
const std::unique_ptr<IMultiThreadingConfig> &multiThreadingConfigPtr_