Challenge - 5 Problems
GridSearchCV Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Understanding GridSearchCV's purpose
What is the main goal of using GridSearchCV in machine learning?
Attempts:
2 left
❓ Predict Output
intermediate2:00remaining
Output of GridSearchCV best parameters
What will be the output of print(grid_search.best_params_) after running the following code?
ML Python
from sklearn.datasets import load_iris from sklearn.svm import SVC from sklearn.model_selection import GridSearchCV iris = load_iris() X, y = iris.data, iris.target param_grid = {'C': [0.1, 1], 'kernel': ['linear', 'rbf']} svc = SVC() grid_search = GridSearchCV(svc, param_grid, cv=3) grid_search.fit(X, y) print(grid_search.best_params_)
Attempts:
2 left
❓ Hyperparameter
advanced2:00remaining
Choosing hyperparameters for GridSearchCV
Which set of hyperparameters is most appropriate to tune for a Random Forest classifier using GridSearchCV to improve model performance?
Attempts:
2 left
❓ Metrics
advanced1:30remaining
Evaluating GridSearchCV results
After running GridSearchCV, which attribute provides the mean test scores for each parameter combination tested?
Attempts:
2 left
🔧 Debug
expert2:00remaining
Identifying error in GridSearchCV usage
What error will the following code raise when executed?
from sklearn.datasets import load_iris
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
iris = load_iris()
X, y = iris.data, iris.target
param_grid = {'C': [1, 10], 'kernel': ['linear', 'rbf']}
svc = SVC()
grid_search = GridSearchCV(svc, param_grid, cv=3)
grid_search.fit(X, y)
print(grid_search.best_params_)
print(grid_search.best_estimator_)
print(grid_search.predict(X))Attempts:
2 left