Python 3.x NotImplementedError:\uuuuu deepcopy\uuuuuuuo()仅在启用紧急执行时可用
我正在使用GridSearchCV为我的LSTM模型调整超参数:Python 3.x NotImplementedError:\uuuuu deepcopy\uuuuuuuo()仅在启用紧急执行时可用,python-3.x,tensorflow,Python 3.x,Tensorflow,我正在使用GridSearchCV为我的LSTM模型调整超参数: def compile_lstm(self): '''create the layers''' self.model = keras.models.Sequential() self.model.add(keras.layers.LSTM(50)) self.model.add(keras.layers.Dense(1, activation='softmax')) self.m
def compile_lstm(self):
'''create the layers'''
self.model = keras.models.Sequential()
self.model.add(keras.layers.LSTM(50))
self.model.add(keras.layers.Dense(1, activation='softmax'))
self.model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['acc'])
model = KerasClassifier(build_fn=self.model, verbose=0)
# define the grid search parameters
batch_size = [10, 20, 40, 60, 80, 100]
epochs = [10, 50, 100]
param_grid = dict(batch_size=batch_size, epochs=epochs)
grid = GridSearchCV(estimator=model, param_grid=param_grid, n_jobs=-1)
X = self.X
Y = self.Y
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.20, random_state=42)
grid_result = grid.fit(X, Y)
# summarize results
print("Best: %f using %s" % (grid_result.best_score_, grid_result.best_params_))
means = grid_result.cv_results_['mean_test_score']
stds = grid_result.cv_results_['std_test_score']
params = grid_result.cv_results_['params']
for mean, stdev, param in zip(means, stds, params):
print("%f (%f) with: %r" % (mean, stdev, param))
但我得到了以下错误:
NotImplementedError:deepcopy()仅在启用了紧急执行时可用
我怎样才能解决这个问题