[Scipy-tickets] [SciPy] #1247: _kmeans chokes on large thresholds

SciPy Trac scipy-tickets@scipy....
Sun Jul 25 10:22:10 CDT 2010


#1247: _kmeans chokes on large thresholds
---------------------------+------------------------------------------------
 Reporter:  kwgoodman      |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  normal         |   Milestone:  0.9.0   
Component:  scipy.cluster  |     Version:  0.7.0   
 Keywords:                 |  
---------------------------+------------------------------------------------

Comment(by kwgoodman):

 Here's a better fix. Replace:
 {{{
     if dist > thresh
 }}}
 with
 {{{
     if dist >= thresh
 }}}
 That would solve the problem of large thresh and it would match the doc
 string!
 {{{
         thresh : float
             Terminates the k-means algorithm if the change in
             distortion since the last k-means iteration is less than
             thresh.
 }}}

 At the moment it terminates if the change is EQUAL to the distortion.

 Check that it works (it does):
 {{{
     >> thresh = 1e400
     >> diff = thresh + 1.
     >> diff >= thresh
        True
 }}}

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


More information about the Scipy-tickets mailing list