Covariance matrix syntax

Christian Gollwitzer auriocus at gmx.de
Mon Oct 19 01:48:27 EDT 2020


Am 19.10.20 um 07:23 schrieb Meghna Karkera:
> I am unable to find the *formula for covariance* used in np.cov syntax in
> PYTHON given in link
> https://numpy.org/doc/stable/reference/generated/numpy.cov.html.  Could you
> please help me out.


As said, you should click on the link [source] just at the right hand 
side of the page, at the top. There is

numpy.cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, 
aweights=None)

and just next to it there is the link. It takes you there:

https://github.com/numpy/numpy/blob/v1.19.0/numpy/lib/function_base.py#L2270-L2481

Which is the source code of the function.

Best regards,

	Christian


> Thanks
> Meghna
> 
> On Tue, Oct 13, 2020 at 11:46 AM Christian Gollwitzer <auriocus at gmx.de>
> wrote:
> 
>> Am 13.10.20 um 06:52 schrieb Meghna Karkera:
>>> Could you let me know what is the back end calculation of this covariance
>>> matrix syntax np.cov
>>>
>>
>> You can look it up yourself: Go to the docs
>> https://numpy.org/doc/stable/reference/generated/numpy.cov.html
>>
>> At the right hand side, just right of the function signature, there is a
>> link [source]. Click there and it takes you to the implementation.
>>
>> Apparently it is done in straightforward Python.
>>
>>          Christian
>>
>> PS: Snipped a lot of unrelated citation at the bottom
>>
>>> On Tue, Oct 13, 2020, 10:14 Bruno P. Kinoshita <
>> brunodepaulak at yahoo.com.br>
>>> wrote:
>>> [...]
>>>> I think the np.cov is from the numpy module (imported/aliased as np?).
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>



More information about the Python-list mailing list