【发布时间】:2018-11-02 02:32:18
【问题描述】:
在进行网格搜索时,我的顺序密集 DNN 似乎遍历了我的参数网格中的每个参数 3 次。我希望它在网格中每个指定的 epcoh 运行一次:10、50 和 100。为什么会发生这种情况?
模型架构:
def build_model():
print('building DNN architecture')
model = Sequential()
model.add(Dropout(0.02, input_shape = (150,)))
model.add(Dense(8, init = 'normal', activation = 'relu'))
model.add(Dropout(0.02))
model.add(Dense(16, init = 'normal', activation = 'relu'))
model.add(Dense(1, init = 'normal'))
model.compile(loss = 'mean_squared_error', optimizer = 'adam')
print('model succesfully compiled')
return model
时代的网格搜索:
from sklearn.model_selection import GridSearchCV
epochs = [10,50,100]
param_grid = dict(epochs = epochs)
grid = GridSearchCV(estimator = KerasRegressor(build_fn = build_model), param_grid = param_grid)
grid_result = grid.fit(x_train, y_train)
grid_result.best_params_
【问题讨论】:
-
您能添加一些数据以便我重现问题吗?
标签: neural-network deep-learning grid-search