0
0
ML Pythonprogramming~10 mins

RandomizedSearchCV in ML Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the RandomizedSearchCV class from scikit-learn.

ML Python
from sklearn.model_selection import [1]
Drag options to blanks, or click blank then click option'
ARandomizedSearchCV
Btrain_test_split
CGridSearchCV
Dcross_val_score
Attempts:
3 left
2fill in blank
medium

Complete the code to create a RandomizedSearchCV object with a model and parameter distribution.

ML Python
search = RandomizedSearchCV(estimator=[1], param_distributions=param_dist, n_iter=10, cv=5)
Drag options to blanks, or click blank then click option'
Ay_train
Bparam_dist
CX_train
Dmodel
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to fit the RandomizedSearchCV object on training data.

ML Python
search.[1](X_train, y_train)
Drag options to blanks, or click blank then click option'
Afit
Bpredict
Cscore
Dtransform
Attempts:
3 left
4fill in blank
hard

Fill both blanks to access the best parameters and best score after fitting.

ML Python
best_params = search.[1]
best_score = search.[2]
Drag options to blanks, or click blank then click option'
Abest_params_
Bbest_score_
Cbest_estimator_
Dcv_results_
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to create a parameter distribution dictionary for RandomizedSearchCV.

ML Python
param_dist = {
    'n_estimators': [1],
    'max_depth': [2],
    'criterion': [3]
}
Drag options to blanks, or click blank then click option'
Arange(10, 101, 10)
B[None, 10, 20, 30]
C['gini', 'entropy']
D[1, 2, 3]
Attempts:
3 left