[Scipy-svn] r4420 - trunk/scipy/cluster

scipy-svn@scip... scipy-svn@scip...
Mon Jun 9 01:05:13 CDT 2008


Author: damian.eads
Date: 2008-06-09 01:05:10 -0500 (Mon, 09 Jun 2008)
New Revision: 4420

Modified:
   trunk/scipy/cluster/__init__.py
   trunk/scipy/cluster/hierarchy.py
Log:
Added import to cluster/__init__.py. Removed pdist import from hierarchy.

Modified: trunk/scipy/cluster/__init__.py
===================================================================
--- trunk/scipy/cluster/__init__.py	2008-06-09 06:01:51 UTC (rev 4419)
+++ trunk/scipy/cluster/__init__.py	2008-06-09 06:05:10 UTC (rev 4420)
@@ -6,6 +6,6 @@
 
 __all__ = ['vq', 'hierarchy', 'distance']
 
-import vq, hierarchy
+import vq, hierarchy, distance
 from scipy.testing.pkgtester import Tester
 test = Tester().test

Modified: trunk/scipy/cluster/hierarchy.py
===================================================================
--- trunk/scipy/cluster/hierarchy.py	2008-06-09 06:01:51 UTC (rev 4419)
+++ trunk/scipy/cluster/hierarchy.py	2008-06-09 06:05:10 UTC (rev 4420)
@@ -149,7 +149,7 @@
 
 import numpy as np
 import _hierarchy_wrap, types
-from distance import pdist
+import distance
 
 _cpy_non_euclid_methods = {'single': 0, 'complete': 1, 'average': 2,
                            'weighted': 6}
@@ -437,14 +437,14 @@
         if method not in _cpy_linkage_methods:
             raise ValueError('Invalid method: %s' % method)
         if method in _cpy_non_euclid_methods.keys():
-            dm = pdist(X, metric)
+            dm = distance.pdist(X, metric)
             Z = np.zeros((n - 1, 4))
             _hierarchy_wrap.linkage_wrap(dm, Z, n, \
                                        int(_cpy_non_euclid_methods[method]))
         elif method in _cpy_euclid_methods.keys():
             if metric != 'euclidean':
                 raise ValueError('Method %s requires the distance metric to be euclidean' % s)
-            dm = pdist(X, metric)
+            dm = distance.pdist(X, metric)
             Z = np.zeros((n - 1, 4))
             _hierarchy_wrap.linkage_euclid_wrap(dm, Z, X, m, n,
                                               int(_cpy_euclid_methods[method]))
@@ -1341,7 +1341,7 @@
                     descriptions.
 
         distance:   the distance metric for calculating pairwise
-                    distances. See pdist for descriptions and
+                    distances. See distance.pdist for descriptions and
                     linkage to verify compatibility with the linkage
                     method.
 
@@ -1361,7 +1361,7 @@
     if type(X) != np.ndarray or len(X.shape) != 2:
         raise TypeError('The observation matrix X must be an n by m numpy array.')
 
-    Y = pdist(X, metric=distance)
+    Y = distance.pdist(X, metric=distance)
     Z = linkage(Y, method=method)
     if R is None:
         R = inconsistent(Z, d=depth)



More information about the Scipy-svn mailing list