Pandas“corr()”是否应用于自动数据规范化?

2024-06-28 19:48:01 发布

您现在位置:Python中文网/ 问答频道 /正文

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

我的问题是,如果我使用pandascorr()方法来检查数据帧中各个列之间的pearson相关性,pandascorr()方法本身是否应用了数据规范化

我试图使用scikit learn中的StandardScaler来检查这一点。标准化数据后的相关性与未应用标准化的相关性相同

[我试过之后]
哦我试着用Scikit学习标准定标器检查它。之后,后者的系数等于前者。也许pandas corr()会自动使用数据规范化


Tags: 数据方法pandas标准scikit规范化learnpearson
1条回答
网友
1楼 · 发布于 2024-06-28 19:48:01

我不知道你说的是什么意思

I know the fact that correlation must be done after data normalization.

如果使用spearman关联,则不需要规范化变量

很可能你指的是皮尔逊相关性。从wiki开始,它是:

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

因此,在斯皮尔曼的任何计算中,都有一个步骤可以通过标准偏差进行缩放

如果你用StandardScaler()来缩放你的变量,你只是把变量除以它们的标准偏差,这当然不会改变结果

相关问题 更多 >