[Scipy-tickets] [SciPy] #780: Typo in scipy.cluster.hierarchy.inconsistent doc

SciPy scipy-tickets@scipy....
Thu Nov 6 08:20:34 CST 2008


#780: Typo in scipy.cluster.hierarchy.inconsistent doc
---------------------------+------------------------------------------------
 Reporter:  vladan         |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  normal         |   Milestone:  0.7.0   
Component:  scipy.cluster  |     Version:  devel   
 Severity:  normal         |    Keywords:          
---------------------------+------------------------------------------------
 Return values in row i column 3 (R[i,3]) seem to be calculated as:
   (Z[i,2] - R[i,0]) / R[i,1]
 This formula is in agreement with the Matlab doc for the same function.

 However, the doc for scipy.cluster.hierarchy.inconsistent states that
 those values are calculated as:
   (Z[i,2] - R[i,0]) / R[i,2]

 Example:

 In [1]: import numpy, scipy

 In [2]: import scipy.cluster as cluster

 In [3]: data = numpy.array([[1,3,4,8]]).transpose()

 In [4]: code_book = cluster.hierarchy.linkage(data, method='single',
 metric='euclidean')

 In [6]: code_book

 Out[6]:[[BR]]
 array([[ 1.,  2.,  1.,  2.],
        [ 0.,  4.,  2.,  3.],[[BR]]
        [ 3.,  5.,  4.,  4.]])

 In [7]: cluster.hierarchy.inconsistent(code_book)

 Out[7]:[[BR]]
 array([[ 1.        ,  0.        ,  1.        ,  0.        ],[[BR]]
        [ 1.5       ,  0.70710678,  2.        ,  0.70710678],[[BR]]
        [ 3.        ,  1.41421356,  2.        ,  0.70710678]])

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


More information about the Scipy-tickets mailing list