出错啦,怎么解决呀 :TypeError: list indices must be integers or slices, not tuple

请问圈内的好友,这个问题怎末解决啊,我试了好多方法,都没能解决,谢谢


y_score  = clf.predict(x_test)  
lw = 2  
n_classes = 6
fpr = dict()  
tpr = dict()  
roc_auc = dict()  
for i in range(n_classes):  
    fpr[i], tpr[i], _ = roc_curve(y_test[:, i], y_score[:, i]) #(这一行报错) 
    roc_auc[i] = auc(fpr[i], tpr[i]) 

img

y_test y_score是怎么样的数据结构 shape是怎样的 是不是少了一层[] 应该y_test[[:, i]], y_score[[:, i]]

列表取片操作易错点(list indices must be integers or slices, not tuple原因及解决方法)_Pika_T的博客-CSDN博客 list indices must be integers or slices, not tuple原因及解决方法场景:在对列表进行取数据时报错,报错代码:TypeError: list indices must be integers or slices, not tuple翻译:列表索引必须是整数(取某一个数据,例如:data[0])或者片(取某一片数据,例如data[0:2]),不能是元组(tuple是元组的意思)原因:当我们用data=[]并通过append等方法创建数据时,创建的d https://blog.csdn.net/Pika_T/article/details/115300058