Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT add inverse_transform parameter to _SetOutputMixin.set_output #30376

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

SuccessMoses
Copy link

Fixes #27843 (see also #27891 and #23734)

This PR adds a new feature to _SetOutputMixin that makes it possible for wrap inverse_transform method in sub classes and transform the output.

from sklearn.preprocessing import StandardScaler
from sklearn.datasets import load_breast_cancer

X, _ = load_breast_cancer(return_X_y=True, as_frame=True)

scaler = StandardScaler()

scaler.set_output(
	transform="pandas", inverse_transform="pandas"
)
scaler.fit(X)
Xt = scaler.transform(X)

print(scaler.inverse_transform(Xt))

Copy link

github-actions bot commented Nov 29, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: fe951b9. Link to the linter CI: here

@SuccessMoses
Copy link
Author

@thomasjpfan please, can you review this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

set_output doesn't work for inverse_transform method
1 participant