File global_pruning_pre.hpp

class IPrePruningConfig
#include <global_pruning_pre.hpp>

Defines an interface for all classes that allow to configure a stopping criterion that stops the induction of rules as soon as the quality of a model’s predictions for the examples in the training or holdout set do not improve according to a certain measure.

This stopping criterion assesses the performance of the current model after every updateInterval rules and stores its quality in a buffer that keeps track of the last numCurrent iterations. If the capacity of this buffer is already reached, the oldest quality is passed to a buffer of size numPast. Every stopInterval rules, it is decided whether the rule induction should be stopped. For this reason, the numCurrent qualities in the first buffer, as well as the numPast qualities in the second buffer are aggregated according to a certain aggregationFunction. If the percentage improvement, which results from comparing the more recent qualities from the first buffer to the older qualities from the second buffer, is greater than a certain minImprovement, the rule induction is continued, otherwise it is stopped.

Subclassed by PrePruningConfig

Public Functions

inline virtual ~IPrePruningConfig()
virtual AggregationFunction getAggregationFunction() const = 0

Returns the type of the aggregation function that is used to aggregate the values that are stored in a buffer.

Returns:

A value of the enum AggregationFunction that specifies the type of the aggregation function that is used to aggregate the values that are stored in a buffer

virtual IPrePruningConfig &setAggregationFunction(AggregationFunction aggregationFunction) = 0

Sets the type of the aggregation function that should be used to aggregate the values that are stored in a buffer.

Parameters:

aggregationFunction – A value of the enum AggregationFunction that specifies the type of the aggregation function that should be used to aggregate the values that are stored in a buffer

Returns:

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

virtual bool isHoldoutSetUsed() const = 0

Returns whether the quality of the current model’s predictions is measured on the holdout set, if available, or if the training set is used instead.

Returns:

True, if the quality of the current model’s predictions is measured on the holdout set, if available, false, if the training set is used instead

virtual IPrePruningConfig &setUseHoldoutSet(bool useHoldoutSet) = 0

Sets whether the quality of the current model’s predictions should be measured on the holdout set, if available, or if the training set should be used instead.

Parameters:

useHoldoutSet – True, if the quality of the current model’s predictions should be measured on the holdout set, if available, false, if the training set should be used instead

Returns:

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

virtual bool isRemoveUnusedRules() const = 0

Returns whether rules that have been induced, but are not used, should be removed from the final model or not.

Returns:

True, if unused rules should be removed from the model, false otherwise

virtual IPrePruningConfig &setRemoveUnusedRules(bool removeUnusedRules) = 0

Sets whether rules that have been induced, but are not used, should be removed from the final model or not.

Parameters:

removeUnusedRules – True, if unused rules should be removed from the model, false otherwise

Returns:

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

virtual uint32 getMinRules() const = 0

Returns the minimum number of rules that must have been learned until the induction of rules might be stopped.

Returns:

The minimum number of rules that must have been learned until the induction of rules might be stopped

virtual IPrePruningConfig &setMinRules(uint32 minRules) = 0

Sets the minimum number of rules that must have been learned until the induction of rules might be stopped.

Parameters:

minRules – The minimum number of rules that must have been learned until the induction of rules might be stopped. Must be at least 1

Returns:

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

virtual uint32 getUpdateInterval() const = 0

Returns the interval that is used to update the quality of the current model.

Returns:

The interval that is used to update the quality of the current model

virtual IPrePruningConfig &setUpdateInterval(uint32 updateInterval) = 0

Sets the interval that should be used to update the quality of the current model.

Parameters:

updateInterval – The interval that should be used to update the quality of the current model, e.g., a value of 5 means that the model quality is assessed every 5 rules. Must be at least 1

Returns:

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

virtual uint32 getStopInterval() const = 0

Returns the interval that is used to decide whether the induction of rules should be stopped.

Returns:

The interval that is used to decide whether the induction of rules should be stopped

virtual IPrePruningConfig &setStopInterval(uint32 stopInterval) = 0

Sets the interval that should be used to decide whether the induction of rules should be stopped.

Parameters:

stopInterval – The interval that should be used to decide whether the induction of rules should be stopped, e.g., a value of 10 means that the rule induction might be stopped after 10, 20, … rules. Must be a multiple of the update interval

Returns:

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

virtual uint32 getNumPast() const = 0

Returns the number of quality stores of past iterations that are stored in a buffer.

Returns:

The number of quality stores of past iterations that are stored in a buffer

virtual IPrePruningConfig &setNumPast(uint32 numPast) = 0

Sets the number of past iterations that should be stored in a buffer.

Parameters:

numPast – The number of past iterations that should be be stored in a buffer. Must be at least 1

Returns:

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

virtual uint32 getNumCurrent() const = 0

Returns the number of the most recent iterations that are stored in a buffer.

Returns:

The number of the most recent iterations that are stored in a buffer

virtual IPrePruningConfig &setNumCurrent(uint32 numCurrent) = 0

Sets the number of the most recent iterations that should be stored in a buffer.

Parameters:

numCurrent – The number of the most recent iterations that should be stored in a buffer. Must be at least 1

Returns:

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

virtual float64 getMinImprovement() const = 0

Returns the minimum improvement that must be reached for the rule induction to be continued.

Returns:

The minimum improvement that must be reached for the rule induction to be continued

virtual IPrePruningConfig &setMinImprovement(float64 minImprovement) = 0

Sets the minimum improvement that must be reached for the rule induction to be continued.

Parameters:

minImprovement – The minimum improvement in percent that must be reached for the rule induction to be continued. Must be in [0, 1]

Returns:

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

class PrePruningConfig : public IGlobalPruningConfig, public IPrePruningConfig
#include <global_pruning_pre.hpp>

Allows to configure a stopping criterion that stops the induction of rules as soon as the quality of a model’s predictions for the examples in the training or holdout set do not improve according to a certain measure.

Public Functions

PrePruningConfig()
virtual AggregationFunction getAggregationFunction() const override

Returns the type of the aggregation function that is used to aggregate the values that are stored in a buffer.

Returns:

A value of the enum AggregationFunction that specifies the type of the aggregation function that is used to aggregate the values that are stored in a buffer

virtual IPrePruningConfig &setAggregationFunction(AggregationFunction aggregationFunction) override

Sets the type of the aggregation function that should be used to aggregate the values that are stored in a buffer.

Parameters:

aggregationFunction – A value of the enum AggregationFunction that specifies the type of the aggregation function that should be used to aggregate the values that are stored in a buffer

Returns:

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

virtual bool isHoldoutSetUsed() const override

Returns whether the quality of the current model’s predictions is measured on the holdout set, if available, or if the training set is used instead.

Returns:

True, if the quality of the current model’s predictions is measured on the holdout set, if available, false, if the training set is used instead

virtual IPrePruningConfig &setUseHoldoutSet(bool useHoldoutSet) override

Sets whether the quality of the current model’s predictions should be measured on the holdout set, if available, or if the training set should be used instead.

Parameters:

useHoldoutSet – True, if the quality of the current model’s predictions should be measured on the holdout set, if available, false, if the training set should be used instead

Returns:

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

virtual bool isRemoveUnusedRules() const override

Returns whether rules that have been induced, but are not used, should be removed from the final model or not.

Returns:

True, if unused rules should be removed from the model, false otherwise

virtual IPrePruningConfig &setRemoveUnusedRules(bool removeUnusedRules) override

Sets whether rules that have been induced, but are not used, should be removed from the final model or not.

Parameters:

removeUnusedRules – True, if unused rules should be removed from the model, false otherwise

Returns:

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

virtual uint32 getMinRules() const override

Returns the minimum number of rules that must have been learned until the induction of rules might be stopped.

Returns:

The minimum number of rules that must have been learned until the induction of rules might be stopped

virtual IPrePruningConfig &setMinRules(uint32 minRules) override

Sets the minimum number of rules that must have been learned until the induction of rules might be stopped.

Parameters:

minRules – The minimum number of rules that must have been learned until the induction of rules might be stopped. Must be at least 1

Returns:

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

virtual uint32 getUpdateInterval() const override

Returns the interval that is used to update the quality of the current model.

Returns:

The interval that is used to update the quality of the current model

virtual IPrePruningConfig &setUpdateInterval(uint32 updateInterval) override

Sets the interval that should be used to update the quality of the current model.

Parameters:

updateInterval – The interval that should be used to update the quality of the current model, e.g., a value of 5 means that the model quality is assessed every 5 rules. Must be at least 1

Returns:

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

virtual uint32 getStopInterval() const override

Returns the interval that is used to decide whether the induction of rules should be stopped.

Returns:

The interval that is used to decide whether the induction of rules should be stopped

virtual IPrePruningConfig &setStopInterval(uint32 stopInterval) override

Sets the interval that should be used to decide whether the induction of rules should be stopped.

Parameters:

stopInterval – The interval that should be used to decide whether the induction of rules should be stopped, e.g., a value of 10 means that the rule induction might be stopped after 10, 20, … rules. Must be a multiple of the update interval

Returns:

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

virtual uint32 getNumPast() const override

Returns the number of quality stores of past iterations that are stored in a buffer.

Returns:

The number of quality stores of past iterations that are stored in a buffer

virtual IPrePruningConfig &setNumPast(uint32 numPast) override

Sets the number of past iterations that should be stored in a buffer.

Parameters:

numPast – The number of past iterations that should be be stored in a buffer. Must be at least 1

Returns:

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

virtual uint32 getNumCurrent() const override

Returns the number of the most recent iterations that are stored in a buffer.

Returns:

The number of the most recent iterations that are stored in a buffer

virtual IPrePruningConfig &setNumCurrent(uint32 numCurrent) override

Sets the number of the most recent iterations that should be stored in a buffer.

Parameters:

numCurrent – The number of the most recent iterations that should be stored in a buffer. Must be at least 1

Returns:

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

virtual float64 getMinImprovement() const override

Returns the minimum improvement that must be reached for the rule induction to be continued.

Returns:

The minimum improvement that must be reached for the rule induction to be continued

virtual IPrePruningConfig &setMinImprovement(float64 minImprovement) override

Sets the minimum improvement that must be reached for the rule induction to be continued.

Parameters:

minImprovement – The minimum improvement in percent that must be reached for the rule induction to be continued. Must be in [0, 1]

Returns:

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

virtual std::unique_ptr<IStoppingCriterionFactory> createStoppingCriterionFactory() const override

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

Returns:

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

virtual bool shouldUseHoldoutSet() const override

virtual bool shouldRemoveUnusedRules() const override

Private Members

AggregationFunction aggregationFunction_
bool useHoldoutSet_
bool removeUnusedRules_
uint32 minRules_
uint32 updateInterval_
uint32 stopInterval_
uint32 numPast_
uint32 numCurrent_
float64 minImprovement_