[Scipy-tickets] [SciPy] #1391: Wrong formula in cosine distance docstring

SciPy Trac scipy-tickets@scipy....
Tue Feb 22 07:46:44 CST 2011


#1391: Wrong formula in cosine distance docstring
---------------------------+------------------------------------------------
 Reporter:  f0k            |       Owner:  peridot
     Type:  defect         |      Status:  new    
 Priority:  normal         |   Milestone:  0.9.0  
Component:  scipy.spatial  |     Version:  0.8.0  
 Keywords:                 |  
---------------------------+------------------------------------------------
 The docstring for the cosine distance both in
 scipy.spatial.distance.cosine and scipy.spatial.distance.pdist gives a
 wrong formula. Instead of \frac{1-uv^^T}{||u||_2 ||v||_2}, it should be
 1-\frac{uv^^T}{||u||_2 ||v||_2}.
 Fortunately, the implementation is correct: return (1.0 - (np.dot(u, v.T)
 / (np.sqrt(np.dot(u, u.T)) * np.sqrt(np.dot(v, v.T)))))

 I can create a patch if needed, but I suppose reviewing my patch will take
 longer than directly fixing it.

 Cheers, Jan

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1391>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list