File feature_binning_equal_frequency.hpp

class IEqualFrequencyFeatureBinningConfig
#include <feature_binning_equal_frequency.hpp>

Defines an interface for all classes that allow to configure a method that assigns numerical feature values to bins, such that each bins contains approximately the same number of values.

Subclassed by EqualFrequencyFeatureBinningConfig

Public Functions

inline virtual ~IEqualFrequencyFeatureBinningConfig()
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 IEqualFrequencyFeatureBinningConfig &setBinRatio(float32 binRatio) = 0

Sets the percentage that specifies how many bins should be used.

Parameters:

binRatio – The percentage that specifies how many bins should be used, e.g., if 100 values 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 IEqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values 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 IEqualFrequencyFeatureBinningConfig &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 2

Returns:

A reference to an object of type IEqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values 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 IEqualFrequencyFeatureBinningConfig &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 IEqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins

class EqualFrequencyFeatureBinningConfig : public IFeatureBinningConfig, public IEqualFrequencyFeatureBinningConfig
#include <feature_binning_equal_frequency.hpp>

Allows to configure a method that assigns numerical feature values to bins, such that each bins contains approximately the same number of values.

Public Functions

EqualFrequencyFeatureBinningConfig()
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 IEqualFrequencyFeatureBinningConfig &setBinRatio(float32 binRatio) override

Sets the percentage that specifies how many bins should be used.

Parameters:

binRatio – The percentage that specifies how many bins should be used, e.g., if 100 values 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 IEqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values 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 IEqualFrequencyFeatureBinningConfig &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 2

Returns:

A reference to an object of type IEqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values 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 IEqualFrequencyFeatureBinningConfig &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 IEqualFrequencyFeatureBinningConfig that allows further configuration of the method that assigns numerical feature values to bins

virtual std::unique_ptr<IFeatureBinningFactory> createFeatureBinningFactory(const IFeatureMatrix &featureMatrix, const ILabelMatrix &labelMatrix) const override

Creates and returns a new object of type IFeatureBinningFactory 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 ILabelMatrix that provides access to the labels of the training examples

Returns:

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

Private Members

float32 binRatio_
uint32 minBins_
uint32 maxBins_