It is very strange in Python that, I need specify the return vector and print them out. My original code is:
import scipy.cluster.vq as spk
result = spk.kmeans2(dataset, 5)
print result.label
or like this:
import scipy.cluster.vq as spk
print spk.kmeans2(dataset, 5).label
I got an error: AttributeError: 'tuple' object has no attribute 'label'
However, when I change the code to:
import scipy.cluster.vq as spk
code, label = spk.kmeans2(dataset, 5)
print label
The code works fine. So what is the problem?