What is the purpose of Grid Search in machine learning?
A
To train the model faster
B
To find the best combination of hyperparameters
D
To visualize the confusion matrix
Analysis & Theory
Grid Search exhaustively tries all combinations of specified hyperparameters to find the best model performance.
Which library in Python provides `GridSearchCV`?
C
sklearn.model_selection
Analysis & Theory
`GridSearchCV` is provided by `sklearn.model_selection` for performing grid search with cross-validation.
What does 'CV' stand for in `GridSearchCV`?
Analysis & Theory
CV stands for Cross Validation, which is used during Grid Search to evaluate each hyperparameter set.
What does Grid Search do with the hyperparameters?
B
Optimizes only one parameter
C
Tests every possible combination
D
Uses default values only
Analysis & Theory
Grid Search exhaustively tests all combinations of the specified hyperparameter values.
Which argument in `GridSearchCV` specifies the hyperparameters to test?
Analysis & Theory
`param_grid` is a dictionary that specifies the hyperparameter combinations to try.
Which parameter in `GridSearchCV` defines how many cross-validation folds to use?
Analysis & Theory
`cv` determines how many folds are used in cross-validation while evaluating each parameter set.
What is the main drawback of Grid Search?
A
It doesn't support classification
B
It doesn't work with scikit-learn
C
It is computationally expensive
D
It only works with neural networks
Analysis & Theory
Grid Search is time-consuming and resource-intensive since it evaluates all possible parameter combinations.
What is returned by `GridSearchCV.best_params_`?
A
The entire training dataset
B
A list of all tested models
C
The combination of hyperparameters with the best score
D
The average of all model scores
Analysis & Theory
`.best_params_` returns the hyperparameter values that gave the best model performance.
How can you evaluate the best model from `GridSearchCV`?
A
Using `best_estimator_.predict()`
B
Using `fit_transform()`
C
Using `confusion_matrix()` directly
D
Using `param_grid.plot()`
Analysis & Theory
The best model found can be accessed with `.best_estimator_` and used like any other trained model.
Which of the following is a faster alternative to Grid Search?
Analysis & Theory
Random Search tries random combinations of parameters and is generally faster than exhaustive grid search.