-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] DOC Clarify RobustScaler behavior with sparse input #8858
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -909,9 +909,9 @@ class RobustScaler(BaseEstimator, TransformerMixin): | |
and the 3rd quartile (75th quantile). | ||
|
||
Centering and scaling happen independently on each feature (or each | ||
sample, depending on the `axis` argument) by computing the relevant | ||
sample, depending on the ``axis`` argument) by computing the relevant | ||
statistics on the samples in the training set. Median and interquartile | ||
range are then stored to be used on later data using the `transform` | ||
range are then stored to be used on later data using the ``transform`` | ||
method. | ||
|
||
Standardization of a dataset is a common requirement for many | ||
|
@@ -928,7 +928,7 @@ class RobustScaler(BaseEstimator, TransformerMixin): | |
---------- | ||
with_centering : boolean, True by default | ||
If True, center the data before scaling. | ||
This does not work (and will raise an exception) when attempted on | ||
This will cause ``transform`` to raise an exception when attempted on | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, |
||
sparse matrices, because centering them entails building a dense | ||
matrix which in common use cases is likely to be too large to fit in | ||
memory. | ||
|
@@ -1023,11 +1023,14 @@ def fit(self, X, y=None): | |
return self | ||
|
||
def transform(self, X): | ||
"""Center and scale the data | ||
"""Center and scale the data. | ||
|
||
Can be called on sparse input, provided that ``RobustScaler`` has been | ||
fitted to dense input and ``with_centering=False``. | ||
|
||
Parameters | ||
---------- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The type description for X here site mention sparse There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
X : array-like | ||
X : {array-like, sparse matrix} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jnothman if I read your feedback correctly, does this address the comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Sorry for the autocorrect typo. |
||
The data used to scale along the specified axis. | ||
""" | ||
if self.with_centering: | ||
|
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.
Ah that was the typo, good catch