Skip to content

MNT: clarify fitted-state check in adversarial mitigation - #1673

Merged
romanlutz merged 4 commits into
fairlearn:mainfrom
DresdenGman:fix-adversarial-fitted-state-check
Aug 17, 2026
Merged

romanlutz merged 4 commits into
fairlearn:mainfrom
DresdenGman:fix-adversarial-fitted-state-check

Conversation

@DresdenGman

Copy link
Copy Markdown
Contributor

Resolves #1657 by replacing the try/except NotFittedError fit-state probe in _AdversarialFairness._validate_input with a direct hasattr(self, 'backendEngine_') check.

This keeps the existing behavior intact while removing the stale # TODO check this and avoiding the ambiguity of probing fit state through an exception path.

Tests: 288 passed (targeted adversarial tests, python -m pytest test/unit/adversarial -q)

romanlutz and others added 2 commits July 10, 2026 19:58
Point the fitted-state probe in _AdversarialFairness._validate_input at
_is_setup, the class's canonical fitted flag (see __sklearn_is_fitted__),
matching the original check_is_fitted semantics, and fix the string quotes
to satisfy black/ruff. Add a v0.15.0 changelog entry for the change.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 94f7b737-5a80-4f4a-8853-ac7994305bcd

@riedgar-ms riedgar-ms left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

…ted-state-check

# Conflicts:
#	docs/user_guide/installation_and_version_guide/v0.15.0.rst
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.

MNT Re-examine the check_is_fitted try/except pattern in _AdversarialFairness._validate_input

3 participants