Skip to content

Commit c6e28ba

Browse files
liqitong-aLigoml
andauthored
【PaddlePaddle Hackathon 2】3、为 Paddle 新增 corrcoef(皮尔逊积矩相关系数) (#4316)
* 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 <[email protected]>
1 parent a21215e commit c6e28ba

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.. _cn_api_linalg_corrcoef:
2+
3+
corrcoef
4+
-------------------------------
5+
6+
.. py:function:: paddle.linalg.corrcoef(x, rowvar=True, name=None)
7+
8+
9+
相关系数矩阵表示输入矩阵中每对变量的相关性。例如,对于N维样本X=[x1,x2,…xN]T,则相关系数矩阵
10+
元素 `Rij` 是 `xi` 和 `xj` 的相关性。元素 `Rii` 是 `xi` 本身的协方差。
11+
12+
皮尔逊积矩相关系数 `R` 和协方差矩阵 `C` 的关系如下:
13+
14+
.. math:: R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } }
15+
16+
`R` 的值在-1到1之间。
17+
18+
参数
19+
:::::::::
20+
- **x** (Tensor) - 一个N(N<=2)维矩阵,包含多个变量。默认矩阵的每行是一个观测变量,由参数rowvar设置。
21+
- **rowvar** (bool,可选) - 若是True,则每行作为一个观测变量;若是False,则每列作为一个观测变量。默认True。
22+
- **name** (str,可选) - 一般无需设置,默认值为None。用于为开发人员打印调试信息。具体用法请参见 :ref:`api_guide_Name`。
23+
24+
返回
25+
:::::::::
26+
输入x的皮尔逊积矩相关系数矩阵。
27+
28+
代码示例
29+
::::::::::
30+
COPY-FROM: paddle.linalg.corrcoef:code-example1

0 commit comments

Comments
 (0)