[SciPy-user] SciPy-user Digest, Vol 66, Issue 9

Roy H. Han starsareblueandfaraway@gmail....
Fri Feb 6 07:42:01 CST 2009

Thanks, Josef.  This doesn't really answer my question, but thanks for
your response.

Date: Wed, 4 Feb 2009 12:44:27 -0500
From: josef.pktd@gmail.com
Subject: Re: [SciPy-user] Mysterious kmeans() error
To: SciPy Users List <scipy-user@scipy.org>
Content-Type: text/plain; charset=ISO-8859-1

On Wed, Feb 4, 2009 at 12:28 PM, Roy H. Han
<starsareblueandfaraway@gmail.com> wrote:
> As a side comment, if I use Pycluster, then the clustering proceeds
> without error.
> On Wed, Feb 4, 2009 at 11:31 AM, Roy H. Han
> <starsareblueandfaraway@gmail.com> wrote:
>> Has anyone seen this error before?  I have no idea what it means.  I'm
>> using version 0.6.0 packaged for Fedora.
>> I'm getting this error using the kmeans2() implementation in scipy.cluster.vq
>>  File "/mnt/windows/svn/networkPlanner/acquisition/libraries/probability_process.py",
>> line 55, in grapeCluster
>>    assignments = scipy.cluster.vq.kmeans2(globalCluster, k=2,
>> iter=iterationCountPerBurst)[1]
>>  File "/usr/lib64/python2.5/site-packages/scipy/cluster/vq.py", line
>> 563, in kmeans2
>>    clusters = init(data, k)
>>  File "/usr/lib64/python2.5/site-packages/scipy/cluster/vq.py", line
>> 469, in _krandinit
>>    x = N.dot(x, N.linalg.cholesky(cov).T) + mu
>>  File "/usr/lib64/python2.5/site-packages/numpy/linalg/linalg.py",
>> line 418, in cholesky
>>    Cholesky decomposition cannot be computed'
>> numpy.linalg.linalg.LinAlgError: Matrix is not positive definite -
>>    Cholesky decomposition cannot be computed

This is just a general answer, I never used scipy.cluster

The error message means that the covariance matrix of your
np.cov(data)  is not positive definite. Check your data, whether there
is any linear dependence, eg. look at eigenvalues of np.cov(data).

If that's not the source of the error, then a cluster expert is needed.


More information about the SciPy-user mailing list