KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Suppose I have two vectors of length 25, and I want to compute their covariance matrix. I try doing this with numpy.cov, but always end up with a 2x2 matrix. >>> import numpy as np >>> x=np.random.normal(size=25) >>> y=np.random.normal(size=25) >>> np.cov(x,y) array([[ 0.77568388, 0.15568432], [ 0.15568432, 0.73839014]]) Using the rowvar flag doesn't help either - I get exactly the same result. >>> np.cov(x,y,rowvar=0) array([[ 0.77568388, 0.15568432], [ 0.15568432, 0.73839014]]) How can I get the 25x25 covariance matrix?
Tags (comma-separated)
Save Edits
Cancel