Repository navigation
Fix genetic counterfactual validation after rounding - #479
Open
ssivitskii wants to merge 1 commit into
Open
ssivitskii wants to merge 1 commit into
ssivitskii wants to merge 1 commit into
Conversation
Signed-off-by: Stepan Sivitskii <175894540+ssivitskii@users.noreply.github.com>
ssivitskii
force-pushed
the
codex/dice-473-validate-rounded-counterfactuals
branch
from
October 31, 2026 14:17
360a04e to
3f65a8e
Compare
This branch has not been deployed
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.
The genetic explainer validates candidates before rounding their features for output. Rounding can move a candidate out of the desired class or range while leaving its recorded outcome unchanged.
Round each candidate's continuous features to the configured precision before its final prediction and validity check. Candidates invalidated by rounding are excluded through the existing filtering behavior, so fewer counterfactuals may be returned (or the existing no-counterfactuals exception raised).
The regression test covers classification and regression, a categorical feature preceding the continuous feature, and both regular and sparse results. It also checks that a retained regression candidate's recorded outcome changes with its rounded features. Both cases fail on the original code and pass with the fix.
Validation on Python 3.12:
explainer_base.pyalso fail on unmodified main; see fix: squeeze regressor scores before scalar assignment for numpy 2.x compat #476.git diff --check: passed.Fixes #473.