【发布时间】:2021-10-15 20:05:51
【问题描述】:
我正在运行这些代码行:
import tensorflow
import keras
from keras.utils import np_utils
import pickle
# Get the data into the correct format for Keras
X_train = np.array(X_train)
y_train = np.array(y_train)
X_test = np.array(X_test)
y_test = np.array(y_test)
# One hot encode the target
lb = LabelEncoder()
y_train = np_utils.to_categorical(lb.fit_transform(y_train))
y_test = np_utils.to_categorical(lb.fit_transform(y_test))
print(X_train.shape)
print(lb.classes_)
#print(y_train[0:10])
#print(y_test[0:10])
# Pickle the lb object for future use
filename = 'labels'
outfile = open(filename,'wb')
pickle.dump(lb,outfile)
outfile.close()
我收到了这个错误:
我不确定我在这里做错了什么。谁能帮我解决这个问题?
【问题讨论】: