DTAnalyzer

class pyruleanalyzer.DTAnalyzer(classifier: RuleClassifier)

Decision-Tree-specific rule analysis and comparison.

This class extracts the DT analysis pipeline out of RuleClassifier and adds redundancy breakdown tracking so the output shows:

  • intra_tree – boundary-redundant sibling pairs merged

  • low_usage – rules removed because of low classification count

classifier

The underlying RuleClassifier instance.

redundancy_counts

Dict mapping redundancy type to count.

compare_initial_final_results(file_path: str = None, X=None, y=None) None

Compares performance of initial vs final rules for a Decision Tree.

Parameters:
  • file_path – Path to the CSV test file.

  • X – Dataframe or array for test data.

  • y – True labels.

Returns:

None

execute_rule_refinement(file_path: str = None, X=None, y=None, remove_below_n_classifications: int = -1, save_final_model: bool = True, save_report: bool = True) None

Evaluates DT rules on a dataset, detects redundancies, and refines.

Parameters:
  • file_path – Path to the CSV test file.

  • X – Dataframe or array for test data.

  • y – True labels.

  • remove_below_n_classifications – Threshold for low-usage refinement (-1 disables).

  • save_final_model – Whether to save the final model.

  • save_report – Whether to save the analysis report.

Returns:

None

print_redundancy_summary() None

Prints the redundancy breakdown and rule reduction summary.

Returns:

None

track_intra_tree_from_duplicates(duplicated_rules_pairs: list) None

Updates the intra_tree counter from duplicate-pair detection.

Parameters:

duplicated_rules_pairs – List of (rule1, rule2) tuples.

Returns:

None