corrcoef¶

paddle.linalg. corrcoef ( x, rowvar=True, name=None ) [source]

A correlation coefficient matrix indicate the correlation of each pair variables in the input matrix. For example, for an N-dimensional samples X=[x1,x2,…xN]T, then the correlation coefficient matrix element Rij is the correlation of xi and xj. The element Rii is the covariance of xi itself.

The relationship between the correlation coefficient matrix R and the covariance matrix C, is

$R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } }$

The values of R are between -1 and 1.

Parameters
• x (Tensor) – A N-D(N<=2) Tensor containing multiple variables and observations. By default, each row of x represents a variable. Also see rowvar below.

• rowvar (Bool, optional) – If rowvar is True (default), then each row represents a variable, with observations in the columns. Default: True.

• name (str, optional) – Name of the output. Default is None. It’s used to print debug info for developers. Details: Name.

Returns

The correlation coefficient matrix of the variables.

Examples

import paddle