Rules

Contains classes representing rules and rulesets.

class rulekit.rules.BaseRule(java_object)

Base class representing single rule.

get_covering_information() dict

Returns information about rule covering

Returns:

covering_data – Dictionary containing covering information.

Return type:

dict

print_stats()

Prints rule statistics as formatted text.

property pvalue: float

Rule significance.

property stats: RuleStatistics

Rule statistics.

property weight: float

Rule weight

property weighted_N: float

Number of negatives in the training set (accounting weights).

property weighted_P: float

Number of positives in the training set (accounting weights).

property weighted_n: float

Number of negatives covered by the rule (accounting weights).

property weighted_p: float

Number of positives covered by the rule (accounting weights).

class rulekit.rules.ClassificationRule(java_object)

Class representing classification rule

property decision_class: str

Decision class of the rule

class rulekit.rules.InductionParameters(java_object)

Induction parameters.

property induction_measure: Measures | str

Returns: Union[Measures, str]: Measure used for induction

property pruning_measure: Measures | str

Returns: Union[Measures, str]: Measure used for pruning

property voting_measure: Measures | str

Returns: Union[Measures, str]: Measure used for voting

class rulekit.rules.RegressionRule(java_object)

Class representing regression rule

property conclusion_value: float

Value from the rule’s conclusion

class rulekit.rules.RuleSet(java_object)

Class representing ruleset.

calculate_avg_rule_coverage() float
Returns:

count – Average rule coverage.

Return type:

float

calculate_avg_rule_precision() float
Returns:

count – Average rule precision.

Return type:

float

calculate_avg_rule_quality() float
Returns:

count – Average rule quality.

Return type:

float

calculate_conditions_count() float
Returns:

count – Number of conditions.

Return type:

float

calculate_induced_conditions_count() float
Returns:

count – Number of induced conditions.

Return type:

float

calculate_significance(alpha: float) dict
Parameters:

alpha (float) –

Returns:

count – Significance of the rule set.

Return type:

float

calculate_significance_fdr(alpha: float) dict
Returns:

count – Significance of the rule set with false discovery rate correction. Dictionary contains two fields: fraction (fraction of rules significant at assumed level) and p (average p-value of all rules).

Return type:

dict

calculate_significance_fwer(alpha: float) dict
Returns:

count – Significance of the rule set with familiy-wise error rate correction. Dictionary contains two fields: fraction (fraction of rules significant at assumed level) and p (average p-value of all rules).

Return type:

dict

property growing_time: float

Time of growing in seconds

property is_voting: bool

Value indicating whether rules are voting.

property parameters: object

Parameters used during rule set induction.

property pruning_time: float

Time of pruning in seconds

property rules: list[T]

List of rules objects.

property stats: RuleSetStatistics

Rule set statistics.

property total_time: float

Time of constructing the rule set in seconds

class rulekit.rules.SurvivalRule(java_object)

Class representing survival rule

property kaplan_meier_estimator: KaplanMeierEstimator

Kaplan-Meier estimator from the rule concslusion