Skip to content

fix(trxf): compare stored rule sets in classifier equality - #215

Open
Hanabi9248 wants to merge 1 commit into
Trusted-AI:masterfrom
Hanabi9248:codex/trxf-classifier-equality-oct25
Open

Hanabi9248 wants to merge 1 commit into
Trusted-AI:masterfrom
Hanabi9248:codex/trxf-classifier-equality-oct25

Conversation

@Hanabi9248

Copy link
Copy Markdown

RuleSetClassifier.eq reads other.rule_sets, but the class only initializes _rule_sets and defines no rule_sets property. Even classifier == classifier raises AttributeError. Read the existing stored field on both sides, preserving the ordered ruleset-list/default-label comparison; no new property, copying, prediction changes or comparison fields are added.

Add eight regressions using actual TRXF Feature, Predicate, Conjunction, DnfRuleSet and RuleSetClassifier components. On master 0ce916f the baseline has seven AttributeErrors and one passing core/FIRST_HIT control; with the one-line fix all eight pass. Cases cover reflexivity, independently constructed equal classifiers, different predicates/conclusions/defaults, outer ruleset order and empty lists. Real package initializers and pandas/numpy/sklearn imports execute; no comparisons or predictions are mocked.

Validated on Python 3.11.16 under CPU1/768MiB/16 processes/private temporary files/single-threaded BLAS, with no dependency installation. Final source and test bytes were checked; whitespace checks found no added-line errors. Run from a checkout: python tests/rule_induction/trxf/classifier/test_classifier_equality.py -v

The full repository, model-training integrations, Python 3.10 and other Python versions were not run. This leaves #214's independent firing-rule fix, existing cross-class behavior and the original two-field equality policy unchanged. AI assistance was used to prepare/review this patch; the results are actual local executions.

Use the initialized private field on both sides of the existing
ruleset/default-label comparison.

Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant