uiz Space

May 2022 term · Machine Learning Practice · BSCS2008

Machine Learning Practice Quiz 2: 10 July 2022 (May 2022 term)

The IIT Madras BS Machine Learning Practice (MLP) Quiz 2 paper sat on 10 Jul 2022, in the May 2022 term: 21 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
21
Marks
50
Duration
120 min
MCQ
16
MSQ
1
Numerical
4

Updated

Official paper: IIT M DIPLOMA QUIZ2 EXAM QPE1 10 July 2022 · No negative marking.

Question 1

+1 markOne correct option

Which of the following vectorizer techniques can help to convert a large collection of text documents to a matrix?

  1. A

    CountVectorizer

  2. B

    HashingVectorizer

  3. C

    Both CountVectorizer and HashingVectorizer

  4. D

    None of these

Show answer

Correct answer

  • B

    HashingVectorizer

Question 2

+2 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 3

+2 marksOne correct option
  1. A

    0.0

  2. B

    1.0

  3. C

    -1.0

  4. D

    0.5

Show answer

Correct answer

  • B

    1.0

Question 4

+2 marksOne correct option

Which of the options below represent the correct method to preprocess class labels in multi-class setup?

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

Correct answer

  • C

Question 5

+2 marksOne correct option

Which of the following options will be the output of the following code block?

python
from sklearn.feature_extraction.text import TfidfVectorizer
corpus = [
'This is the first document.',
'And is this the second one?',
]
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(corpus)
vectorizer.get_feature_names_out()
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 6

+2 marksOne correct option
  1. A

    0.65

  2. B

    0.73

  3. C

    0.37

  4. D

    None of these

Show answer

Correct answer

  • B

    0.73

Question 7

+2 marksOne correct option

Rakesh is solving a regression problem with a KNN model. He has considered k = 3 for his model. Based on the graph shown below, what would you suggest him out of the following options?

  1. A

    His model is suffering from overfitting. So, he should increase the value of k.

  2. B

    His model is suffering from underfitting. So, he should increase the value of k.

  3. C

    His model is suffering from overfitting. So, he should decrease the value of k.

  4. D

    His model is suffering from underfitting. So, he should decrease the value of k.

  5. E

    No suggestions, Rakesh has already chosen the best value of k.

Show answer

Correct answer

  • A

    His model is suffering from overfitting. So, he should increase the value of k.

Question 8

+2 marksOne correct option

l1 penalty in LinearSVC classifier leads to coef_vectors which are-

  1. A

    dense.

  2. B

    sparse.

  3. C

    Unique class labels.

  4. D

    l1 penalty can’t be set via a parameter in LinearSVC.

Show answer

Correct answer

  • B

    sparse.

Question 9

+3 marksOne correct option
  1. A

    1

  2. B

    0

  3. C

    0.5

  4. D

    0.40

Show answer

Correct answer

  • C

    0.5

Question 10

+3 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 11

+3 marksOne correct option
  1. A

    The classifier shown in ‘Curve B’ is better than the other two classifiers.

  2. B

    The classifier shown in ‘Curve A’ is better than the other two classifiers.

  3. C

    The classifier shown in ‘Curve C’ is better than the other two classifiers.

  4. D

    All 3 curves demonstrate 3 classifiers of the same quality.

Show answer

Correct answer

  • B

    The classifier shown in ‘Curve A’ is better than the other two classifiers.

Question 12

+3 marksOne correct option

For a text classification task, which one of the following code snippets will be better suitable than the others?

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

Correct answer

  • B

Question 13

+3 marksOne correct option

Which of the following will be the correct output of the code snippet given below?

python
from sklearn.neighbors import KNeighborsClassifier
X = [[2,3], [5,6], [10,11], [15,16],[20,21]]
y = [0, 0, 1, 1, 2]
neigh = KNeighborsClassifier(n_neighbors=3)
neigh.fit(X, y)
print(neigh.predict([[8,9]]))
  1. A

    0

  2. B

    1

  3. C

    2

  4. D

    None

Show answer

Correct answer

  • A

    0

Question 14

+3 marksOne correct option

What is the output of the following block of code?

python
import numpy as np
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
X = np.array([[2, 4], [4, 2]])
y = np.array([-1, 1])
from sklearn.svm import SVC
clf = make_pipeline(StandardScaler(), SVC(kernel='linear'))
clf.fit(X, y)
print(clf.predict([[-2,2]]))
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 15

+3 marksOne correct option

Consider the following code snippet and mark the correct output.

python
from sklearn.svm import SVC
import numpy as np
X = np.array([[-1, -1], [-2, -2], [1, 1], [2, 2]])
y = np.array([-1, -1, 1, 1])
clf = SVC(kernel='linear')
clf.fit(X, y)
print(clf.n_support_)
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 16

+3 marksOne or more correct options

Which of the following code blocks will correctly train a large scale regression model using partial_fit, if shape of X_train,Y_train are given as (8000,900,10) and (8000,900) respectively. Note that the dataset has been transformed into batches of size 900 each?

Select all that apply.

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

Correct answers

  • B
  • D

Question 17

+3 marksNumerical answer
Show answer

Correct answer: 6

Question 18

+1.5 marksNumerical answer

Calculate the precision value (up to 3 decimal places) from the confusion matrix.

Show answer

Correct answer: 0.975 (accepted within ±0.005)

Question 19

+1.5 marksNumerical answer

Calculate the recall value (up to 3 decimal places) from the confusion matrix.

Show answer

Correct answer: 0.93 (accepted within ±0.005)

Question 20

+2 marksOne correct option

What is the output that Prashant will get?

  1. A

    Indices of support vectors.

  2. B

    Number of support vectors.

  3. C

    Weights assigned to the features when kernel=”linear”

  4. D

    ndarray of support vectors.

Show answer

Correct answer

  • D

    ndarray of support vectors.

Question 21

+3 marksNumerical answer
Show answer

Correct answer: 4