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
[MRG] Avoid uncessary copies in sklearn.preprocessing #13987
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Looks like in these specific cases inplace
would have been a more descriptive parameter name than copy
, and might have prevented this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Does this need a whats_new entry as an enhancement or a bug fix? |
Thanks for the reviews! Added a what's new. |
|
Thank you @rth! |
Partially addresses #13986
This removes the
copy=True
in the fit method ofStandardScaler
,MinMaxScaler
,MaxAbsScaler
,RobustScaler
where it is typically not necessary to compute the scaling factors.In practice, this makes
StandardScaler().fit_transform
10%-20% faster on the few examples I have tried.If that copy was necessary and this mistakenly removed it
check_transformer_general(.., readonly_memmap=True)
would fail in common tests.