I tried to scale the data by referring to the link as follow: http://scikit-learn.org/stable/modules/preprocessing.html

However, when I checked the data distribution, the mean returned is NOT ZERO.

Mean: [ -2.81496710e-17 -4.18191513e-16 ... -6.43850535e-15] Standard Deviation: [ 1. 1. ... 1.]

Any ideas why?


Those means are very close to 0, it is probably just a numerical precision problem of floating point numbers.

See also this comment in the source code:

# Verify that mean_1 is 'close to zero'. If X contains very
# large values, mean_1 can also be very large, due to a lack of
# precision of mean_. In this case, a pre-scaling of the
# concerned feature is efficient, for instance by its mean or
# maximum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.