How to make GridSearchCV faster?

12 Views Asked by At
# Defining KerasClassifier to use with GridSearchCV
model = KerasClassifier(build_fn=cnn_model, epochs=10, batch_size=64, verbose=0)

# Defining hyperparameters to tune
param_grid = {
    'optimizer': ['adam'],
    'activation': ['relu'],
    'neurons': [64, 128, 256]
}

# Performing Grid Search Cross Validation
grid = GridSearchCV(estimator=model, param_grid=param_grid, cv=3, verbose=1, n_jobs = -1)
grid_result = grid.fit(X_train, y_train)

# Printing the best hyperparameters found
print("Best: %f using %s" % (grid_result.best_score_, grid_result.best_params_))


# Getting the best hyperparameters from GridSearchCV
best_params = grid_result.best_params_

I am running this on cifar10 dataset for an assignment and its taking so much time

I tried to add n_jobs but it didnt improve much

0

There are 0 best solutions below