File feature_sampling.hpp

class IFeatureSampling
#include <feature_sampling.hpp>

Defines an interface for all classes that implement a method for sampling features.

Subclassed by PredefinedFeatureSampling

Public Functions

inline virtual ~IFeatureSampling()
virtual const IIndexVector &sample(RNG &rng) = 0

Creates and returns a sample of the available features.

Parameters:

rng – A reference to an object of type RNG, implementing the random number generator to be used

Returns:

A reference to an object of type IIndexVector that provides access to the indices of the features that are contained in the sample

virtual std::unique_ptr<IFeatureSampling> createBeamSearchFeatureSampling(RNG &rng, bool resample) = 0

Creates and returns a new object of type IFeatureSampling that is suited for use during a beam search.

Parameters:
  • rng – A reference to an object of type RNG, implementing the random number generator be used

  • resample – True, if a new sample of the available features should be created whenever the sampling method is invoked during the beam search, false otherwise

Returns:

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

class IFeatureSamplingFactory
#include <feature_sampling.hpp>

Defines an interface for all factories that allow to create instances of the type IFeatureSampling.

Public Functions

inline virtual ~IFeatureSamplingFactory()
virtual std::unique_ptr<IFeatureSampling> create() const = 0

Creates and returns a new object of type IFeatureSampling.

Returns:

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

class IFeatureSamplingConfig
#include <feature_sampling.hpp>

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

Subclassed by FeatureSamplingWithoutReplacementConfig, NoFeatureSamplingConfig

Public Functions

inline virtual ~IFeatureSamplingConfig()
virtual std::unique_ptr<IFeatureSamplingFactory> createFeatureSamplingFactory(const IFeatureMatrix &featureMatrix) const = 0

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 = 0

Returns whether feature sampling is used or not.

Returns:

True, if feature sampling is used, false otherwise