Rule

class pyruleanalyzer.Rule(name, class_, conditions, leaf_value=None, learning_rate=None, class_group=None, class_distribution=None)

Represents a complete ruleset (path from root to leaf) in a decision tree.

This class is not designed to be operated directly, but by instead using the main RuleClassifier class.

name

Name of the rule (e.g., “DT1_Rule36_Class0”).

Type:

str

class_

Class that the rule assigns to matching instances.

Type:

str

conditions

List of condition strings (like “v2 > 0.5”).

Type:

List[str]

usage_count

Number of times the rule matched during classification.

Type:

int

error_count

Number of times the rule matched but the prediction was wrong.

Type:

int

parsed_conditions

Cached parsed conditions for faster access.

Type:

List[Tuple[str, str, float]]