[SciPy-dev] scipy.cluster

Damian Eads eads at soe.ucsc.edu
Tue Nov 11 00:39:57 EST 2008


Nils,

Can you confirm my changes work now for you?

Thanks.

Damian

On Mon, Nov 10, 2008 at 9:57 AM, Damian Eads <eads at soe.ucsc.edu> wrote:
> Hi Nils,
>
> Several months ago someone changed the dtype=<some string> to
> dtype=np.typename in hierarchy.py. This works without incident when
> passing an array created with dtype=np.float to C code that operates
> on a double *. However, with ints, numpy.int and 'i' both yield two
> different array data types on 64-bit machines.
>
>>>> import numpy
>>>> numpy.array([], dtype=numpy.int)
> array([], dtype=int64)
>>>> numpy.array([], dtype='i')
> array([], dtype=int32)
>>>>
>
> The 'i' string corresponds to the C-type int, correctly whereas
> numpy.int does not. Changing the dtype fields back to 'i' for these
> arrays should fix the problem on 64-bit machines. I committed the fix.
> Please let me know if this works.
>
> Thanks,
>
> Damian
>
>
> On Mon, Nov 10, 2008 at 4:06 AM, Nils Wagner
> <nwagner at iam.uni-stuttgart.de> wrote:
>>>>> from scipy import cluster
>>>>> cluster.test()
>> ======================================================================
>> FAIL: Tests fcluster(Z, criterion='maxclust', t=2) on a
>> random 3-cluster data set.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/cluster/tests/test_hierarchy.py",
>> line 457, in test_fcluster_maxclusts_2
>>     self.failUnless(is_isomorphic(T, expectedT))
>> AssertionError
>>
>> ======================================================================
>> FAIL: Tests fcluster(Z, criterion='maxclust', t=3) on a
>> random 3-cluster data set.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/cluster/tests/test_hierarchy.py",
>> line 466, in test_fcluster_maxclusts_3
>>     self.failUnless(is_isomorphic(T, expectedT))
>> AssertionError
>>
>> ======================================================================
>> FAIL: Tests fcluster(Z, criterion='maxclust', t=4) on a
>> random 3-cluster data set.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/cluster/tests/test_hierarchy.py",
>> line 475, in test_fcluster_maxclusts_4
>>     self.failUnless(is_isomorphic(T, expectedT))
>> AssertionError
>>
>> ======================================================================
>> FAIL: Tests fclusterdata(X, criterion='maxclust', t=2) on
>> a random 3-cluster data set.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/cluster/tests/test_hierarchy.py",
>> line 434, in test_fclusterdata_maxclusts_2
>>     self.failUnless(is_isomorphic(T, expectedT))
>> AssertionError
>>
>> ======================================================================
>> FAIL: Tests fclusterdata(X, criterion='maxclust', t=3) on
>> a random 3-cluster data set.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/cluster/tests/test_hierarchy.py",
>> line 441, in test_fclusterdata_maxclusts_3
>>     self.failUnless(is_isomorphic(T, expectedT))
>> AssertionError
>>
>> ======================================================================
>> FAIL: Tests fclusterdata(X, criterion='maxclust', t=4) on
>> a random 3-cluster data set.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/cluster/tests/test_hierarchy.py",
>> line 448, in test_fclusterdata_maxclusts_4
>>     self.failUnless(is_isomorphic(T, expectedT))
>> AssertionError
>>
>> ----------------------------------------------------------------------
>> Ran 166 tests in 20.086s
>>
>> FAILED (errors=1, failures=6)
>> <nose.result.TextTestResult run=166 errors=1 failures=6>
>>>>> from scipy import cluster
>>>>> scipy.__version__
>> '0.7.0.dev5035'
>>
>> ======================================================================
>> ERROR: Tests leaders using a flat clustering generated by
>> single linkage.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File
>> "/data/home/nwagner/local/lib/python2.5/site-packages/scipy/cluster/tests/test_hierarchy.py",
>> line 487, in test_leaders_single
>>     self.failUnless((L[0] == Lright[0]).all() and (L[1]
>> == Lright[1]).all())
>> AttributeError: 'bool' object has no attribute 'all'

-----------------------------------------------------
Damian Eads                             Ph.D. Student
Jack Baskin School of Engineering, UCSC        E2-489
1156 High Street                 Machine Learning Lab
Santa Cruz, CA 95064    http://www.soe.ucsc.edu/~eads



More information about the SciPy-Dev mailing list