Grid search over a hyperparameter grid
Beginner classical-mlevaluationhyperparameter-tuning
Implement:
def generate_param_combinations(param_grid: dict[str, list]) -> list[dict]: ...
def grid_search(param_grid: dict[str, list], fit_and_score_fn) -> dict: ...
fit_and_score_fn is a black box you're given: it trains a model with one specific set of hyperparameters and returns a validation score, higher is better. This question doesn't care what model it is, just how to search over its hyperparameters.