Say we have a matrix A
of shape N x M
, which can be viewed as a collection of N vectors of shape 1 x M
. The code below gives us the correlation matrix of A
:
A_corr = np.corrcoef(A) # shape: (N, N) |
To visualize it, just use plt.matshow(A_corr)
.
If N
is so large that the figure could not provide a clear insight, we might alternatively use histograms like this:
def corr_matrix_to_array(corr_mat): |
OOPS!
A comment box should be right here...But it was gone due to network issues :-(If you want to leave comments, make sure you have access to disqus.com.