Explore Library
Code QuizIntermediate

Nested Cross-Validation Estimate

Reporting a grid search's best_score_ as an unbiased performance estimate.

Codepython
from sklearn.model_selection import GridSearchCV, cross_val_score

grid = GridSearchCV(model, param_grid, cv=5)
grid.fit(X, y)

# 'Unbiased' generalization estimate
print('Score:', grid.best_score_)

Why is grid.best_score_ not an unbiased estimate here?