gpt4 book ai didi

python - pandas 'corr()' 是否应用于数据自动归一化?

转载 作者:行者123 更新时间:2023-12-05 03:44:12 28 4
gpt4 key购买 nike

我多次使用 pandas corr() 方法。但我不知道 pandas corr() 是否应用自动数据规范化。我知道必须在数据归一化之后进行关联。

我的问题是,如果我使用 pandas corr() 方法检查数据框中各列之间的 PIL 逊相关性,pandas corr() 方法是否应用数据自己归一化?

我尝试使用 scikit-learn 中的 StandardScaler 进行检查。归一化数据后的相关性与未应用归一化后的相关性相同。

[我试过之后]
哦..我试着用 Scikit-learn StandardScaler 来检查它。之后,后者的系数等于前者。也许 pandas corr() 会自动使用数据规范化。

最佳答案

我不知道你说的是什么

I know the fact that correlation must be done after datanormalization.

如果你做斯 PIL 曼相关,你不需要标准化你的变量。

您很可能指的是 PIL 逊相关系数。来自 wiki ,它是:

the covariance of two variables, divided by the product of theirstandard deviations; thus it is essentially a normalised measurementof the covariance, such that the result always has a value between −1and 1

所以在 spearman 的任何计算中,计算中都有一个按标准差缩放的步骤。

如果您事先使用 StandardScaler() 缩放变量,您只是将变量除以它们的标准差,这当然不会改变结果。

关于python - pandas 'corr()' 是否应用于数据自动归一化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66595987/

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