File rule_induction_top_down_beam_search.hpp¶
-
class IBeamSearchTopDownRuleInductionConfig¶
- #include <rule_induction_top_down_beam_search.hpp>
Defines an interface for all classes that allow to configure an algorithm for the induction of individual rules that uses a top-down beam search.
Subclassed by BeamSearchTopDownRuleInductionConfig
Public Functions
-
inline virtual ~IBeamSearchTopDownRuleInductionConfig()¶
-
virtual uint32 getBeamWidth() const = 0¶
Returns the width that is used by the beam search.
- Returns:
The width that is used by the beam search
-
virtual IBeamSearchTopDownRuleInductionConfig &setBeamWidth(uint32 beamWidth) = 0¶
Sets the width that should be used by the beam search.
- Parameters:
beamWidth – The width the should be used by the beam search. Must be at least 2
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual bool areFeaturesResampled() const = 0¶
Returns whether a new sample of the available features is created for each rule that is refined during the beam search or not.
- Returns:
True, if a new sample is created for each rule, false otherwise
-
virtual IBeamSearchTopDownRuleInductionConfig &setResampleFeatures(bool resampleFeatures) = 0¶
Sets whether a new sample of the available features should be created for each rule that is refined during the beam search or not.
- Parameters:
resampleFeatures – True, if a new sample should be created for each rule, false otherwise
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual uint32 getMinCoverage() const = 0¶
Returns the minimum number of training examples that must be covered by a rule.
- Returns:
The minimum number of training examples that must be covered by a rule
-
virtual IBeamSearchTopDownRuleInductionConfig &setMinCoverage(uint32 minCoverage) = 0¶
Sets the minimum number of training examples that must be covered by a rule.
- Parameters:
minCoverage – The minimum number of training examples that must be covered by a rule. Must be at least 1
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual float32 getMinSupport() const = 0¶
Returns the minimum support, i.e., the minimum fraction of the training examples that must be covered by a rule.
- Returns:
The minimum support or 0, if the support of rules is not restricted
-
virtual IBeamSearchTopDownRuleInductionConfig &setMinSupport(float32 minSupport) = 0¶
Sets the minimum support, i.e., the minimum fraction of the training examples that must be covered by a rule.
- Parameters:
minSupport – The minimum support. Must be in [0, 1] or 0, if the support of rules should not be restricted
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual uint32 getMaxConditions() const = 0¶
Returns the maximum number of conditions to be included in a rule’s body.
- Returns:
The maximum number of conditions to be included in a rule’s body or 0, if the number of conditions is not restricted
-
virtual IBeamSearchTopDownRuleInductionConfig &setMaxConditions(uint32 maxConditions) = 0¶
Sets the maximum number of conditions to be included in a rule’s body.
- Parameters:
maxConditions – The maximum number of conditions to be included in a rule’s body. Must be at least 2 or 0, if the number of conditions should not be restricted
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual uint32 getMaxHeadRefinements() const = 0¶
Returns the maximum number of times, the head of a rule may be refinement after a new condition has been added to its body.
- Returns:
The maximum number of times, the head of a rule may be refined or 0, if the number of refinements is not restricted
-
virtual IBeamSearchTopDownRuleInductionConfig &setMaxHeadRefinements(uint32 maxHeadRefinements) = 0¶
Sets the maximum number of times, the head of a rule may be refined after a new condition has been added to its body.
- Parameters:
maxHeadRefinements – The maximum number of times, the head of a rule may be refined. Must be at least 1 or 0, if the number of refinements should not be restricted
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual bool arePredictionsRecalculated() const = 0¶
Returns whether the predictions of rules are recalculated on all training examples, if some of the examples have zero weights, or not.
- Returns:
True, if the predictions of rules are recalculated on all training examples, false otherwise
-
virtual IBeamSearchTopDownRuleInductionConfig &setRecalculatePredictions(bool recalculatePredictions) = 0¶
Sets whether the predictions of rules should be recalculated on all training examples, if some of the examples have zero weights, or not.
- Parameters:
recalculatePredictions – True, if the predictions of rules should be recalculated on all training examples, false otherwise
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
inline virtual ~IBeamSearchTopDownRuleInductionConfig()¶
-
class BeamSearchTopDownRuleInductionConfig : public IRuleInductionConfig, public IBeamSearchTopDownRuleInductionConfig¶
- #include <rule_induction_top_down_beam_search.hpp>
Allows to configure an algorithm for the induction of individual rules that uses a top-down beam search.
Public Functions
-
BeamSearchTopDownRuleInductionConfig(RuleCompareFunction ruleCompareFunction, const std::unique_ptr<IMultiThreadingConfig> &multiThreadingConfigPtr)¶
- Parameters:
ruleCompareFunction – An object of type
RuleCompareFunction
that defines the function that should be used for comparing the quality of different rulesmultiThreadingConfigPtr – A reference to an unique pointer that stores the configuration of the multi-threading behavior that should be used for the parallel refinement of rules
-
virtual uint32 getBeamWidth() const override¶
Returns the width that is used by the beam search.
- Returns:
The width that is used by the beam search
-
virtual IBeamSearchTopDownRuleInductionConfig &setBeamWidth(uint32 beamWidth) override¶
Sets the width that should be used by the beam search.
- Parameters:
beamWidth – The width the should be used by the beam search. Must be at least 2
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual bool areFeaturesResampled() const override¶
Returns whether a new sample of the available features is created for each rule that is refined during the beam search or not.
- Returns:
True, if a new sample is created for each rule, false otherwise
-
virtual IBeamSearchTopDownRuleInductionConfig &setResampleFeatures(bool resampleFeatures) override¶
Sets whether a new sample of the available features should be created for each rule that is refined during the beam search or not.
- Parameters:
resampleFeatures – True, if a new sample should be created for each rule, false otherwise
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual uint32 getMinCoverage() const override¶
Returns the minimum number of training examples that must be covered by a rule.
- Returns:
The minimum number of training examples that must be covered by a rule
-
virtual IBeamSearchTopDownRuleInductionConfig &setMinCoverage(uint32 minCoverage) override¶
Sets the minimum number of training examples that must be covered by a rule.
- Parameters:
minCoverage – The minimum number of training examples that must be covered by a rule. Must be at least 1
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual float32 getMinSupport() const override¶
Returns the minimum support, i.e., the minimum fraction of the training examples that must be covered by a rule.
- Returns:
The minimum support or 0, if the support of rules is not restricted
-
virtual IBeamSearchTopDownRuleInductionConfig &setMinSupport(float32 minSupport) override¶
Sets the minimum support, i.e., the minimum fraction of the training examples that must be covered by a rule.
- Parameters:
minSupport – The minimum support. Must be in [0, 1] or 0, if the support of rules should not be restricted
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual uint32 getMaxConditions() const override¶
Returns the maximum number of conditions to be included in a rule’s body.
- Returns:
The maximum number of conditions to be included in a rule’s body or 0, if the number of conditions is not restricted
-
virtual IBeamSearchTopDownRuleInductionConfig &setMaxConditions(uint32 maxConditions) override¶
Sets the maximum number of conditions to be included in a rule’s body.
- Parameters:
maxConditions – The maximum number of conditions to be included in a rule’s body. Must be at least 2 or 0, if the number of conditions should not be restricted
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual uint32 getMaxHeadRefinements() const override¶
Returns the maximum number of times, the head of a rule may be refinement after a new condition has been added to its body.
- Returns:
The maximum number of times, the head of a rule may be refined or 0, if the number of refinements is not restricted
-
virtual IBeamSearchTopDownRuleInductionConfig &setMaxHeadRefinements(uint32 maxHeadRefinements) override¶
Sets the maximum number of times, the head of a rule may be refined after a new condition has been added to its body.
- Parameters:
maxHeadRefinements – The maximum number of times, the head of a rule may be refined. Must be at least 1 or 0, if the number of refinements should not be restricted
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual bool arePredictionsRecalculated() const override¶
Returns whether the predictions of rules are recalculated on all training examples, if some of the examples have zero weights, or not.
- Returns:
True, if the predictions of rules are recalculated on all training examples, false otherwise
-
virtual IBeamSearchTopDownRuleInductionConfig &setRecalculatePredictions(bool recalculatePredictions) override¶
Sets whether the predictions of rules should be recalculated on all training examples, if some of the examples have zero weights, or not.
- Parameters:
recalculatePredictions – True, if the predictions of rules should be recalculated on all training examples, false otherwise
- Returns:
A reference to an object of type
IBeamSearchTopDownRuleInductionConfig
that allows further configuration of the algorithm for the induction of individual rules
-
virtual std::unique_ptr<IRuleInductionFactory> createRuleInductionFactory(const IFeatureMatrix &featureMatrix, const ILabelMatrix &labelMatrix) const override¶
Creates and returns a new object of type
IRuleInductionFactory
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
IRuleInductionFactory
that has been created
Private Members
-
const RuleCompareFunction ruleCompareFunction_¶
-
bool resampleFeatures_¶
-
bool recalculatePredictions_¶
-
const std::unique_ptr<IMultiThreadingConfig> &multiThreadingConfigPtr_¶
-
BeamSearchTopDownRuleInductionConfig(RuleCompareFunction ruleCompareFunction, const std::unique_ptr<IMultiThreadingConfig> &multiThreadingConfigPtr)¶