Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【PaddlePaddle Hackathon 2】3、为 Paddle 新增 corrcoef(皮尔逊积矩相关系数) #4316

Merged
merged 12 commits into from May 9, 2022
30 changes: 30 additions & 0 deletions docs/api/paddle/linalg/corrcoef_cn.rst
@@ -0,0 +1,30 @@
.. _cn_api_linalg_corrcoef:

corrcoef
-------------------------------

.. py:function:: paddle.linalg.corrcoef(x, rowvar=True, name=None)


相关系数矩阵表示输入矩阵中每对变量的相关性。例如,对于N维样本X=[x1,x2,…xN]T,则相关系数矩阵
元素 `Rij` 是 `xi` 和 `xj` 的相关性。元素 `Rii` 是 `xi` 本身的协方差。

皮尔逊积矩相关系数 `R` 和协方差矩阵 `C` 的关系如下:

.. math:: R_{ij} = \\frac{ C_{ij} } { \\sqrt{ C_{ii} * C_{jj} } }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

显示还是不对,把 \\ 改成 \ ,另外可以自己查看预览链接核对,每次触发CI都会生成新的官网预览,文档参考

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

显示还是不对,把 \\ 改成 \ ,另外可以自己查看预览链接核对,每次触发CI都会生成新的官网预览,文档参考

好的好的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

显示还是不对,把 \\ 改成 \ ,另外可以自己查看预览链接核对,每次触发CI都会生成新的官网预览,文档参考

Done!


`R` 的值在-1到1之间。

参数
:::::::::
- **x** (Tensor) - 一个N(N<=2)维矩阵,包含多个变量。默认矩阵的每行是一个观测变量,由参数rowvar设置。
- **rowvar** (bool,可选) - 若是True,则每行作为一个观测变量;若是False,则每列作为一个观测变量。默认True。
- **name** (str,可选) - 一般无需设置,默认值为None。用于为开发人员打印调试信息。具体用法请参见 :ref:`api_guide_Name`。

返回
:::::::::
输入x的皮尔逊积矩相关系数矩阵。

代码示例
::::::::::
COPY-FROM: <paddle.linalg.corrcoef>:<code-example1>