mlrl.common.cython.post_optimization module

@author: Michael Rapp (michael.rapp.ml@gmail.com)

class mlrl.common.cython.post_optimization.SequentialPostOptimizationConfig

Bases: object

Allows to configure a method that optimizes each rule in a model by relearning it in the context of the other rules. Multiple iterations, where the rules in a model are relearned in the order of their induction, may be carried out.

are_features_resampled() bool

Returns whether a new sample of the available features is created whenever a new rule is refined or not.

Returns:

True, if a new sample of the available features is created whenever a new rule is refined, false, if the conditions of the new rule use the same features as the original rule

are_heads_refined() bool

Returns whether the heads of rules are refined when being relearned or not.

Returns:

True, if the heads of rules are refined when being relearned, False otherwise

get_num_iterations() int

Returns the number of iterations that are performed for optimizing a model.

Returns:

The number of iterations that are performed for optimizing a model

set_num_iterations(num_iterations: int) SequentialPostOptimizationConfig

Sets the number of iterations that should be performed for optimizing a model.

Parameters:

num_iterations – The number of iterations to be performed. Must be at least 1

Returns:

An SequentialPostOptimizationConfig that allows further configuration of the optimization method

set_refine_heads(refine_heads: bool) SequentialPostOptimizationConfig

Sets whether the heads of rules should be refined when being relearned or not.

Parameters:

refine_heads – True, if the heads of rules should be refined when being relearned, False otherwise

Returns:

An SequentialPostOptimizationConfig that allows further configuration of the optimization method

set_resample_features(resample_features: bool) SequentialPostOptimizationConfig

Sets whether a new sample of the available features should be created whenever a new rule is refined or not.

Parameters:

resample_features – True, if a new sample of the available features should be created whenever a new rule is refined, false, if the conditions of the new rule should use the same features as the original rule

Returns:

An SequentialPostOptimizationConfig that allows further configuration of the optimization method