Skip to content

Commit

Permalink
【PaddlePaddle Hackathon 2】3、为 Paddle 新增 corrcoef(皮尔逊积矩相关系数) (#4316)
Browse files Browse the repository at this point in the history
* corrcoef_doc

* Update corrcoef_cn.rst

* Update corrcoef_cn.rst

* Update corrcoef_cn.rst

* Update corrcoef_cn.rst

* Update corrcoef_cn.rst

* Update corrcoef_cn.rst

Co-authored-by: Ligoml <39876205+Ligoml@users.noreply.github.com>
  • Loading branch information
liqitong-a and Ligoml committed May 9, 2022
1 parent a21215e commit c6e28ba
Showing 1 changed file with 30 additions and 0 deletions.
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} } }

`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

0 comments on commit c6e28ba

Please sign in to comment.