File feature_binning_equal_width.hpp¶
-
class IEqualWidthFeatureBinningConfig¶
- #include <feature_binning_equal_width.hpp>
Defines an interface for all classes that allow to configure a method that assigns numerical feature values to bins, such that each bin contains values from equally sized value ranges.
Subclassed by EqualWidthFeatureBinningConfig
Public Functions
-
inline virtual ~IEqualWidthFeatureBinningConfig()¶
-
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 IEqualWidthFeatureBinningConfig &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
IEqualWidthFeatureBinningConfig
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 IEqualWidthFeatureBinningConfig &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
IEqualWidthFeatureBinningConfig
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 IEqualWidthFeatureBinningConfig &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
IEqualWidthFeatureBinningConfig
that allows further configuration of the method that assigns numerical feature values to bins
-
inline virtual ~IEqualWidthFeatureBinningConfig()¶
-
class EqualWidthFeatureBinningConfig : public IFeatureBinningConfig, public IEqualWidthFeatureBinningConfig¶
- #include <feature_binning_equal_width.hpp>
Allows to configure a method that assigns numerical feature values to bins, such that each bin contains values from equally sized value ranges.
Public Functions
-
EqualWidthFeatureBinningConfig()¶
-
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 IEqualWidthFeatureBinningConfig &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
IEqualWidthFeatureBinningConfig
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 IEqualWidthFeatureBinningConfig &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
IEqualWidthFeatureBinningConfig
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 IEqualWidthFeatureBinningConfig &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
IEqualWidthFeatureBinningConfig
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 exampleslabelMatrix – 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
-
EqualWidthFeatureBinningConfig()¶