API reference — Rule-Set Models¶
Quinlan C4.5 / C5.0 rule extraction, condition interval simplification, and pessimistic error rate pruning.
RuleModel¶
class RuleModel(kind: 'str' = 'c50', *, max_depth: 'int' = 6, min_rows: 'int' = 5, prune: 'bool' = True, cf: 'float' = 0.25) -> 'None'
Unified Rule-Set Extraction and Pruning Model.
Extracts, simplifies, and prunes transparent modular IF-THEN rules from decision trees using Quinlan's pessimistic error bound.
Parameters¶
kind : str, default="c50"
Rule mining family: "c50", "c45", or "tree".
max_depth : int, default=6
Maximum tree depth for the underlying decision tree.
min_rows : int, default=5
Minimum leaf samples per rule.
prune : bool, default=True
Whether to greedily prune rule preconditions using pessimistic error bounds.
cf : float, default=0.25
Quinlan's confidence factor CF for pessimistic pruning (default 0.25).
RuleModel.config¶
Return effective configuration dictionary.
RuleModel.fit¶
fit(self, x: 'Sequence[Sequence[Any]] | _CoreModelTree', y: 'Sequence[float] | None' = None) -> 'RuleModel'
Fit rule set on training data (X, y) or extract rules from an existing tree.
RuleModel.from_bytes¶
RuleModel.from_json¶
Restore fitted model from versioned JSON string.
RuleModel.load¶
RuleModel.predict¶
Predict target using the extracted rule set.
RuleModel.save¶
RuleModel.to_bytes¶
RuleModel.to_json¶
Return fitted model snapshot as JSON string.
RuleModel.default_confidence_¶
Confidence of the default fallback rule.
RuleModel.default_prediction_¶
Fallback prediction when no rule fires.
RuleModel.report¶
Return the structured ModelReport.
RuleModel.rules_¶
Extracted IF-THEN rules.
RuleResult¶
class RuleResult(rules: 'list[str]', predictions: 'list[float]', default_prediction: 'float', default_confidence: 'float', report: 'ModelReport') -> None
Fitted rule-set inference outputs.
RuleSet¶
An ordered set of IF-THEN rules with fallback default prediction.
RuleSet.predict¶
Rule¶
An individual IF-THEN rule extracted from a ModelTree.