You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Uniform columns return a standard deviation of 1 in StandardScaler #4609
Yeah, it is a bit awkward but setting it to 0 is also awkward. I am a bit conflicted about what would be best here.
I think we should document this behavior in the std_ docstring. That might be best
0 is the correct answer, so I find it less awkward than 1. Returning 0, but handling it internally to avoid NaNs, and throwing a warning would be my preference. Adding functionality to optionally remove those columns would be even better.
what do you mean by "the correct answer"? This is not a function to compute the standard deviation, you can use np.std for that. This is the "internal handling" to get the desired scaling.
Activity
lesteve commentedon Apr 17, 2015
StandardScaler.fit is using sklearn.preprocessing.data._mean_and_std, this docstring may be a hint to explain this behaviour.
amueller commentedon Apr 17, 2015
Yeah, it is a bit awkward but setting it to 0 is also awkward. I am a bit conflicted about what would be best here.
I think we should document this behavior in the
std_docstring. That might be bestTroyHernandez commentedon Apr 17, 2015
0 is the correct answer, so I find it less awkward than 1. Returning 0, but handling it internally to avoid NaNs, and throwing a warning would be my preference. Adding functionality to optionally remove those columns would be even better.
amueller commentedon Apr 19, 2015
what do you mean by "the correct answer"? This is not a function to compute the standard deviation, you can use np.std for that. This is the "internal handling" to get the desired scaling.
I feel that the promise here is that
and not that
I don't see what the usefulness of the second contract would be.
Optionally removing these columns would be a nice addition. PR welcome.
TroyHernandez commentedon Apr 20, 2015
By correct I mean reporting the calculated standard deviation (in Latex, sorry)
$$ \sqrt(\frac{1}{N} \sum_{i=1}{N} (x_i - \mu)^2) $$
I'm new to sklearn. That PR may be a while.
amueller commentedon Apr 20, 2015
well, I agree that if we name the attribute
stdthat it is confusing. I think there is a PR that refactors it and renames itscaling.TomDLT commentedon Jun 10, 2015
yes, it is #3639
amueller commentedon Jun 10, 2015
Fixed by #4796.