Skip to content
C

Problem 1: Perform Basic Grid Search

Easypython

Problem Description

Write a Python program that uses GridSearchCV to tune a Decision Tree's max_depth hyperparameter over a small set of candidate values, and prints the best parameters and score.

Input

A labeled dataset and a set of candidate max_depth values.

Output

The best max_depth value and its Cross-Validation score.

Constraints

  • At least 10 labeled examples.

Example Input

text
(A labeled dataset, max_depth candidates: [2, 4, 6, None])

Example Output

text
Best parameters: {'max_depth': 4} Best score: 0.87

Concepts Covered

GridSearchCV, .best_params_, .best_score_.

Input (stdin)

Output

Run your code to see output here...