utils.stats.cov_to_cor
utils.stats.cov_to_cor(covariance_matrix)Convert a covariance matrix to a correlation matrix.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| covariance_matrix | numpy.ndarray | A square matrix of covariance values. | required |
Returns
| Name | Type | Description |
|---|---|---|
| np.ndarray | numpy.ndarray: A corresponding square matrix of correlation coefficients. |
Examples
>>> from spotpython.utils.stats import cov_to_cor
>>> import numpy as np
>>> cov_matrix = np.array([[1, 0.8], [0.8, 1]])
>>> cov_to_cor(cov_matrix)
array([[1. , 0.8],
[0.8, 1. ]])