Quiz Space

Machine Learning Practice · Quiz 1 · 29 Oct 2023 · September 2023 term

Question 16: Given the following code snippet involving GridSearchCV …

Question 16

+3 marksOne or more correct options

Given the following code snippet involving GridSearchCV for hyperparameter tuning of a LinearRegression model:

python
from sklearn.datasets import make_regression
from sklearn.linear_model import SGDRegressor
from sklearn.model_selection import GridSearchCV
X, y = make_regression(n_samples=200,
n_features=15,
noise=0.5,
random_state=24)
params = {'penalty': ['l1', 'l2'], 'max_iter': [500, 1000]}
reg = GridSearchCV(estimator= SGDRegressor(),
param_grid= params,
scoring= 'neg_mean_squared_error',
refit= True)
reg.fit(X, y)

Select all statements that are TRUE given this code snippet:

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • B
  • C

Question 16 of 23 in the IIT Madras BS Machine Learning Practice (MLP) Quiz 1 paper sat on 29 Oct 2023, in the September 2023 term (IIT M DIPLOMA AN2 EXAM QPD2 29 Oct 2023). It carries 3 marks.

More questions from this paper

  1. Q1Figure question
  2. Q2You are working on a machine learning project and have received a dataset containing numeric and categorical features. …
  3. Q3You’re working with a dataset that consists of training data (‘train_data’) and test data (‘test_data’). The dataset co…
  4. Q4You are working on a machine learning project that aims to predict housing prices based on various features of the hous…
  5. Q5Figure question
  6. Q6Imagine you’ve loaded a dataset with 1000 samples into a Pandas DataFrame, and each sample has 30 features. Unfortunate…
  7. Q7Choose the options with respect to the given statements:\ Statement1 : To apply various sklearn methods from in series …
  8. Q8Consider the following code: Which of the following may be the correct output of the above code?:
  9. Q9Which of the following is likely to be the correct output of the code given below?
  10. Q10You are working on optimizing a machine learning model for predicting the energy efficiency of buildings. To capture po…
  11. Q11You’re developing a regression model for predicting house prices based on various attributes of a house. Given that som…
  12. Q12You are working on a regression problem and decide to use the SGDRegressor from scikit-learn. You set up two different …
  13. Q13Which columns <u>may not</u> be included in the selected data within the code below?
  14. Q14Which of the following code blocks will correctly take the learning rate as ‘optimal’ ?
  15. Q15While performing exploratory data analysis (EDA) on a dataset, you come across some columns with a high percentage of m…
  16. Q17Given the following code snippet, how many unique values will be present in the column Z of the resulting DataFrame df?
  17. Q18What will be the output of the following code ?
  18. Q19What will be the output of the following code ?
  19. Q20You’re using GridSearchCV to optimize a Ridge regression model from scikit-learn. Consider the following hyperparameter…
  20. Q21For LinearRegression with equation Y = W_0X_0+W_1X_1+W_2X2+\epsilon and given that W_2 = \frac{5}{7} W_1 and \epsilon =…
  21. Q22Which of the following options will be the output of the given code?
  22. Q23Which of the following could be the possible output of print(reg.score())?