index 8 is out of bounds for axis 1 with size 4
print(pd.value_counts(y_train))
class_num = len(np.unique(y_train))
print(class_num)
#onehot编码
y_train = to_categorical(y=y_train, num_classes=class_num)
print(y_train.shape)
0.0 2429
1.0 2429
3.0 2429
8.0 2429
dtype: int64
4
IndexError: index 8 is out of bounds for axis 1 with size 4
这里面就4种标签,为什么里面说8超出了范围
求解决,谢谢
代码再贴全一些