gpt4 book ai didi

pandas - 为什么 np.std(X) 和 X.std() 返回不同的值?

转载 作者:行者123 更新时间:2023-12-02 03:12:41 25 4
gpt4 key购买 nike

我正在尝试使用均值归一化计算数据集的归一化分数。当我写 (X - np.mean(X))/np.std(X) 时,它给我的分数与 ((X - X.mean())/X 不同.std().

问题似乎来自标准差的计算。 X.std() 返回一个标准差值,np.std() 返回不同的标准化值。为什么会发生这种情况?

最佳答案

Pandas uses the unbiased estimator (N-1 in the denominator), whereas Numpy by default does not.

To make them behave the same, pass ddof=1 to numpy.std().

Different std in pandas vs numpy

关于pandas - 为什么 np.std(X) 和 X.std() 返回不同的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57177765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com