Challenge - 5 Problems
RandomizedSearchCV Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding RandomizedSearchCV Sampling
Which statement best describes how RandomizedSearchCV selects hyperparameter combinations during tuning?
Attempts:
2 left
❓ Predict Output
intermediate2:00remaining
Output of RandomizedSearchCV Best Parameters
What will be the output of the following code snippet?
ML Python
from sklearn.datasets import load_iris from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import RandomizedSearchCV import numpy as np iris = load_iris() X, y = iris.data, iris.target param_dist = {'n_estimators': [10, 50], 'max_depth': [2, 4]} clf = RandomForestClassifier(random_state=42) search = RandomizedSearchCV(clf, param_distributions=param_dist, n_iter=2, random_state=42) search.fit(X, y) print(search.best_params_)
Attempts:
2 left
❓ Hyperparameter
advanced2:00remaining
Choosing n_iter in RandomizedSearchCV
What is the effect of increasing the n_iter parameter in RandomizedSearchCV?
Attempts:
2 left
❓ Metrics
advanced2:00remaining
Evaluating RandomizedSearchCV Results
After running RandomizedSearchCV, which attribute gives the mean test score for each parameter combination tested?
Attempts:
2 left
🔧 Debug
expert2:00remaining
Debugging RandomizedSearchCV with Incorrect Parameter Distribution
What error will the following code raise?
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import RandomizedSearchCV
iris = load_iris()
X_train, y_train = iris.data, iris.target
param_dist = {'n_estimators': 100, 'max_depth': [3, 5, 7]}
clf = RandomForestClassifier()
search = RandomizedSearchCV(clf, param_distributions=param_dist, n_iter=2)
search.fit(X_train, y_train)Attempts:
2 left