File feature_sampling_without_replacement.hpp

class IFeatureSamplingWithoutReplacementConfig
#include <feature_sampling_without_replacement.hpp>

Defines an interface for all classes that allow to configure a method for sampling features without replacement.

Subclassed by FeatureSamplingWithoutReplacementConfig

Public Functions

inline virtual ~IFeatureSamplingWithoutReplacementConfig()
virtual float32 getSampleSize() const = 0

Returns the fraction of features that are included in a sample.

Returns:

The fraction of features that are included in a sample

virtual IFeatureSamplingWithoutReplacementConfig &setSampleSize(float32 sampleSize) = 0

Sets the fraction of features that should be included in a sample.

Parameters:

sampleSize – The fraction of features that should be included in a sample, e.g., a value of 0.6 corresponds to 60 % of the available features. Must be in (0, 1) or 0, if the default sample size floor(log2(numFeatures - 1) + 1) should be used

Returns:

A reference to an object of type IFeatureSamplingWithoutReplacementConfig that allows further configuration of the method for sampling features

virtual uint32 getNumRetained() const = 0

Returns the number of trailing features that are always included in a sample.

Returns:

The number of trailing features that are always included in a sample

virtual IFeatureSamplingWithoutReplacementConfig &setNumRetained(uint32 numRetained) = 0

Sets the number fo trailing features that should always be included in a sample.

Parameters:

numRetained – The number of trailing features that should always be included in a sample. Must be at least 0

Returns:

A reference to an object of type IFeatureSamplingWithoutReplacementConfig that allows further configuration of the method for sampling features

class FeatureSamplingWithoutReplacementConfig : public IFeatureSamplingConfig, public IFeatureSamplingWithoutReplacementConfig
#include <feature_sampling_without_replacement.hpp>

Allows to configure a method for sampling features without replacement.

Public Functions

FeatureSamplingWithoutReplacementConfig()
virtual float32 getSampleSize() const override

Returns the fraction of features that are included in a sample.

Returns:

The fraction of features that are included in a sample

virtual IFeatureSamplingWithoutReplacementConfig &setSampleSize(float32 sampleSize) override

Sets the fraction of features that should be included in a sample.

Parameters:

sampleSize – The fraction of features that should be included in a sample, e.g., a value of 0.6 corresponds to 60 % of the available features. Must be in (0, 1) or 0, if the default sample size floor(log2(numFeatures - 1) + 1) should be used

Returns:

A reference to an object of type IFeatureSamplingWithoutReplacementConfig that allows further configuration of the method for sampling features

virtual uint32 getNumRetained() const override

Returns the number of trailing features that are always included in a sample.

Returns:

The number of trailing features that are always included in a sample

virtual IFeatureSamplingWithoutReplacementConfig &setNumRetained(uint32 numRetained) override

Sets the number fo trailing features that should always be included in a sample.

Parameters:

numRetained – The number of trailing features that should always be included in a sample. Must be at least 0

Returns:

A reference to an object of type IFeatureSamplingWithoutReplacementConfig that allows further configuration of the method for sampling features

virtual std::unique_ptr<IFeatureSamplingFactory> createFeatureSamplingFactory(const IFeatureMatrix &featureMatrix) const override

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

Parameters:

featureMatrix – A reference to an object of type IFeatureMatrix that provides access to the features of the training examples

Returns:

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

virtual bool isSamplingUsed() const override

Returns whether feature sampling is used or not.

Returns:

True, if feature sampling is used, false otherwise

Private Members

float32 sampleSize_
uint32 numRetained_