我正试图在RandomizedSearchCV上运行模型,以获得最佳的超参数
model = keras.models.Sequential([keras.layers.Dense(300, input_dim=7500, activation="relu"),
keras.layers.Dense(300, activation = "relu", name = "Intermediate"),
keras.layers.Dense(100, activation = "relu"),
keras.layers.Dense(4, activation="softmax")])
keras_cls = keras.wrappers.scikit_learn.KerasClassifier(model)
param_distribs = {
"n_hidden": [0, 1, 2, 3],
"n_neurons": np.arange(1, 300),
"learning_rate": 1e-3
}
rnd_search_cv = RandomizedSearchCV(keras_cls, param_distribs, n_iter=10, cv=3)
rnd_search_cv.fit(x_train, y_train, epochs=30,
validation_data=(x_test, y_test),
callbacks=[keras.callbacks.EarlyStopping(patience=10)])
在
rmd_search_cv.fit
我得到了错误
TypeError: can't pickle _thread.RLock objects
应该做些什么来纠正错误?