neurospin / pylearn-parsimony_history

Sparse and Structured Machine Learning in Python
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

parsimony.utils.maths.cov is different from np.cov #10

Closed JinpengLI closed 10 years ago

JinpengLI commented 10 years ago
>>> import numpy as np
>>> from parsimony.utils.maths import cov
>>> v1 = np.asarray([[1., 2., 3.], [1., 2., 3.]])
>>> v2 = np.asarray([[1., 2., 3.], [1., 2., 3.]])
>>> print cov(v1, v2)
[[ 2.  0. -2.]
 [ 0.  0.  0.]
 [-2.  0.  2.]]
>>> np.cov(v1, v2)
array([[ 1.,  1.,  1.,  1.],
       [ 1.,  1.,  1.,  1.],
       [ 1.,  1.,  1.,  1.],
       [ 1.,  1.,  1.,  1.]])

Feel free to answer it since it is not used in parsimony.

duchesnay commented 10 years ago

It is not used, so I removed it.

tomlof commented 10 years ago

I put it back. That one is more intuitive and works as you'd expect, compared to the one in numpy.

We are not using it, but I was meaning to use it for PLS type of functions. If we don't, we can remove it later.