Skip to content

fix(postprocessing): retain label metadata for array feature fitting - #587

Open
Hanabi9248 wants to merge 1 commit into
Trusted-AI:mainfrom
Hanabi9248:codex/postprocessing-array-fit-oct26
Open

Hanabi9248 wants to merge 1 commit into
Trusted-AI:mainfrom
Hanabi9248:codex/postprocessing-array-fit-oct26

Conversation

@Hanabi9248

Copy link
Copy Markdown

PostProcessingMeta.fit documents array-like features and a pandas Series target, but reads X.index (or X_post.index) after real estimator fitting. With ndarray features and protected attributes in the required target Series index, it raises AttributeError before the postprocessor can fit.

Preserve the existing feature index for DataFrames; otherwise use the corresponding target Series index in both prefit and split fit paths. No feature conversion/copy, prediction-input expansion, group inference, class mapping or calibration-policy change.

Actual validation against main 3487791:

  • Final regression: six methods. Baseline has four ndarray AttributeErrors and two passing DataFrame controls; candidate passes all six.
  • Complete package initializers and real LogisticRegression -> PostProcessingMeta -> CalibratedEqualizedOdds fit/predict_proba execute on 96 deterministic offline rows, including weights, shuffled splits and protected MultiIndex metadata. Actual fitted classes/groups/base rates/mix rates/probabilities match equivalent DataFrame runs, and ndarray input is unchanged.
  • A transparent fit observer records indices then calls the complete original postprocessor; no estimator probabilities, mix rates or fairness algorithm is stubbed.
  • Initial test observer mistakenly named its positional target argument labels, colliding with the existing labels keyword. That first run failed and was retained; renaming the observer argument fixed the test, with no production change, then baseline and candidate were both rerun.
  • Python 3.11.16; CPU1/768MiB/16 processes/private temporary files/single-threaded BLAS; peak whole-job memory 402354176 bytes. No dependencies installed; complete package imports include the existing TensorFlow installation, while unavailable optional inFairness/OT emit warnings. Added-line whitespace checks pass.

Run: python tests/test_postprocessing_meta_array_fit.py -v

Full repository, Adult/download fixtures, other estimators and Python/sklearn versions were not run. Direct postprocessor predict* DataFrame requirements remain unchanged. This does not change the already-correct binary probability-column/label mapping. AI assistance was used for preparation/review; reported test results are actual local executions.

Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
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