Arrays usados ​​como índices devem ser do tipo inteiro (ou booleano)

Erros são assim:

Traceback (most recent call last):
  File "NearestCentroid.py", line 53, in <module>
    clf.fit(X_train.todense(),y_train)
  File "/usr/local/lib/python2.7/dist-packages/scikit_learn-0.13.1-py2.7-linux-i686.egg/sklearn/neighbors/nearest_centroid.py", line 115, in fit
    variance = np.array(np.power(X - self.centroids_[y], 2))
IndexError: arrays used as indices must be of integer (or boolean) type

Códigos são assim:

distancemetric=['euclidean','l2']
for mtrc in distancemetric:
for shrkthrshld in [None]:
#shrkthrshld=0
#while (shrkthrshld <=1.0):
    clf = NearestCentroid(metric=mtrc,shrink_threshold=shrkthrshld)
    clf.fit(X_train.todense(),y_train)
    y_predicted = clf.predict(X_test.todense())

estou usandoscikit-learn pacote,X-train, y_train estão no formato LIBSVM,X é o recurso: par de valor,y_train é o alvo / rótulo,X_train está no formato matricial CSR, oshrink_threshold não suporta matriz esparsa CSR, então eu adiciono.todense() paraX_train, então eu tenho esse erro, alguém poderia me ajudar a consertar isso? Muito obrigado!

questionAnswers(3)

yourAnswerToTheQuestion