I got the problem now, it should have been
laplacian.flat[::n_nodes + 1].


On 08/27/2012 01:48 PM, Andreas Mueller wrote:
Hi everybody.
Today I fixed a pretty bad bug <https://github.com/scikit-learn/scikit-learn/commit/7883d7a3f8b16e5c8766a5a31c1263f041eff333>in SpectralClustering, that caused one example to be in it's own cluster
and lead to a incorrect graph laplacian.
Olivier suggested I write to the list to prevent this bug from happening again.

The offending line is
laplacian[::n_nodes + 1] = 0

which was supposed to set the diagonal to zero, but set the first row to zero.
I have no idea why this line does what it does, but observe:
 gx, gy = np.mgrid[:10, :10]

gx[::10] == np.zeros(10)
gx[::11] == np.zeros(10)
In fact
gx[::10 + x] == np.zeros(10)
for any number x.
Not sure if this should be considered a bug in numpy or what.

Cheers,
Andy


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to