Skip to content
C

Problem 2: Perform Random Search with Multiple Hyperparameters

Easypython

Problem Description

Write a Python program that uses RandomizedSearchCV to tune both n_estimators and max_depth for a Random Forest, trying only a limited number of random combinations.

Input

A labeled dataset and search space for both hyperparameters.

Output

The best combination found and its score.

Constraints

  • Use n_iter=4 or similar to limit the search.

Example Input

text
(A labeled dataset, n_estimators: [50,100,200], max_depth: [3,5,None])

Example Output

text
Best parameters: {'n_estimators': 100, 'max_depth': 5} Best score: 0.89

Concepts Covered

RandomizedSearchCV, n_iter.

Input (stdin)

Output

Run your code to see output here...