[Scipy-svn] r5020 - trunk/scipy/cluster/tests

scipy-svn at scipy.org scipy-svn at scipy.org
Fri Nov 7 17:14:08 EST 2008


Author: damian.eads
Date: 2008-11-07 16:14:00 -0600 (Fri, 07 Nov 2008)
New Revision: 5020

Added:
   trunk/scipy/cluster/tests/inconsistent-Q-single-1.txt
   trunk/scipy/cluster/tests/inconsistent-Q-single-2.txt
   trunk/scipy/cluster/tests/inconsistent-Q-single-3.txt
   trunk/scipy/cluster/tests/inconsistent-Q-single-4.txt
   trunk/scipy/cluster/tests/inconsistent-Q-single-5.txt
   trunk/scipy/cluster/tests/inconsistent-Q-single-6.txt
Modified:
   trunk/scipy/cluster/tests/test_hierarchy.py
Log:
Added some more tests to inconsistent.

Added: trunk/scipy/cluster/tests/inconsistent-Q-single-1.txt
===================================================================
--- trunk/scipy/cluster/tests/inconsistent-Q-single-1.txt	2008-11-07 21:52:04 UTC (rev 5019)
+++ trunk/scipy/cluster/tests/inconsistent-Q-single-1.txt	2008-11-07 22:14:00 UTC (rev 5020)
@@ -0,0 +1,29 @@
+   6.3937355e-02   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.7716924e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.9481726e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4887981e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.7739218e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.9703742e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.9953732e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.0440560e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.0777762e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.0902082e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.3102505e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.4153568e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.5802170e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.6459874e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.7818440e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.0129405e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.1203984e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.4459698e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.5328393e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.8198330e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   5.0546088e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   5.0591731e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   5.9356257e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   6.0048760e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   6.2656347e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   6.5449319e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   7.0629051e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.0267612e+00   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.2085488e+00   0.0000000e+00   1.0000000e+00   0.0000000e+00

Added: trunk/scipy/cluster/tests/inconsistent-Q-single-2.txt
===================================================================
--- trunk/scipy/cluster/tests/inconsistent-Q-single-2.txt	2008-11-07 21:52:04 UTC (rev 5019)
+++ trunk/scipy/cluster/tests/inconsistent-Q-single-2.txt	2008-11-07 22:14:00 UTC (rev 5020)
@@ -0,0 +1,29 @@
+   6.3937355e-02   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.7716924e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.9481726e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4887981e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.7739218e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4592734e-01   7.2280574e-02   2.0000000e+00   7.0710678e-01
+   2.7420856e-01   3.5820263e-02   2.0000000e+00   7.0710678e-01
+   3.0440560e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4247343e-01   9.2354075e-02   2.0000000e+00   7.0710678e-01
+   3.0302912e-01   8.4735429e-03   2.0000000e+00   7.0710678e-01
+   3.1940134e-01   1.6438416e-02   2.0000000e+00   7.0710678e-01
+   3.3628037e-01   7.4321374e-03   2.0000000e+00   7.0710678e-01
+   2.5449825e-01   1.6523631e-01   3.0000000e+00   6.2651759e-01
+   3.2284722e-01   3.6239721e-02   3.0000000e+00   1.1520929e+00
+   3.7139157e-01   9.6065094e-03   2.0000000e+00   7.0710678e-01
+   3.8973922e-01   1.6340989e-02   2.0000000e+00   7.0710678e-01
+   3.8503077e-01   3.8196594e-02   2.0000000e+00   7.0710678e-01
+   4.2831841e-01   2.3021378e-02   2.0000000e+00   7.0710678e-01
+   3.8115238e-01   1.0200942e-01   2.0000000e+00   7.0710678e-01
+   4.8198330e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.6291274e-01   5.4639241e-02   3.0000000e+00   7.7871022e-01
+   4.1219781e-01   1.1967450e-01   3.0000000e+00   7.8312006e-01
+   5.4973994e-01   6.1974561e-02   2.0000000e+00   7.0710678e-01
+   5.5297424e-01   6.7194042e-02   2.0000000e+00   7.0710678e-01
+   6.1006302e-01   2.3335155e-02   2.0000000e+00   7.0710678e-01
+   5.4954508e-01   1.4841903e-01   2.0000000e+00   7.0710678e-01
+   6.6642699e-01   5.6375531e-02   2.0000000e+00   7.0710678e-01
+   7.6058065e-01   2.3209524e-01   3.0000000e+00   1.1468590e+00
+   9.8053348e-01   2.5430019e-01   3.0000000e+00   8.9663826e-01

Added: trunk/scipy/cluster/tests/inconsistent-Q-single-3.txt
===================================================================
--- trunk/scipy/cluster/tests/inconsistent-Q-single-3.txt	2008-11-07 21:52:04 UTC (rev 5019)
+++ trunk/scipy/cluster/tests/inconsistent-Q-single-3.txt	2008-11-07 22:14:00 UTC (rev 5020)
@@ -0,0 +1,29 @@
+   6.3937355e-02   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.7716924e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.9481726e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4887981e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.7739218e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4592734e-01   7.2280574e-02   2.0000000e+00   7.0710678e-01
+   2.7420856e-01   3.5820263e-02   2.0000000e+00   7.0710678e-01
+   3.0440560e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4247343e-01   9.2354075e-02   2.0000000e+00   7.0710678e-01
+   2.6695850e-01   6.2762807e-02   3.0000000e+00   6.7017912e-01
+   2.7199064e-01   8.2936326e-02   3.0000000e+00   7.1180408e-01
+   3.2677945e-01   1.7274852e-02   3.0000000e+00   8.5420299e-01
+   2.7362995e-01   1.4023592e-01   4.0000000e+00   6.0178414e-01
+   3.0435537e-01   4.7363902e-02   4.0000000e+00   1.2719259e+00
+   3.3668152e-01   4.0510441e-02   4.0000000e+00   1.0244985e+00
+   3.8135906e-01   1.8552498e-02   3.0000000e+00   1.0745175e+00
+   2.9388364e-01   1.5622696e-01   4.0000000e+00   7.5631117e-01
+   4.0488617e-01   4.3728723e-02   3.0000000e+00   9.0811730e-01
+   3.5311406e-01   8.6956328e-02   3.0000000e+00   1.1519561e+00
+   4.8198330e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.4173066e-01   6.1522522e-02   4.0000000e+00   1.0358844e+00
+   3.8640356e-01   1.1049599e-01   4.0000000e+00   1.0816117e+00
+   4.5753900e-01   1.3330898e-01   4.0000000e+00   1.0203631e+00
+   4.9730646e-01   8.1987855e-02   4.0000000e+00   1.2584931e+00
+   5.7534778e-01   6.2351485e-02   3.0000000e+00   8.2140277e-01
+   5.0371000e-01   1.3159281e-01   3.0000000e+00   1.1458315e+00
+   6.4213885e-01   5.7955510e-02   3.0000000e+00   1.1069121e+00
+   6.4635996e-01   2.2772591e-01   5.0000000e+00   1.6704345e+00
+   8.0385745e-01   2.5222314e-01   6.0000000e+00   1.6044971e+00

Added: trunk/scipy/cluster/tests/inconsistent-Q-single-4.txt
===================================================================
--- trunk/scipy/cluster/tests/inconsistent-Q-single-4.txt	2008-11-07 21:52:04 UTC (rev 5019)
+++ trunk/scipy/cluster/tests/inconsistent-Q-single-4.txt	2008-11-07 22:14:00 UTC (rev 5020)
@@ -0,0 +1,29 @@
+   6.3937355e-02   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.7716924e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.9481726e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4887981e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.7739218e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4592734e-01   7.2280574e-02   2.0000000e+00   7.0710678e-01
+   2.7420856e-01   3.5820263e-02   2.0000000e+00   7.0710678e-01
+   3.0440560e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4247343e-01   9.2354075e-02   2.0000000e+00   7.0710678e-01
+   2.6695850e-01   6.2762807e-02   3.0000000e+00   6.7017912e-01
+   2.7199064e-01   8.2936326e-02   3.0000000e+00   7.1180408e-01
+   2.8937690e-01   7.6123263e-02   4.0000000e+00   6.8518849e-01
+   2.8045948e-01   1.2240424e-01   5.0000000e+00   6.3365630e-01
+   3.0435537e-01   4.7363902e-02   4.0000000e+00   1.2719259e+00
+   3.1912118e-01   5.2655955e-02   5.0000000e+00   1.1216818e+00
+   3.4960402e-01   4.5450828e-02   5.0000000e+00   1.1372736e+00
+   3.0131193e-01   1.3631230e-01   5.0000000e+00   8.1231048e-01
+   3.2402631e-01   1.5115571e-01   5.0000000e+00   7.9765872e-01
+   3.1353986e-01   1.0632688e-01   4.0000000e+00   1.3142874e+00
+   4.8198330e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   4.2630427e-01   6.3471504e-02   5.0000000e+00   1.2471203e+00
+   3.6853033e-01   1.0370286e-01   5.0000000e+00   1.3248137e+00
+   4.2783536e-01   1.3319157e-01   5.0000000e+00   1.2442770e+00
+   4.7348205e-01   8.8766656e-02   5.0000000e+00   1.4307800e+00
+   4.9134389e-01   1.3799391e-01   5.0000000e+00   9.7989526e-01
+   4.6728793e-01   1.2981031e-01   4.0000000e+00   1.4421448e+00
+   6.0808346e-01   8.2935544e-02   4.0000000e+00   1.1841370e+00
+   5.6588963e-01   2.0619528e-01   8.0000000e+00   2.2351217e+00
+   7.0741835e-01   2.4917629e-01   9.0000000e+00   2.0111480e+00

Added: trunk/scipy/cluster/tests/inconsistent-Q-single-5.txt
===================================================================
--- trunk/scipy/cluster/tests/inconsistent-Q-single-5.txt	2008-11-07 21:52:04 UTC (rev 5019)
+++ trunk/scipy/cluster/tests/inconsistent-Q-single-5.txt	2008-11-07 22:14:00 UTC (rev 5020)
@@ -0,0 +1,29 @@
+   6.3937355e-02   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.7716924e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.9481726e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4887981e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.7739218e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4592734e-01   7.2280574e-02   2.0000000e+00   7.0710678e-01
+   2.7420856e-01   3.5820263e-02   2.0000000e+00   7.0710678e-01
+   3.0440560e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4247343e-01   9.2354075e-02   2.0000000e+00   7.0710678e-01
+   2.6695850e-01   6.2762807e-02   3.0000000e+00   6.7017912e-01
+   2.7199064e-01   8.2936326e-02   3.0000000e+00   7.1180408e-01
+   2.8937690e-01   7.6123263e-02   4.0000000e+00   6.8518849e-01
+   2.6324444e-01   1.1732171e-01   6.0000000e+00   8.0784074e-01
+   3.0435537e-01   4.7363902e-02   4.0000000e+00   1.2719259e+00
+   3.1912118e-01   5.2655955e-02   5.0000000e+00   1.1216818e+00
+   3.3281665e-01   5.7823149e-02   6.0000000e+00   1.1842557e+00
+   3.0238954e-01   1.2195000e-01   6.0000000e+00   8.9914142e-01
+   3.2519277e-01   1.3522797e-01   6.0000000e+00   8.8298461e-01
+   3.1353986e-01   1.0632688e-01   4.0000000e+00   1.3142874e+00
+   4.8198330e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.9078061e-01   7.9802007e-02   7.0000000e+00   1.4370599e+00
+   3.3957815e-01   1.1675958e-01   6.0000000e+00   1.4246296e+00
+   4.0603571e-01   1.3055016e-01   6.0000000e+00   1.4364353e+00
+   4.5533483e-01   9.0992001e-02   6.0000000e+00   1.5952257e+00
+   4.6095671e-01   1.4413236e-01   6.0000000e+00   1.1489908e+00
+   3.7910412e-01   1.9099694e-01   6.0000000e+00   1.4418506e+00
+   5.2716833e-01   1.5144040e-01   6.0000000e+00   1.1827899e+00
+   5.2633231e-01   2.0011385e-01   1.0000000e+01   2.5007208e+00
+   6.2830766e-01   2.3939755e-01   1.3000000e+01   2.4237553e+00

Added: trunk/scipy/cluster/tests/inconsistent-Q-single-6.txt
===================================================================
--- trunk/scipy/cluster/tests/inconsistent-Q-single-6.txt	2008-11-07 21:52:04 UTC (rev 5019)
+++ trunk/scipy/cluster/tests/inconsistent-Q-single-6.txt	2008-11-07 22:14:00 UTC (rev 5020)
@@ -0,0 +1,29 @@
+   6.3937355e-02   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.7716924e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   1.9481726e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4887981e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.7739218e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4592734e-01   7.2280574e-02   2.0000000e+00   7.0710678e-01
+   2.7420856e-01   3.5820263e-02   2.0000000e+00   7.0710678e-01
+   3.0440560e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   2.4247343e-01   9.2354075e-02   2.0000000e+00   7.0710678e-01
+   2.6695850e-01   6.2762807e-02   3.0000000e+00   6.7017912e-01
+   2.7199064e-01   8.2936326e-02   3.0000000e+00   7.1180408e-01
+   2.8937690e-01   7.6123263e-02   4.0000000e+00   6.8518849e-01
+   2.6324444e-01   1.1732171e-01   6.0000000e+00   8.0784074e-01
+   3.0435537e-01   4.7363902e-02   4.0000000e+00   1.2719259e+00
+   3.1912118e-01   5.2655955e-02   5.0000000e+00   1.1216818e+00
+   3.3281665e-01   5.7823149e-02   6.0000000e+00   1.1842557e+00
+   2.8450093e-01   1.2096771e-01   7.0000000e+00   1.0543220e+00
+   3.2270489e-01   1.2362105e-01   7.0000000e+00   9.8601409e-01
+   3.1353986e-01   1.0632688e-01   4.0000000e+00   1.3142874e+00
+   4.8198330e-01   0.0000000e+00   1.0000000e+00   0.0000000e+00
+   3.7304301e-01   8.9306070e-02   8.0000000e+00   1.4827420e+00
+   3.3957815e-01   1.1675958e-01   6.0000000e+00   1.4246296e+00
+   3.7586164e-01   1.4344374e-01   7.0000000e+00   1.5176747e+00
+   4.1699399e-01   1.0466959e-01   8.0000000e+00   1.7530748e+00
+   4.3753967e-01   1.4543138e-01   7.0000000e+00   1.2997456e+00
+   3.7223569e-01   1.7529999e-01   7.0000000e+00   1.6101398e+00
+   4.9600440e-01   1.6096634e-01   7.0000000e+00   1.3063980e+00
+   4.6410730e-01   2.2064134e-01   1.3000000e+01   2.5500836e+00
+   5.6675775e-01   2.3884131e-01   1.7000000e+01   2.6871022e+00

Modified: trunk/scipy/cluster/tests/test_hierarchy.py
===================================================================
--- trunk/scipy/cluster/tests/test_hierarchy.py	2008-11-07 21:52:04 UTC (rev 5019)
+++ trunk/scipy/cluster/tests/test_hierarchy.py	2008-11-07 22:14:00 UTC (rev 5020)
@@ -62,6 +62,12 @@
               "linkage-complete-tdist.txt",
               "linkage-average-tdist.txt",
               "linkage-weighted-tdist.txt",
+              "inconsistent-Q-single-1.txt",
+              "inconsistent-Q-single-2.txt",
+              "inconsistent-Q-single-3.txt",
+              "inconsistent-Q-single-4.txt",
+              "inconsistent-Q-single-5.txt",
+              "inconsistent-Q-single-6.txt",
               "inconsistent-complete-tdist-depth-1.txt",
               "inconsistent-complete-tdist-depth-2.txt",
               "inconsistent-complete-tdist-depth-3.txt",
@@ -207,11 +213,130 @@
 
 class TestInconsistent(TestCase):
 
-    def test_single_inconsistent_tdist(self):
-        "Testing inconsistency matrix calculation on a single linkage."
-        for i in xrange(0, 100):
-            yield help_single_inconsistent_depth, i
+    def test_single_inconsistent_tdist_1(self):
+        "Testing inconsistency matrix calculation (depth=1) on a single linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'single')
+        R = inconsistent(Z, 1)
+        Rright = eo['inconsistent-single-tdist-depth-1']
+        eps = 1e-15
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
 
+    def test_single_inconsistent_tdist_2(self):
+        "Testing inconsistency matrix calculation (depth=2) on a single linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'single')
+        R = inconsistent(Z, 2)
+        Rright = eo['inconsistent-single-tdist-depth-2']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_single_inconsistent_tdist_3(self):
+        "Testing inconsistency matrix calculation (depth=3) on a single linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'single')
+        R = inconsistent(Z, 3)
+        Rright = eo['inconsistent-single-tdist-depth-3']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_single_inconsistent_tdist_4(self):
+        "Testing inconsistency matrix calculation (depth=4) on a single linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'single')
+        R = inconsistent(Z, 4)
+        Rright = eo['inconsistent-single-tdist-depth-4']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    # with complete linkage...
+
+    def test_complete_inconsistent_tdist_1(self):
+        "Testing inconsistency matrix calculation (depth=1) on a complete linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'complete')
+        R = inconsistent(Z, 1)
+        Rright = eo['inconsistent-complete-tdist-depth-1']
+        eps = 1e-15
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_complete_inconsistent_tdist_2(self):
+        "Testing inconsistency matrix calculation (depth=2) on a complete linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'complete')
+        R = inconsistent(Z, 2)
+        Rright = eo['inconsistent-complete-tdist-depth-2']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_complete_inconsistent_tdist_3(self):
+        "Testing inconsistency matrix calculation (depth=3) on a complete linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'complete')
+        R = inconsistent(Z, 3)
+        Rright = eo['inconsistent-complete-tdist-depth-3']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_complete_inconsistent_tdist_4(self):
+        "Testing inconsistency matrix calculation (depth=4) on a complete linkage."
+        Y = squareform(_tdist)
+        Z = linkage(Y, 'complete')
+        R = inconsistent(Z, 4)
+        Rright = eo['inconsistent-complete-tdist-depth-4']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    # with single linkage and Q data set
+
+    def test_single_inconsistent_tdist_1(self):
+        "Testing inconsistency matrix calculation (depth=1) on a weighted linkage."
+        X = eo['Q-X']
+        Z = linkage(X, 'single', 'euclidean')
+        R = inconsistent(Z, 1)
+        Rright = eo['inconsistent-Q-single-1']
+        eps = 1e-06
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_single_inconsistent_tdist_2(self):
+        "Testing inconsistency matrix calculation (depth=2) on a weighted linkage."
+        X = eo['Q-X']
+        Z = linkage(X, 'single', 'euclidean')
+        R = inconsistent(Z, 2)
+        Rright = eo['inconsistent-Q-single-2']
+        eps = 1e-06
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_single_inconsistent_tdist_3(self):
+        "Testing inconsistency matrix calculation (depth=3) on a weighted linkage."
+        X = eo['Q-X']
+        Z = linkage(X, 'single', 'euclidean')
+        R = inconsistent(Z, 3)
+        Rright = eo['inconsistent-Q-single-3']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
+    def test_single_inconsistent_tdist_4(self):
+        "Testing inconsistency matrix calculation (depth=4) on a weighted linkage."
+        X = eo['Q-X']
+        Z = linkage(X, 'single', 'euclidean')
+        R = inconsistent(Z, 4)
+        Rright = eo['inconsistent-Q-single-4']
+        eps = 1e-05
+        print np.abs(R - Rright).max()
+        self.failUnless(within_tol(R, Rright, eps))
+
 class TestCopheneticDistance(TestCase):
 
     def test_linkage_cophenet_tdist_Z(self):




More information about the Scipy-svn mailing list