What is the difference between loss
, metrics
and scoring
in building a keras
model? Should they be different or same? In a typical model, we use all of the three forGridSearchCV
.
Here is the snapshot of a typical model for regression which uses all the three.
def create_model():
model = Sequential()
model.add(Dense(12, input_dim=1587, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='mean_squared_error', optimizer='adam', metrics=['mean_squared_error'])
return model
model = KerasRegressor(build_fn=create_model, verbose=0)
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, scoring='r2' n_jobs=-1)
grid_result = grid.fit(X, Y)