### Problem: Grid Search Implementation
You are given a set of hyperparameters to search over and a machine learning model to evaluate. Write a function that performs a grid search over the hyperparameters to find the best combination that results in the highest accuracy.
#### Example:
Suppose we have a set of hyperparameters hyperparameters to search over and a machine learning model model to evaluate. We can use the function to perform a grid search as follows:
hyperparameters = {'learning_rate': [0.1, 0.5, 1.0], 'batch_size': [32, 64, 128]}
model = ... # load the machine learning model
best_hyperparameters, best_accuracy = grid_search(hyperparameters, model)
Test Cases
Test Case 1
Input:
{"learning_rate": [0.1, 0.5, 1.0], "batch_size": [32, 64, 128]}Expected:
{\"learning_rate\": 0.1, \"batch_size\": 32}Test Case 2
Input:
{"learning_rate": [0.1, 0.5, 1.0], "batch_size": [32, 64, 128]}Expected:
{\"learning_rate\": 0.1, \"batch_size\": 32}+ 3 hidden test cases