Quiz Space

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

Question 3: You’re working with a dataset that consists of training d…

Question 3

+2 marksOne correct option

You’re working with a dataset that consists of training data (‘train_data’) and test data (‘test_data’). The dataset contains both numerical and categorical features. You decide to employ a combination of ‘StandardScaler’ (for numerical columns) and ‘OneHotEncoder’ (for categorical columns) from ‘scikit-learn’ using the ‘ColumnTransformer’ utility. Which of the following actions is MOST likely to introduce data leakage or potential modeling issues?

  1. A

    You utilize ‘fit_transform’ on ‘train_data’ and then ‘transform’ on ‘test_data’ using the ‘ColumnTransformer’.

  2. B

    After observing a new category in the test data that was not present in the training data, you set the ‘handle_unknown’ parameter to ’ignore’ in ‘OneHotEncoder’.

  3. C

    You first apply ‘fit’ on the ‘test_data’ and then ‘transform’ on ‘train_data’ using the ‘ColumnTransformer’.

  4. D

    Before using ‘ColumnTransformer’, you independently apply ‘fit_transform’ to ‘train_data’ for both ‘StandardScaler’ and ‘OneHotEncoder’.

Show answer

Correct answer

  • C

    You first apply ‘fit’ on the ‘test_data’ and then ‘transform’ on ‘train_data’ using the ‘ColumnTransformer’.

Question 3 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 2 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. Q4You are working on a machine learning project that aims to predict housing prices based on various features of the hous…
  4. Q5Figure question
  5. Q6Imagine you’ve loaded a dataset with 1000 samples into a Pandas DataFrame, and each sample has 30 features. Unfortunate…
  6. Q7Choose the options with respect to the given statements:\ Statement1 : To apply various sklearn methods from in series …
  7. Q8Consider the following code: Which of the following may be the correct output of the above code?:
  8. Q9Which of the following is likely to be the correct output of the code given below?
  9. Q10You are working on optimizing a machine learning model for predicting the energy efficiency of buildings. To capture po…
  10. Q11You’re developing a regression model for predicting house prices based on various attributes of a house. Given that som…
  11. Q12You are working on a regression problem and decide to use the SGDRegressor from scikit-learn. You set up two different …
  12. Q13Which columns <u>may not</u> be included in the selected data within the code below?
  13. Q14Which of the following code blocks will correctly take the learning rate as ‘optimal’ ?
  14. Q15While performing exploratory data analysis (EDA) on a dataset, you come across some columns with a high percentage of m…
  15. Q16Given the following code snippet involving GridSearchCV for hyperparameter tuning of a LinearRegression model: Select a…
  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())?