Skip to content

Fix StandardScaler.fit_transform - #96

Merged
gdefe merged 1 commit into
pyc-team:devfrom
RoniLeor:fix/standard-scaler-fit-transform
Nov 15, 2026
Merged

gdefe merged 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.

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gdefe
gdefe merged commit 1395100 into pyc-team:dev Nov 15, 2026
3 checks passed
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.

2 participants