Skip to content

Fix genetic counterfactual validation after rounding - #479

Open
ssivitskii wants to merge 1 commit into
interpretml:mainfrom
ssivitskii:codex/dice-473-validate-rounded-counterfactuals
Open

ssivitskii wants to merge 1 commit into
interpretml:mainfrom
ssivitskii:codex/dice-473-validate-rounded-counterfactuals

Conversation

@ssivitskii

Copy link
Copy Markdown

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:

Fixes #473.

Signed-off-by: Stepan Sivitskii <175894540+ssivitskii@users.noreply.github.com>
@ssivitskii
ssivitskii force-pushed the codex/dice-473-validate-rounded-counterfactuals branch from 360a04e to 3f65a8e Compare October 31, 2026 14:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

round_to_precision method destroys validity

1 participant