Skip to content

Fix StandardScaler.fit_transform - #95

Closed
RoniLeor wants to merge 1 commit into
pyc-team:devfrom
RoniLeor:fix/standard-scaler-fit-transform
Closed

RoniLeor wants to merge 1 commit into
pyc-team:devfrom
RoniLeor:fix/standard-scaler-fit-transform

Conversation

@RoniLeor

@RoniLeor RoniLeor commented Nov 4, 2026

Copy link
Copy Markdown

StandardScaler().fit_transform(x) raises a TypeError: the inherited method passes dim to fit(), but StandardScaler.fit() does not accept it.

This adds a fit_transform() override that uses the configured axis by default. Both methods accept an explicit dim for a single fit without changing axis.

Added 12 regression cases for axis selection, float32/float64, inverse transforms, and invalid dimensions. All 12 fail on the previous code.

Checked locally with Python 3.11.15 and PyTorch 2.15.0:

  • 140 tests passed across the scaler, scaler-module, and data-module test files.
  • Both examples in the StandardScaler docstrings passed.

The data tests were run by explicit file path because the default pytest options skip tests/data.

@RoniLeor RoniLeor closed this Nov 4, 2026
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