Quiz Space

May 2022 term · Machine Learning Techniques · BSCS2007

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

The IIT Madras BS Machine Learning Techniques (MLT) Quiz 2 paper sat on 10 Jul 2022, in the May 2022 term: 25 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
25
Marks
50
Duration
120 min
MCQ
12
MSQ
4
Numerical
9

Updated

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

Question 1

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

Correct answer

  • B

Question 2

+2 marksOne correct option

A logistic regression model is being trained on a dataset of size 2n2n. The first nn data-points belong to class-1 and the rest in class-0. Note that we are talking about the true label here.

Class-1={x1,⋯ ,xn}Class-0={xn+1,⋯ ,x2n}\begin{aligned} &\text{Class-1} = \{x_1, \cdots, x_n\} \\ &\text{Class-0} = \{x_{n+1}, \cdots, x_{2n}\} \end{aligned}

The probability output by the model at any step in the training process is given by:

P(y=1∣xi)=piP(y = 1 \mid x_i) = p_i

Which of the following expressions is the loss of the model?

NOTE: We use the binary cross entropy loss for logistic regression. Labels are 1 and 0 for the two classes.

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

Correct answer

  • A

Question 3

+2 marksOne correct option
  1. A
  2. B
  3. C
  4. D
  5. E
  6. F
Show answer

Correct answer

  • A

Question 4

+2 marksOne correct option
  1. A

    Bernoulli NB

  2. B

    Categorical NB

  3. C

    Multinomial NB

  4. D

    Gaussian NB

Show answer

Correct answer

  • A

    Bernoulli NB

Question 5

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

Correct answer

  • D

Question 6

+2 marksOne correct option

Which of the following could be the decision boundary learned by a hard-margin SVM? Choose the most appropriate option.
NOTE: The dataset is the same for all four options.

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

Correct answer

  • C

Question 7

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

Correct answer

  • D

Question 8

+2 marksOne or more correct options

Select all that apply.

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

Correct answer

  • B

Question 9

+2 marksOne or more correct options

Which of the following could be the vector of probabilities output by a softmax regression model for 5 classes? Note that the options are independent of each other.

Select all that apply.

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

Correct answers

  • A
  • B

Question 10

+2 marksNumerical answer
Show answer

Correct answer: 100

Question 11

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

Correct answer

  • A

Question 12

+3 marksOne correct option

Consider a logistic regression model that is trained on videos to detect objectionable content. Videos with objectionable content belong to the positive class (label 1). Harmless videos belong to the negative class (label 0).
A good detector should be able to correctly identify almost all videos that are objectionable. If it incorrectly classifies even a single video that has inappropriate content in it, that could have serious consequences, as millions of people might end up watching it. In this process the detector may classify some harmless videos as belonging to the positive class. But that is a price we are willing to pay.
How should we choose the threshold (for inference) of this logistic regression model?

  1. A

    The threshold should be a low value.

  2. B

    The threshold should be a high value.

  3. C

    The performance of the classifier is independent of the threshold.

Show answer

Correct answer

  • A

    The threshold should be a low value.

Question 13

+3 marksOne or more correct options

Consider a binary classification task that has 2 features. Assume that we train a soft-margin, linear SVM (decision boundary is a line in 2D space). We know nothing about the distribution of points in the training set. The points need not be linearly separable.
This model is now tested on the following dataset that has four points.

What are the possible values of the accuracy of the model? All options are independent of each other. Assume that the decision boundary of the model does not pass through any one of the four points.

Select all that apply.

  1. A

    0

  2. B

    0.25

  3. C

    0.5

  4. D

    0.75

  5. E

    1

Show answer

Correct answers

  • B

    0.25

  • C

    0.5

  • D

    0.75

Question 14

+3 marksNumerical answer

An SVM model that has been trained for a binary classification task has the following weight vector and bias:

w=[57],b=−35w = \begin{bmatrix} 5 \\ 7 \end{bmatrix}, \quad b = -35

This model is tested on a dataset with 10 samples as given below. Here, x=[x1x2]x = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} is a feature vector and yy is the true label.

x1x_1x2x_2yy
811
1051
441
111
-121
41-1
36-1
22-1
12-1
-11-1

Compute the accuracy of the model on this dataset. Enter your answer between 0 and 1.

Hint: The Cartesian coordinate system was named after Rene Descartes.

Show answer

Correct answer: 0.7 (accepted within ±0.01)

Question 15

+1 markNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0

Question 16

+1 markNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 1

Question 17

+1 markNumerical answer

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 2

Question 18

+2 marksOne correct option

What is the predicted label of the test point if k = 1? The label is 1 for the positive class and –1 for the negative class.

  1. A

    1

  2. B

    -1

Show answer

Correct answer

  • A

    1

Question 19

+2 marksOne or more correct options

How many points are at a distance of 2 from the test point?
Note:
(1) We use the Manhattan distance.
(2) We want those points that are exactly 2 units away from the test point.

Select all that apply.

  1. A

    2 points from the positive class

  2. B

    3 points from the positive class

  3. C

    2 points from the negative class

  4. D

    3 points from the negative class

Show answer

Correct answers

  • A

    2 points from the positive class

  • D

    3 points from the negative class

Question 20

+2 marksOne correct option

Based on the above data, answer the given subquestions.

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

Correct answer

  • A

Question 21

+3 marksOne correct option

Based on the above data, answer the given subquestions.

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

Correct answer

  • A

Question 22

+1.5 marksNumerical answer

Consider a binary classification problem. The training-data has several features out of which we have access to only two binary features (x1,x2)(x_1, x_2). The labels are 11 and 22 for the two classes. The training dataset has the following distribution of points:

FeatureNumber of pointsTrue label
(0,0)(0,0)301
(0,0)(0,0)102
(0,1)(0,1)101
(0,1)(0,1)402
(1,0)(1,0)301
(1,0)(1,0)102
(1,1)(1,1)101
(1,1)(1,1)502

The table is to be parsed as follows. The first row of the table states that there are 3030 points from class 11 that have x1=0,x2=0x_1 = 0, x_2 = 0. A Bernoulli Naive Bayes model is fit for this data with the following matrix of probabilities:

[w11w12w21w22]\begin{bmatrix} w_{11} & w_{12} \\ w_{21} & w_{22} \end{bmatrix}

Each entry in this matrix can be understood as follows. For i,j∈{1,2}i, j \in \{1, 2\}:

wij=P(xi=1∣y=j)w_{ij} = P(x_i = 1 \mid y = j)

You can ignore smoothing. For all questions, report the answer up to two decimal places. Do not round-up or round-down the answer.
For example, if you get a value of 0.379140.37914, just report 0.370.37.

NOTE: If the last row of the table is not clear: for feature vector (1,1)(1, 1) in class-2, there are fifty points.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.5 (accepted within ±0.01)

Question 23

+1.5 marksNumerical answer

Consider a binary classification problem. The training-data has several features out of which we have access to only two binary features (x1,x2)(x_1, x_2). The labels are 11 and 22 for the two classes. The training dataset has the following distribution of points:

FeatureNumber of pointsTrue label
(0,0)(0,0)301
(0,0)(0,0)102
(0,1)(0,1)101
(0,1)(0,1)402
(1,0)(1,0)301
(1,0)(1,0)102
(1,1)(1,1)101
(1,1)(1,1)502

The table is to be parsed as follows. The first row of the table states that there are 3030 points from class 11 that have x1=0,x2=0x_1 = 0, x_2 = 0. A Bernoulli Naive Bayes model is fit for this data with the following matrix of probabilities:

[w11w12w21w22]\begin{bmatrix} w_{11} & w_{12} \\ w_{21} & w_{22} \end{bmatrix}

Each entry in this matrix can be understood as follows. For i,j∈{1,2}i, j \in \{1, 2\}:

wij=P(xi=1∣y=j)w_{ij} = P(x_i = 1 \mid y = j)

You can ignore smoothing. For all questions, report the answer up to two decimal places. Do not round-up or round-down the answer.
For example, if you get a value of 0.379140.37914, just report 0.370.37.

NOTE: If the last row of the table is not clear: for feature vector (1,1)(1, 1) in class-2, there are fifty points.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.54 (accepted within ±0.01)

Question 24

+1.5 marksNumerical answer

Consider a binary classification problem. The training-data has several features out of which we have access to only two binary features (x1,x2)(x_1, x_2). The labels are 11 and 22 for the two classes. The training dataset has the following distribution of points:

FeatureNumber of pointsTrue label
(0,0)(0,0)301
(0,0)(0,0)102
(0,1)(0,1)101
(0,1)(0,1)402
(1,0)(1,0)301
(1,0)(1,0)102
(1,1)(1,1)101
(1,1)(1,1)502

The table is to be parsed as follows. The first row of the table states that there are 3030 points from class 11 that have x1=0,x2=0x_1 = 0, x_2 = 0. A Bernoulli Naive Bayes model is fit for this data with the following matrix of probabilities:

[w11w12w21w22]\begin{bmatrix} w_{11} & w_{12} \\ w_{21} & w_{22} \end{bmatrix}

Each entry in this matrix can be understood as follows. For i,j∈{1,2}i, j \in \{1, 2\}:

wij=P(xi=1∣y=j)w_{ij} = P(x_i = 1 \mid y = j)

You can ignore smoothing. For all questions, report the answer up to two decimal places. Do not round-up or round-down the answer.
For example, if you get a value of 0.379140.37914, just report 0.370.37.

NOTE: If the last row of the table is not clear: for feature vector (1,1)(1, 1) in class-2, there are fifty points.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.25 (accepted within ±0.01)

Question 25

+1.5 marksNumerical answer

Consider a binary classification problem. The training-data has several features out of which we have access to only two binary features (x1,x2)(x_1, x_2). The labels are 11 and 22 for the two classes. The training dataset has the following distribution of points:

FeatureNumber of pointsTrue label
(0,0)(0,0)301
(0,0)(0,0)102
(0,1)(0,1)101
(0,1)(0,1)402
(1,0)(1,0)301
(1,0)(1,0)102
(1,1)(1,1)101
(1,1)(1,1)502

The table is to be parsed as follows. The first row of the table states that there are 3030 points from class 11 that have x1=0,x2=0x_1 = 0, x_2 = 0. A Bernoulli Naive Bayes model is fit for this data with the following matrix of probabilities:

[w11w12w21w22]\begin{bmatrix} w_{11} & w_{12} \\ w_{21} & w_{22} \end{bmatrix}

Each entry in this matrix can be understood as follows. For i,j∈{1,2}i, j \in \{1, 2\}:

wij=P(xi=1∣y=j)w_{ij} = P(x_i = 1 \mid y = j)

You can ignore smoothing. For all questions, report the answer up to two decimal places. Do not round-up or round-down the answer.
For example, if you get a value of 0.379140.37914, just report 0.370.37.

NOTE: If the last row of the table is not clear: for feature vector (1,1)(1, 1) in class-2, there are fifty points.

Based on the above data, answer the given subquestions.

Show answer

Correct answer: 0.81 (accepted within ±0.01)