The grid search algorithm

The grid search algorithm does this by automatically looking for the set of hyperparameters that detracts from the best performance of the model.

The sklearn.model_selection.GridSearchCV() function performs an exhaustive search over specified parameter values for an estimator. Exhaustive search (also named direct search, or brute force) is a comprehensive examination of all possibilities, and therefore represents an efficient solution method in which every possibility is tested to determine whether it is the solution.