Quiz Space

Machine Learning Practice · Quiz 1 · 25 Feb 2024 · January 2024 term

Question 22: Consider the below code : keep following symbols in mind…

Question 22

+3 marksOne or more correct options

Consider the below code :

keep following symbols in mind:

  • >>>: Represents input code
  • # : Represents comment in a code
  • ... : Represents code continuation
  • Without any symbols at the beginning of a line then it is output of just above input line of code.
  • arrow pointing towards right is code continuation to another line.
python
>>> from sklearn.feature_selection import SelectKBest, chi2
>>> from sklearn.datasets import load_wine
>>> X,y = load_wine(return_X_y=True,as_frame=True)
>>> print(X.shape)
(178, 13)
>>> print(X.columns)
['alcohol', 'malic_acid', 'ash', 'alcalinity_of_ash', 'magnesium',
'total_phenols', 'flavanoids', 'nonflavanoid_phenols', 'proanthocyanins',
'color_intensity', 'hue', 'od280/od315_of_diluted_wines', 'proline']
>>> skb = SelectKBest(chi2, k=3)
>>> X_selected = skb.fit_transform(X, y)
>>> print(skb.scores_)
[5.44, 28.06, 0.74, 29.38, 45.02, 15.62, 63.33, 1.81,
9.36, 109.01, 5.18, 23.38, 16540.06]
>>> print(skb.pvalues_)
[6.56e-02, 8.03e-07, 0.68, 4.16e-07, 1.66e-10, 4.05e-04,
1.76e-14, 0.40, 9.24e-03, 2.12e-24, 0.074, 8.33e-06, 0]
>>> print(skb.pvalues_.argsort())
[12, 9, 6, 4, 3, 1, 11, 5, 8, 0, 10, 7, 2]

Which of the following feature(s) will be selected in X_selected from X ?

Select all that apply.

  1. A

    malic_acid

  2. B

    magnesium

  3. C

    flavanoids

  4. D

    proanthocyanins

  5. E

    color_intensity

  6. F

    proline

Show answer

Correct answers

  • C

    flavanoids

  • E

    color_intensity

  • F

    proline

Question 22 of 24 in the IIT Madras BS Machine Learning Practice (MLP) Quiz 1 paper sat on 25 Feb 2024, in the January 2024 term (IIT M DIPLOMA AN2 EXAM QDD2 25 Feb 2024). It carries 3 marks.

More questions from this paper

  1. Q1| | sex | age | sibsp | parch | fare | class | embark_town | alive | alone | |---|---|---|---|---|---|---|---|---|---| …
  2. Q2| | sex | age | sibsp | parch | fare | class | embark_town | alive | alone | |---|---|---|---|---|---|---|---|---|---| …
  3. Q3| | sex | age | sibsp | parch | fare | class | embark_town | alive | alone | |---|---|---|---|---|---|---|---|---|---| …
  4. Q4| | sex | age | sibsp | parch | fare | class | embark_town | alive | alone | |---|---|---|---|---|---|---|---|---|---| …
  5. Q5| | sex | age | sibsp | parch | fare | class | embark_town | alive | alone | |---|---|---|---|---|---|---|---|---|---| …
  6. Q6Figure question
  7. Q7You are working on a machine learning project that aims to predict housing prices based on various features of the hous…
  8. Q8A company collects 40000 samples (examples) to build a Machine Learning model for an application. They decide to use 30…
  9. Q9Choose the option based on the following statements:\ Statement 1: The train-test split allows us to simulate the model…
  10. Q10In which of the following scenarios is data cleaning most required?
  11. Q11Consider the below code: What will be the output of the code snippet given above?
  12. Q12Which of the following metrics indicate higher their value, better the regression model’s performance?
  13. Q13How many models with different combinations of parameter values will get trained in the following code?
  14. Q14Figure question
  15. Q15Consider the following code: Which metrics will be contained in score1 and score2 respectively?
  16. Q16Consider following dataset: | HouseAge | AveRooms | Population | City | IncomeGroup | |---|---|---|---|---| | 41.0 | 6.…
  17. Q17Suppose that we plot the histogram of numerical features in a data set. This reveals which of the following information?
  18. Q18Figure question
  19. Q19Which of the following are valid loss functions for SGDClassifier?
  20. Q20Which columns <u>will not</u> be included in the selected data within the code below?
  21. Q21Which of the following Evaluation metrics can be used in a regression problem?
  22. Q23Given the following code snippet, which statement is true regarding the use of LabelEncoder?
  23. Q24What will be the output of the following code ?