corrcoef#

ivy.corrcoef(x, /, *, y=None, rowvar=True, out=None)[source]#
Return type:

Array

Array.corrcoef(self, /, *, y=None, rowvar=True, out=None)[source]#

ivy.Array instance method variant of ivy.corrcoef. This method simply wraps the function, and so the docstring for ivy.corrcoef also applies to this method with minimal changes.

Parameters:
  • self (Array) – Input array.

  • y (Optional[Array], default: None) – An additional input array. y has the same shape as x.

  • rowvar (bool, default: True) – If rowvar is True (default), then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed: each column represents a variable, while the rows contain observations.

Return type:

Array

Returns:

ret – The corrcoef of the array elements.

Examples

>>> a = ivy.array([[0., 1., 2.], [2., 1., 0.]])
>>> a.corrcoef()
    ivy.array([[ 1., -1.],
               [-1.,  1.]])
>>> a.corrcoef(rowvar=False)
    ivy.array([[ 1., nan, -1.],
               [nan, nan, nan],
               [-1., nan,  1.]])
Container.corrcoef(self, /, *, y=None, rowvar=True, out=None)[source]#

ivy.Container instance method variant of ivy.corrcoef. This method simply wraps the function, and so the docstring for ivy.corrcoef also applies to this method with minimal changes.

Parameters:
  • self (Container) – Input container including arrays.

  • y (Optional[Container], default: None) – An additional input container.

  • rowvar (Union[bool, Container], default: True) – If rowvar is True (default), then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed: each column represents a variable, while the rows contain observations.

Return type:

Container

Returns:

ret – The corrcoef of the array elements in the input container.

Examples

>>> a = ivy.Container(w=ivy.array([[1., 2.], [3., 4.]]),                                  z=ivy.array([[0., 1., 2.], [2., 1., 0.]]))
>>> ivy.Container.corrcoef(a)
{
    w: ivy.array([[1., 1.],
                  [1., 1.]]),
    z: ivy.array([[1., -1.],
                  [-1., 1.]])
}