Repository navigation
fix(trxf): compare stored rule sets in classifier equality - #215
Open
Hanabi9248 wants to merge 1 commit into
Open
Hanabi9248 wants to merge 1 commit into
Hanabi9248 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.