[Scipy-tickets] [SciPy] #1246: kmeans gives unexpected results for integer data

SciPy Trac scipy-tickets@scipy....
Fri Jul 23 18:32:27 CDT 2010


#1246: kmeans gives unexpected results for integer data
---------------------------+------------------------------------------------
 Reporter:  lutz           |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  low            |   Milestone:  0.9.0   
Component:  scipy.cluster  |     Version:  0.7.0   
 Keywords:  kmeans         |  
---------------------------+------------------------------------------------

Comment(by lutz):

 I apologize for the malformed code snippets. Here is the corrected
 version:


  >>> import numpy as np[[BR]]
  >>> from scipy.cluster.vq import kmeans[[BR]]
  >>> kmeans(np.array(![1,2]), 1)[[BR]]
  (array(![1]), 0.5)[[BR]]
  >>> kmeans(np.array([1.,2.]), 1)[[BR]]
  (array([ 1.5]), 0.5)[[BR]]
  >>> np.mean(np.array(![1,2]))[[BR]]
  1.5[[BR]]

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


More information about the Scipy-tickets mailing list