我的错误的代码是:train_labels = np_utils.to_categorical(train_labels,num_classes = 3)
错误的原因:
IndexError: index 2 is out of bounds for axis 1 with size 2
错误的具体指向:
categorical[np.arange(n), y] = 1
这是因为train_labels不是numpy.array的形式,需要把train_labels转化为numpy数组的形式
我的错误的代码是:train_labels = np_utils.to_categorical(train_labels,num_classes = 3)
错误的原因:
IndexError: index 2 is out of bounds for axis 1 with size 2
错误的具体指向:
categorical[np.arange(n), y] = 1
这是因为train_labels不是numpy.array的形式,需要把train_labels转化为numpy数组的形式
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。