Skip to content

fix(datasets): preserve the sample axis when standardizing one row - #585

Open
Hanabi9248 wants to merge 1 commit into
Trusted-AI:mainfrom
Hanabi9248:codex/standardize-single-sample-oct26
Open

Hanabi9248 wants to merge 1 commit into
Trusted-AI:mainfrom
Hanabi9248:codex/standardize-single-sample-oct26

Conversation

@Hanabi9248

Copy link
Copy Markdown

standardize_dataset collapses both singleton axes when extracting targets. For a one-row DataFrame with one target, y becomes a scalar and assigning its sample index raises AttributeError. With multiple targets it becomes a Series indexed by target names and assigning the one-row protected index raises a length mismatch.

Limit squeeze to the columns axis. Single-target results remain Series, multiple-target results remain DataFrames, and the sample axis is retained. This does not change target values, weights, column selection or missing-value policy.

Validation on main 3487791, using Python 3.11.16 with real pandas/NumPy/sklearn and complete package initializers (no mocks):

  • Added regression: 13 methods. Baseline has 11 affected methods with 13 error events (including three dtype subcases), plus two passing zero-/multi-row controls. Candidate passes all 13.
  • Cases cover target values/types, an external target Series, column/array weights, feature selection, multiple protected attributes, missing values and real LinearRegression.fit(**train._asdict()) handoff.
  • The one-row multiple-target case uses the existing dropna=False path; other multiple-target filtering combinations are outside this fix.
  • Exact source and added-test bytes checked; added-line whitespace checks pass. CPU1/768MiB/16 processes/private temporary files/single-threaded BLAS; peak whole-job memory 123449344 bytes; no dependencies installed.

Run: python tests/test_standardize_single_sample.py -v

The full repository, existing dataset suite, online dataset downloads, other Python/pandas versions and Linux were not run. This is independent of legacy BinaryLabelDataset #193 and the OpenMLStore refactor. AI assistance was used for preparation/review; the 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