File global_pruning_post.hpp

class IPostPruningConfig
#include <global_pruning_post.hpp>

Defines an interface for all classes that allow to configure a stopping criterion that keeps track of the number of rules in a model that perform best with respect to the examples in the training or holdout set according to a certain measure.

This stopping criterion assesses the performance of the current model after every interval rules and stores and checks whether the current model is the best one evaluated so far.

Subclassed by PostPruningConfig

Public Functions

inline virtual ~IPostPruningConfig()
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 IPostPruningConfig &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 IPostPruningConfig 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 IPostPruningConfig &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 IPostPruningConfig that allows further configuration of the stopping criterion

virtual uint32 getMinRules() const = 0

Returns the minimum number of rules that must be included in a model.

Returns:

The minimum number of rules that must be included in a model

virtual IPostPruningConfig &setMinRules(uint32 minRules) = 0

Sets the minimum number of rules that must be included in a model.

Parameters:

minRules – The minimum number of rules that must be included in a model. Must be at least 1

Returns:

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

virtual uint32 getInterval() const = 0

Returns the interval that is used to check whether the current model is the best one evaluated so far.

Returns:

The interval that is used to check whether the current model is the best one evaluated so far

virtual IPostPruningConfig &setInterval(uint32 interval) = 0

Sets the interval that should be used to check whether the current model is the best one evaluated so far.

Parameters:

interval – The interval that should be used to check whether the current model is the best one evaluated so far, e.g., a value of 10 means that the best model may include 10, 20, … rules

Returns:

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

class PostPruningConfig : public IGlobalPruningConfig, public IPostPruningConfig
#include <global_pruning_post.hpp>

Allows to configure a stopping criterion the keeps track of the number of rules in a model that perform best with respect to the examples in the training or holdout set according to a certain measure.

Public Functions

PostPruningConfig()
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 IPostPruningConfig &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 IPostPruningConfig 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 IPostPruningConfig &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 IPostPruningConfig that allows further configuration of the stopping criterion

virtual uint32 getMinRules() const override

Returns the minimum number of rules that must be included in a model.

Returns:

The minimum number of rules that must be included in a model

virtual IPostPruningConfig &setMinRules(uint32 minRules) override

Sets the minimum number of rules that must be included in a model.

Parameters:

minRules – The minimum number of rules that must be included in a model. Must be at least 1

Returns:

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

virtual uint32 getInterval() const override

Returns the interval that is used to check whether the current model is the best one evaluated so far.

Returns:

The interval that is used to check whether the current model is the best one evaluated so far

virtual IPostPruningConfig &setInterval(uint32 interval) override

Sets the interval that should be used to check whether the current model is the best one evaluated so far.

Parameters:

interval – The interval that should be used to check whether the current model is the best one evaluated so far, e.g., a value of 10 means that the best model may include 10, 20, … rules

Returns:

A reference to an object of type IPostPruningConfig 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

bool useHoldoutSet_
bool removeUnusedRules_
uint32 minRules_
uint32 interval_