pydiodon.get_correlation_matrix¶
- pydiodon.get_correlation_matrix(A)[source]¶
Gets the correlation matrix
- Parameters
- Aa 2D n x p array
the dataset
- Returns
- Ca p x p coorrelation matrix
Notes
The computation of the correlation matrix, or variance-covariance matrix, is relevant for standard pretreatment only. Then, S is centered-scaled matrix from A, then \(C = S^t S\).
To compte C, the function computes S by centering columnwise and scaling the input matrix A.
Example
>>> import pydiodon as dio >>> import numpy as np >>> # building a toy matrix >>> m = 10; n = 5 >>> A = np.random.randn(m,n) >>> # computes the correlation matrix >>> C = dio.get_correlation_matrix(A) >>> print(C)
af, 23.01.19