numpy covariance matrix

前端 未结 10 1719
半阙折子戏
半阙折子戏 2021-01-01 13:10

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.



        
10条回答
  •  一个人的身影
    2021-01-01 13:34

    Reading the documentation as,

    >> np.cov.__doc__ 
    

    or looking at Numpy Covariance, Numpy treats each row of array as a separate variable, so you have two variables and hence you get a 2 x 2 covariance matrix.

    I think the previous post has right solution. I have the explanation :-)

提交回复
热议问题