这些行我总是得到相同的错误,即使这些行之前没有错误。
# prepare target
def prepare_targets(y_train, y_test):
le = LabelEncoder()
le.fit(y_train)
y_train_enc = le.transform(y_train)
y_test_enc = le.transform(y_test)
return y_train_enc, y_test_enc
y_train, y_test = prepare_targets(y_train, y_test)
print()
print('___ PREPARE TARGET ___')
print('y_train ', y_train.shape)
print('y_test ', y_test.shape)
y_train = np_utils.to_categorical(y_train)
y_test = np_utils.to_categorical(y_test)
num_classes = y_test.shape[1]
print('y_trains ', y_train.shape)
print('y_tests ', y_test.shape)
谁能建议我如何克服这个问题?