File learner.hpp

namespace seco
class ISeCoRuleLearner : public virtual IRuleLearner
#include <learner.hpp>

Defines an interface for all rule learners that make use of the separate-and-conquer (SeCo) paradigm.

Subclassed by seco::AbstractSeCoRuleLearner, seco::IMultiLabelSeCoRuleLearner

Public Functions

inline virtual ~ISeCoRuleLearner() override
class IAccuracyHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Accuracy” heuristic for learning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IAccuracyHeuristicMixin() override
inline virtual void useAccuracyHeuristic()

Configures the rule learner to use the “Accuracy” heuristic for learning rules.

class IAccuracyPruningHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Accuracy” heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IAccuracyPruningHeuristicMixin() override
inline virtual void useAccuracyPruningHeuristic()

Configures the rule learner to use the “Accuracy” heuristic for pruning rules.

class IConfig : public virtual IRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner that makes use of the separate-and-conquer (SeCo) paradigm.

Subclassed by seco::AbstractSeCoRuleLearner::Config, seco::IMultiLabelSeCoRuleLearner::IConfig, seco::ISeCoRuleLearner::IAccuracyHeuristicMixin, seco::ISeCoRuleLearner::IAccuracyPruningHeuristicMixin, seco::ISeCoRuleLearner::ICoverageStoppingCriterionMixin, seco::ISeCoRuleLearner::IFMeasureHeuristicMixin, seco::ISeCoRuleLearner::IFMeasurePruningHeuristicMixin, seco::ISeCoRuleLearner::IKlnLiftFunctionMixin, seco::ISeCoRuleLearner::ILabelWiseBinaryPredictionMixin, seco::ISeCoRuleLearner::ILaplaceHeuristicMixin, seco::ISeCoRuleLearner::ILaplacePruningHeuristicMixin, seco::ISeCoRuleLearner::IMEstimateHeuristicMixin, seco::ISeCoRuleLearner::IMEstimatePruningHeuristicMixin, seco::ISeCoRuleLearner::INoCoverageStoppingCriterionMixin, seco::ISeCoRuleLearner::INoLiftFunctionMixin, seco::ISeCoRuleLearner::IPartialHeadMixin, seco::ISeCoRuleLearner::IPeakLiftFunctionMixin, seco::ISeCoRuleLearner::IPrecisionHeuristicMixin, seco::ISeCoRuleLearner::IPrecisionPruningHeuristicMixin, seco::ISeCoRuleLearner::IRecallHeuristicMixin, seco::ISeCoRuleLearner::IRecallPruningHeuristicMixin, seco::ISeCoRuleLearner::ISingleLabelHeadMixin, seco::ISeCoRuleLearner::IWraHeuristicMixin, seco::ISeCoRuleLearner::IWraPruningHeuristicMixin

Public Functions

inline virtual ~IConfig() override

Protected Functions

virtual std::unique_ptr<CoverageStoppingCriterionConfig> &getCoverageStoppingCriterionConfigPtr() = 0

Returns an unique pointer to the configuration of the stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold.

Returns:

A reference to an unique pointer of type CoverageStoppingCriterionConfig that stores the configuration of the stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold or a null pointer, if no such stopping criterion should be used

virtual std::unique_ptr<IHeadConfig> &getHeadConfigPtr() = 0

Returns an unique pointer to the configuration of the rule heads that should be induced by the rule learner.

Returns:

A reference to an unique pointer of type IHeadConfig that stores the configuration of the rule heads

virtual std::unique_ptr<IHeuristicConfig> &getHeuristicConfigPtr() = 0

Returns an unique pointer to the configuration of the heuristic for learning rules.

Returns:

A reference to an unique pointer of type IHeuristicConfig that stores the configuration of the heuristic for learning rules

virtual std::unique_ptr<IHeuristicConfig> &getPruningHeuristicConfigPtr() = 0

Returns an unique pointer to the configuration of the heuristic for pruning rules.

Returns:

A reference to an unique pointer of type IHeuristicConfig that stores the configuration of the heuristic for pruning rules

virtual std::unique_ptr<ILiftFunctionConfig> &getLiftFunctionConfigPtr() = 0

Returns an unique pointer to the configuration of the lift function that affects the quality of rules, depending on the number of labels for which they predict.

Returns:

A reference to an unique pointer of type ILiftFunctionConfig that stores the configuration of the lift function that affects the quality of rules, depending on the number of labels for which they predict

Friends

friend class AbstractSeCoRuleLearner
class ICoverageStoppingCriterionMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use a stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~ICoverageStoppingCriterionMixin() override
inline virtual ICoverageStoppingCriterionConfig &useCoverageStoppingCriterion()

Configures the rule learner to use a stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold.

Returns:

A reference to an object of type ICoverageStoppingCriterionConfig that allows further configuration of the stopping criterion

class IFMeasureHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “F-Measure” heuristic for learning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IFMeasureHeuristicMixin() override
inline virtual IFMeasureConfig &useFMeasureHeuristic()

Configures the rule learner to use the “F-Measure” heuristic for learning rules.

Returns:

A reference to an object of type IFMeasureConfig that allows further configuration of the heuristic

class IFMeasurePruningHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “F-Measure” heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IFMeasurePruningHeuristicMixin() override
inline virtual IFMeasureConfig &useFMeasurePruningHeuristic()

Configures the rule learner to use the “F-Measure” heuristic for pruning rules.

Returns:

A reference to an object of type IFMeasureConfig that allows further configuration of the heuristic

class IKlnLiftFunctionMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use a lift function that monotonously increases according to the natural logarithm of the number of labels for which a rule predicts.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IKlnLiftFunctionMixin() override
inline virtual IKlnLiftFunctionConfig &useKlnLiftFunction()

Configures the rule learner to use a lift function that monotonously increases according to the natural logarithm of the number of labels for which a rule predicts.

Returns:

A reference to an object of type IKlnLiftFunctionConfig that allows further configuration of the lift function

class ILabelWiseBinaryPredictionMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use a predictor for predicting whether individual labels of given query examples are relevant or irrelevant by processing rules of an existing rule-based model in the order they have been learned. If a rule covers an example, its prediction is applied to each label individually.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~ILabelWiseBinaryPredictionMixin() override
inline virtual void useLabelWiseBinaryPredictor()

Configures the rule learner to use a predictor for predicting whether individual labels of given query examples are relevant or irrelevant by processing rules of an existing rule-based model in the order they have been learned. If a rule covers an example, its prediction is applied to each label individually.

class ILaplaceHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Laplace” heuristic for learning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~ILaplaceHeuristicMixin() override
inline virtual void useLaplaceHeuristic()

Configures the rule learner to use the “Laplace” heuristic for learning rules.

class ILaplacePruningHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Laplace” heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~ILaplacePruningHeuristicMixin() override
inline virtual void useLaplacePruningHeuristic()

Configures the rule learner to use the “Laplace” heuristic for pruning rules.

class IMEstimateHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “M-Estimate” heuristic for learning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IMEstimateHeuristicMixin() override
inline virtual IMEstimateConfig &useMEstimateHeuristic()

Configures the rule learner to use the “M-Estimate” heuristic for learning rules.

Returns:

A reference to an object of type IMEstimateConfig that allows further configuration of the heuristic

class IMEstimatePruningHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “M-Estimate” heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IMEstimatePruningHeuristicMixin() override
inline virtual IMEstimateConfig &useMEstimatePruningHeuristic()

Configures the rule learner to use the “M-Estimate” heuristic for pruning rules.

Returns:

A reference to an object of type IMEstimateConfig that allows further configuration of the heuristic

class INoCoverageStoppingCriterionMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to not use any stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~INoCoverageStoppingCriterionMixin() override
inline virtual void useNoCoverageStoppingCriterion()

Configures the rule learner to not use any stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold.

class INoLiftFunctionMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to not use a lift function.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~INoLiftFunctionMixin() override
inline virtual void useNoLiftFunction()

Configures the rule learner to not use a lift function.

class IPartialHeadMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to induce rules with partial heads.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IPartialHeadMixin() override
inline virtual void usePartialHeads()

Configures the rule learner to induce rules with partial heads that predict for a subset of the available labels.

class IPeakLiftFunctionMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use a lift function that monotonously increases until a certain number of labels, where the maximum lift is reached, and monotonously decreases afterwards.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IPeakLiftFunctionMixin() override
inline virtual IPeakLiftFunctionConfig &usePeakLiftFunction()

Configures the rule learner to use a lift function that monotonously increases until a certain number of labels, where the maximum lift is reached, and monotonously decreases afterwards.

Returns:

A reference to an object of type IPeakLiftFunctionConfig that allows further configuration of the lift function

class IPrecisionHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Precision” heuristic for learning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IPrecisionHeuristicMixin() override
inline virtual void usePrecisionHeuristic()

Configures the rule learner to use the “Precision” heuristic for learning rules.

class IPrecisionPruningHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Precision” heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IPrecisionPruningHeuristicMixin() override
inline virtual void usePrecisionPruningHeuristic()

Configures the rule learner to use the “Precision” heuristic for pruning rules.

class IRecallHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Recall” heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IRecallHeuristicMixin() override
inline virtual void useRecallHeuristic()

Configures the rule learner to use the “Recall” heuristic for learning rules.

class IRecallPruningHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Recall” heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IRecallPruningHeuristicMixin() override
inline virtual void useRecallPruningHeuristic()

Configures the rule learner to use the “Recall” heuristic for pruning rules.

class ISingleLabelHeadMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to induce rules with single-label heads that predict for a single label.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~ISingleLabelHeadMixin() override
inline virtual void useSingleLabelHeads()

Configures the rule learner to induce rules with single-label heads that predict for a single label.

class IWraHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Weighted Relative

Accuracy” (WRA) heuristic for learning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IWraHeuristicMixin() override
inline virtual void useWraHeuristic()

Configures the rule learner to use the “Weighted Relative Accuracy” (WRA) heuristic for learning rules.

class IWraPruningHeuristicMixin : public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Defines an interface for all classes that allow to configure a rule learner to use the “Weighted Relative

Accuracy” (WRA) heuristic for pruning rules.

Subclassed by seco::IMultiLabelSeCoRuleLearner::IConfig

Public Functions

inline virtual ~IWraPruningHeuristicMixin() override
inline virtual void useWraPruningHeuristic()

Configures the rule learner to use the “Weighted Relative Accuracy” (WRA) heuristic for pruning rules.

class AbstractSeCoRuleLearner : public AbstractRuleLearner, public virtual seco::ISeCoRuleLearner
#include <learner.hpp>

An abstract base class for all rule learners that make use of the separate-and-conquer (SeCo) paradigm.

Subclassed by seco::MultiLabelSeCoRuleLearner

Public Functions

AbstractSeCoRuleLearner(ISeCoRuleLearner::IConfig &config)
Parameters:

config – A reference to an object of type ISeCoRuleLearner::IConfig that specifies the configuration that should be used by the rule learner

Protected Functions

void createStoppingCriterionFactories(StoppingCriterionListFactory &factory) const override

See also

AbstractRuleLearner::createStoppingCriterionFactories

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

See also

AbstractRuleLearner::createStatisticsProviderFactory

std::unique_ptr<IModelBuilderFactory> createModelBuilderFactory() const override

See also

AbstractRuleLearner::createModelBuilderFactory

std::unique_ptr<ISparseBinaryPredictorFactory> createSparseBinaryPredictorFactory(const IRowWiseFeatureMatrix &featureMatrix, uint32 numLabels) const override

See also

AbstractRuleLearner::createSparseBinaryPredictorFactory

Private Functions

std::unique_ptr<IStoppingCriterionFactory> createCoverageStoppingCriterionFactory() const

Private Members

ISeCoRuleLearner::IConfig &config_
class Config : public AbstractRuleLearner::Config, public virtual seco::ISeCoRuleLearner::IConfig
#include <learner.hpp>

Allows to configure a rule learner that makes use of the separate-and-conquer (SeCo) paradigm.

Subclassed by seco::MultiLabelSeCoRuleLearner::Config

Public Functions

Config()

Protected Attributes

std::unique_ptr<CoverageStoppingCriterionConfig> coverageStoppingCriterionConfigPtr_

An unique pointer that stores the configuration of the stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold.

std::unique_ptr<IHeadConfig> headConfigPtr_

An unique pointer that stores the configuration of the rule heads.

std::unique_ptr<IHeuristicConfig> heuristicConfigPtr_

An unique pointer that stores the configuration of the heuristic that is used for learning rules.

std::unique_ptr<IHeuristicConfig> pruningHeuristicConfigPtr_

An unique pointer that stores the configuration of the heuristic that is used for pruning rules.

std::unique_ptr<ILiftFunctionConfig> liftFunctionConfigPtr_

An unique pointer that stores the configuration of the lift function that affects the quality of rules, depending on the number of labels for which they predict.

Private Functions

virtual std::unique_ptr<CoverageStoppingCriterionConfig> &getCoverageStoppingCriterionConfigPtr() final override

Returns an unique pointer to the configuration of the stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold.

Returns:

A reference to an unique pointer of type CoverageStoppingCriterionConfig that stores the configuration of the stopping criterion that stops the induction of rules as soon as the sum of the weights of the uncovered labels is smaller or equal to a certain threshold or a null pointer, if no such stopping criterion should be used

virtual std::unique_ptr<IHeadConfig> &getHeadConfigPtr() final override

Returns an unique pointer to the configuration of the rule heads that should be induced by the rule learner.

Returns:

A reference to an unique pointer of type IHeadConfig that stores the configuration of the rule heads

virtual std::unique_ptr<IHeuristicConfig> &getHeuristicConfigPtr() final override

Returns an unique pointer to the configuration of the heuristic for learning rules.

Returns:

A reference to an unique pointer of type IHeuristicConfig that stores the configuration of the heuristic for learning rules

virtual std::unique_ptr<IHeuristicConfig> &getPruningHeuristicConfigPtr() final override

Returns an unique pointer to the configuration of the heuristic for pruning rules.

Returns:

A reference to an unique pointer of type IHeuristicConfig that stores the configuration of the heuristic for pruning rules

virtual std::unique_ptr<ILiftFunctionConfig> &getLiftFunctionConfigPtr() final override

Returns an unique pointer to the configuration of the lift function that affects the quality of rules, depending on the number of labels for which they predict.

Returns:

A reference to an unique pointer of type ILiftFunctionConfig that stores the configuration of the lift function that affects the quality of rules, depending on the number of labels for which they predict