Implement a function that performs random search over a given search space. Random search is a simple yet effective method for hyperparameter tuning in machine learning models.
**Example:** Suppose we want to search for the best learning rate and batch size for a neural network. We can define a search space with 5 possible learning rates and 3 possible batch sizes.
**Constraints:** The search space should be represented as a dictionary where each key is a hyperparameter name and each value is a list of possible values for that hyperparameter.
**Hint:** Use NumPy's random.choice function to sample hyperparameters from the search space.
Test Cases
Test Case 1
Input:
{"learning_rate": [0.1, 0.5, 0.01, 0.05, 0.001], "batch_size": [32, 64, 128]}Expected:
{"learning_rate": 0.5, "batch_size": 64}Test Case 2
Input:
{"learning_rate": [0.1, 0.5, 0.01, 0.05, 0.001], "batch_size": [32, 64, 128]}Expected:
{"learning_rate": 0.01, "batch_size": 128}+ 3 hidden test cases