有人可以向我解释为什么python软件包的确会产生标准差的精确值,而numpy却不能吗? Python在其source_code中使用函数_ss
来计算残差平方和。似乎减法确实产生了零。 numpy文档指出results can be inaccurate depending on the precision of the input data
为什么python在这里比numpy更准确?
import statistics
import numpy as np
a = 3.28*np.ones(100)
print(f'STD with numpy {np.std(a)}')
print(f'STD with pythons statistics package {statistics.stdev(a)}')
STD with numpy 4.440892098500626e-16
STD with pythons statistics package 0.0