Skip to content

fix(transformer): align sklearn feature-name contract - #98

Merged
alisadeghiaghili merged 8 commits into
mainfrom
test/sklearn-transformer-contracts
Sep 1, 2026
Merged

alisadeghiaghili merged 8 commits into
mainfrom
test/sklearn-transformer-contracts

Conversation

@alisadeghiaghili

Copy link
Copy Markdown
Owner

Summary

  • Makes MissinglyImputer.get_feature_names_out() conform to the sklearn transformer contract by returning a one-dimensional object numpy.ndarray in fit-time order.
  • Adds public regression coverage for feature-name dtype/values and sklearn.clone, verifying cloned estimators retain constructor parameters but no fitted state.
  • Replaces nullable fitted-state assumptions with typed, explicit invariants for strategy-specific sklearn imputers, PMM training data, and tree model dictionaries; targeted transformer mypy is now zero-error without ignores or suppressions.
  • Repairs the stale strategy-validation doctest with a deterministic semantic assertion.

Coverage integrity

Official main baseline: 92.61% (3798/4101), with 303 uncovered lines. This PR changes no coverage threshold, omission, exclusion, pragma, or denominator configuration. The Python 3.12 CI artifact will determine the exact delta.

Verification

  • Passed: 51 transformer tests.
  • Passed: full Ruff, zero-error targeted mypy for transformer.py, installed-module transformer doctests (26 passed), diff-check, and changed-lines <= 88 columns.

Risk

get_feature_names_out() changes from a Python list to sklearn's standard ndarray output. Values and fit-time order remain unchanged. Other changes make impossible fitted-state corruption fail explicitly instead of leaking nullable/object internals.

Refs #78
Refs #60
Refs #69

@alisadeghiaghili
alisadeghiaghili merged commit 4b86ea4 into main Sep 1, 2026
10 checks passed
@alisadeghiaghili
alisadeghiaghili deleted the test/sklearn-transformer-contracts branch September 1, 2026 09:00
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