WeCodeAcademy

Tuning with Grid Search

Settings you choose before training, such as n_neighbors or max_depth, are hyperparameters. GridSearchCV tries every combination you list, scores each with cross-validation and keeps the best.

Examplepython
Open in editor »
Quick check

What is a hyperparameter?

Your turn: write the code

Search max_depth over [1, 2, 3] for a decision tree with 5-fold cross-validation and print the best max_depth.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.