Skip to content

Commit be8169a

Browse files
KunjParikhthomasjpfan
authored andcommitted
DOC Update docs for StandardScaler.scale_ to include 0 variance (scikit-learn#19124)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent 9b89d96 commit be8169a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sklearn/preprocessing/_data.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,11 @@ class StandardScaler(TransformerMixin, BaseEstimator):
617617
Attributes
618618
----------
619619
scale_ : ndarray of shape (n_features,) or None
620-
Per feature relative scaling of the data. This is calculated using
621-
`np.sqrt(var_)`. Equal to ``None`` when ``with_std=False``.
620+
Per feature relative scaling of the data to achieve zero mean and unit
621+
variance. Generally this is calculated using `np.sqrt(var_)`. If a
622+
variance is zero, we can't achieve unit variance, and the data is left
623+
as-is, giving a scaling factor of 1. `scale_` is equal to `None`
624+
when `with_std=False`.
622625
623626
.. versionadded:: 0.17
624627
*scale_*

0 commit comments

Comments
 (0)