Quiz Space

May 2022 term · Machine Learning Techniques · BSCS2007

MLT End Term: 7 August 2022, Set QPD1 (May 2022 term)

The IIT Madras BS Machine Learning Techniques (MLT) End Term paper sat on 7 Aug 2022, in the May 2022 term, set QPD1: 33 questions for 100 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
33
Marks
100
Duration
180 min
MCQ
10
MSQ
6
Numerical
17

Updated

Official paper: IIT M FOUNDATION DIPLOMA ENDTERM QPD1 07 Aug 2022 IBA NS · No negative marking.

Question 1

+2 marksOne correct option

During classification of linearly separable data-set using perceptron algorithm, as the value of learning rate α is decreased,

  1. A

    The number of steps required for convergence increases.

  2. B

    The number of steps required for convergence decreases.

  3. C

    The number of steps required for convergence is independent of the learning rate.

  4. D

    The perceptron algorithm may not converge.

Show answer

Correct answer

  • C

    The number of steps required for convergence is independent of the learning rate.

Question 2

+2 marksOne correct option

A knn algorithm with k = 30 gives high training error and high validation error. What value of the k we should choose to get the better performance of the
algorithm?

  1. A

    Less than 30

  2. B

    Greater than 30

Show answer

Correct answer

  • A

    Less than 30

Question 3

+2 marksOne correct option

Consider a binary classification problem. Let p1 denote the proportion of class 0 examples in a particular node. Which of the following graphs shows correct curves for the Gini-index, Entropy and misclassification error of that node?

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

Correct answer

  • A

Question 4

+2 marksOne correct option

The following is the activation vector output by some hidden layer in a neural network when some input vector is given to it:

Which of the following could be the activation function used in this layer?

  1. A

    Softmax

  2. B

    Sigmoid

  3. C

    ReLU

  4. D

    Tanh

Show answer

Correct answer

  • C

    ReLU

Question 5

+2 marksOne or more correct options

Which of the following are multi label problems? For each option, assume suitable features are available.

Select all that apply.

  1. A

    Predicted number of run Indian Cricket team will score in their next ODI.

  2. B

    Amount of money that Amitabh Bachchan’s next three movies each will make.

  3. C

    Predicting number of goals Ronaldo will score in next 10 matches each.

  4. D

    Predicting blood group of a person

  5. E

    Predicting blood sugar level of a person for next 15 days each.

Show answer

Correct answers

  • B

    Amount of money that Amitabh Bachchan’s next three movies each will make.

  • C

    Predicting number of goals Ronaldo will score in next 10 matches each.

  • E

    Predicting blood sugar level of a person for next 15 days each.

Question 6

+2 marksOne or more correct options

In a random forest model let p < m be the number of randomly selected features that are used to identify the best split at any node of a tree. Which of the
following are true? (m is the original number of features)

Select all that apply.

  1. A

    Increasing p reduces the correlation between any two trees in the forest.

  2. B

    Decreasing p reduces the correlation between any two trees in the forest.

  3. C

    Increasing p increases the performance of individual trees in the forest.

  4. D

    Decreasing p increases the performance of individual trees in the forest.

Show answer

Correct answers

  • B

    Decreasing p reduces the correlation between any two trees in the forest.

  • C

    Increasing p increases the performance of individual trees in the forest.

Question 7

+2 marksNumerical answer

Consider feature matrix X=[122123]\mathbf{X} = \begin{bmatrix} 1 & 2 \\ 2 & 1 \\ 2 & 3 \end{bmatrix}, label vector y=[123]\mathbf{y} = \begin{bmatrix} 1 \\ 2 \\ 3 \end{bmatrix} and the weight vector is w=[1−23]\mathbf{w} = \begin{bmatrix} 1 \\ -2 \\ 3 \end{bmatrix}. Add a dummy feature to X\mathbf{X}.

What will be the value of the loss function if a regression model without regularization is fitted?

Show answer

Correct answer: 14.5 (accepted within ±0.5)

Question 8

+2 marksNumerical answer

Consider a test-dataset of 100 points for a binary classification problem, where 60 belong to the positive class (true label) and the rest belong to the negative class (true label). The following is a table for some classifier that has been prepared by an ML engineer:

If this is a valid confusion matrix (just by looking at the numbers), enter the classifier’s recall as the answer. If this is not a valid confusion matrix, enter 0 as the answer. Your answer should be in the interval [0, 1], endpoints inclusive. Enter your answer correct to two decimal places.

Show answer

Correct answer: 0.5 (accepted within ±0.01)

Question 9

+3 marksOne correct option

Consider a modified loss function for linear regression that is of the following form for a training dataset that has nn points:

L(w)=12∑i=1nri(wTxi−yi)2L(\mathbf{w}) = \frac{1}{2}\sum_{i=1}^{n} r_i(\mathbf{w}^T\mathbf{x}_i - y_i)^2

Here, rir_i is some constant in [0,1][0, 1] associated with each data-point in the training dataset. The dummy feature and the corresponding weight are already included in the vectors x\mathbf{x} and w\mathbf{w} respectively. What is the expression of the gradient of L(w)L(\mathbf{w}) with respect to w\mathbf{w}?

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

Correct answer

  • A

Question 10

+3 marksOne correct option

Consider unlabeled data with two features X1 and X2 as shown in the figure.

C1 and C2 are the coordinates of centroids obtained after certain iterations of K-means algorithm with K = 2. Which of the following options is correct about the silhouette score S? Note: Euclidean distance is used to calculate the distances.

  1. A

    S will be positive and close to 0.

  2. B

    S will be positive and close to 1.

  3. C

    S will be exact −1.

  4. D

    S will be negative but need not be exact −1.

Show answer

Correct answer

  • D

    S will be negative but need not be exact −1.

Question 11

+3 marksOne correct option

Consider a neural network for a multi-class, image classification problem. When the network is trained on the images as they are, it does a good job on the test data. Call the dataset (train + test) for this setup D1 and the network N1. Assume that we now turn all images upside down, in both the training and test dataset. Now, the network with the same architecture is trained from scratch on this modified dataset. Call the dataset (train + test) for this setup D2 and network N2. Select the most appropriate option.

  1. A

    The network N2 will not be able to learn anything from D2. Its test accuracy on D2 will be very low.

  2. B

    The network N2 will be able to learn useful patterns from D2. In fact, the performance of network N2 on D2 will be similar to N1 on D1.

  3. C

    The network N2 will be able to learn somewhat useful patterns from D2. But the performance of N1 on D1 will be much better than N2 on D2.

Show answer

Correct answer

  • B

    The network N2 will be able to learn useful patterns from D2. In fact, the performance of network N2 on D2 will be similar to N1 on D1.

Question 12

+3 marksOne correct option

Two classifiers are trained on a dataset for a binary classification problem. They are then tested on the same dataset. The F1F_1 scores of both classifiers are the same. (p1,r1)(p_1, r_1) and (p2,r2)(p_2, r_2) are the precision-recall scores for the two classifiers. Consider the following statements:

Statement-1

If p1>p2p_1 > p_2, then r1<r2r_1 < r_2

Statement-2

If p1=p2p_1 = p_2, then r1=r2r_1 = r_2

Select the most appropriate option.

  1. A

    Statement-1 is correct, statement-2 is incorrect

  2. B

    Statement-1 is incorrect, statement-2 is correct

  3. C

    Both statements 1 & 2 are correct

  4. D

    Both statements 1 & 2 are incorrect

Show answer

Correct answer

  • C

    Both statements 1 & 2 are correct

Question 13

+3 marksOne or more correct options

Which of the following code blocks will produce the same value for the variable ‘Ans’? Assume the ‘numpy’ library is imported as ‘np’.

Select all that apply.

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

Correct answers

  • A
  • B
  • C

Question 14

+3 marksOne or more correct options

Rajesh trained a model on house price prediction problem. After training he came up with following model:

y=4000−20⋅x1+15⋅x2+500⋅x3−30⋅x4y = 4000 - 20 \cdot x_1 + 15 \cdot x_2 + 500 \cdot x_3 - 30 \cdot x_4

where,
yy is predicted house price,
x1x_1 is number of years the house was built before,
x2x_2 is the carpet area in square feet,
x3x_3 is the number of floors the apartment/house has,
x4x_4 represents distance of the property from railway station.

According to Rajesh's model, which of the following statements are correct?

Select all that apply.

  1. A

    Presence of the lift/elevator is the most important feature.

  2. B

    No. of floors in the building is the most important feature.

  3. C

    Area is the most important feature.

  4. D

    Age is the most important feature.

  5. E

    Distance from railway station is the second most important feature.

  6. F

    None of these.

Show answer

Correct answers

  • B

    No. of floors in the building is the most important feature.

  • E

    Distance from railway station is the second most important feature.

Question 15

+3 marksOne or more correct options

Select all that apply.

  1. A

    The polynomial regression model of degree 6 adds a smooth fitting to this data.

  2. B

    The polynomial regression model of degree 98 overfits this data.

  3. C

    The polynomial regression model of degree 2 adds a smooth fitting to this data.

  4. D

    The polynomial regression model of degree 3 underfits this data.

Show answer

Correct answers

  • A

    The polynomial regression model of degree 6 adds a smooth fitting to this data.

  • B

    The polynomial regression model of degree 98 overfits this data.

  • D

    The polynomial regression model of degree 3 underfits this data.

Question 16

+3 marksNumerical answer

What is the output of the following code?

python
import numpy as np
def aFunction(A, d):
temp = np.ones(1)
for i in range(1, d + 1):
temp = np.concatenate((temp, A ** i))
return temp
A = np.arange(4)
print(np.sum(aFunction(A, 2)))
Show answer

Correct answer: 21.0

Question 17

+3 marksNumerical answer

Consider the feature matrix X=[123324]\mathbf{X} = \begin{bmatrix} 1 & 2 & 3 \\ 3 & 2 & 4 \end{bmatrix} and corresponding label vector y=[24]\mathbf{y} = \begin{bmatrix} 2 \\ 4 \end{bmatrix}. Let regularization rate, λ=0.1\lambda = 0.1. Compute lasso regression loss using weight w=[10.01−0.50]\mathbf{w} = \begin{bmatrix} 1 \\ 0.01 \\ -0.5 \\ 0 \end{bmatrix}.

Show answer

Correct answer: 10 (accepted within ±0.5)

Question 18

+3 marksNumerical answer

You are given a linearly separable dataset with feature matrix X, for which a perceptron has been trained until it converges (perfectly separates the data). The weight vector corresponding to it is w. This dataset has 60 points from the positive class and 40 from the negative class. What is the output of the following snippet of code?

Notes

  • The labels for a perceptron lie in {−1,1}\{-1, 1\}.
  • The NumPy arrays X\mathbf{X} and w\mathbf{w} are compatible for matrix multiplication, the dummy feature and the corresponding weight are already built into the arrays.
  • None of the 100 points lie on the decision boundary.
python
import numpy as np
y_hat = np.where(X @ w > 0, 1, -1)
print(np.sum(y_hat))
Show answer

Correct answer: 20

Question 19

+3 marksNumerical answer

A Gaussian Naive Bayes model is trained for a multi-class classification problem that has 12 features and 5 classes. Find the total number of parameters that have to be estimated for this model. Consider each parameter to be a scalar value. In other words, if we decide to store all the parameters in a Python list, with each element of the list being a float value corresponding to a single parameter, what is the size of this list? Ignore the priors in the calculation. Only focus on the parameters of the class conditional densities.

Show answer

Correct answer: 120

Question 20

+3 marksNumerical answer

Consider the following network architecture:

LayerNumber of Neurons
Input15
Hidden layer-130
Hidden layer-220
Output layer5

How many parameters (weights + biases) does this network have?

Show answer

Correct answer: 1205

Question 21

+3 marksNumerical answer

A multi-class classification problem has 5 classes. The training dataset has n data-points, with an equal number of points from each of the 5 classes. Consider a dummy classifier that does prediction as follows: for each input data-point, it picks one of the 5 classes at random (uniformly) and outputs that as its prediction. What is the accuracy of the model on the training dataset as n becomes very large? Your answer should be between 0 and 1. Enter your answer correct to two decimal places.
Hint: Think about it in the probabilistic sense.

Show answer

Correct answer: 0.2 (accepted within ±0.01)

Question 22

+4 marksOne correct option

Consider a logistic regression model for a binary classification problem with two features x1x_1 and x2x_2. The feature vector is [x1x2]\begin{bmatrix} x_1 \\ x_2 \end{bmatrix} and labels lie in {0,1}\{0, 1\}. The threshold for inference is 0.5. The dummy feature and the weight corresponding to it can be ignored for this problem. Let x1x_1 be the horizontal axis and x2x_2 be the vertical axis. You are given two feature vectors:

x1=[31],x2=[−31]\mathbf{x_1} = \begin{bmatrix} \sqrt{3} \\ 1 \end{bmatrix}, \mathbf{x_2} = \begin{bmatrix} -\sqrt{3} \\ 1 \end{bmatrix}

The weight vector makes an angle of θ\theta with the positive x1x_1 axis (horizontal). Each θ\theta corresponds to a different classifier. For what range of values of θ\theta are both x1\mathbf{x_1} and x2\mathbf{x_2} predicted to belong to class-1?

Hints:

  • To draw the weight vector w=[w1w2]\mathbf{w} = \begin{bmatrix} w_1 \\ w_2 \end{bmatrix}, plot the point (w1,w2)(w_1, w_2) and draw an arrow starting at the origin to this point.
  • tan⁡(30∘)=13\tan(30^\circ) = \frac{1}{\sqrt{3}}
  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answer

  • A

Question 23

+4 marksOne correct option

Consider the following data points

(2,2)
(2,3)
(6,5)
(3.6,4)
(3.4, 4)

We perform k-means clustering on the above data, with k=2k = 2, using Manhattan distance as the distance measure. At ttth iteration, we have (2,2) as the centroid for cluster-1 and (6,5) as the centroid for cluster-2. After performing (t+1)(t + 1)th iteration the point (3.4,4) will belong to

  1. A

    cluster-1

  2. B

    cluster-2

  3. C

    can not be determined

Show answer

Correct answer

  • B

    cluster-2

Question 24

+4 marksOne or more correct options

If Wij is the weight of the edge from neuron i in layer l − 1 to neuron j in layer l, which of the following statements about the matrix W are true? Neurons in a layer are processed (indexed) from top to bottom. So, the first neuron in a layer is the top-most neuron in that layer.

Select all that apply.

  1. A

    The first row of the matrix corresponds to all outgoing connections from the first neuron in layer l − 1.

  2. B

    The first row of the matrix corresponds to all incoming connections to the first neuron in layer l .

  3. C

    The last column of the matrix corresponds to all incoming connections to the last neuron in layer l .

  4. D

    The last column of the matrix corresponds to all the outgoing connections from the last neuron in layer l − 1.

Show answer

Correct answers

  • A

    The first row of the matrix corresponds to all outgoing connections from the first neuron in layer l − 1.

  • C

    The last column of the matrix corresponds to all incoming connections to the last neuron in layer l .

Question 25

+4 marksNumerical answer

A perceptron model is trained on the following binary classification data-set.

X1X_1X2X_2Label (yy)
00−1-1
0111
1011
11−1-1

At one of the iterations, weights are: w0=−0.7,    w1=0.8w_0 = -0.7, \;\; w_1 = 0.8 and w2=0.1w_2 = 0.1. Assume that w0′,w1′w_0', w_1' and w2′w_2' are the updated weights after one epoch (one epoch is completed on going through all the data points). Find the value of w0′+w1′+w2′w_0' + w_1' + w_2'. Consider the learning rate to be one. Don't change the order of samples while updating the weight vector. Take the original order of samples.

Show answer

Correct answer: -1.8

Question 26

+4 marksNumerical answer

Inference using logistic regression happens as follows. TT is called the threshold and is some real number in the interval (0,1)(0, 1). y^\hat{y} stands for the predicted label.

y^={1,P(y=1∣x)≥T0,otherwise\hat{y} = \begin{cases} 1, & P(y = 1 \mid \mathbf{x}) \geq T \\ 0, & \text{otherwise} \end{cases}

Given this setup, the equation of the decision boundary is given below:

wTx−u=0\mathbf{w}^T\mathbf{x} - u = 0

w\mathbf{w} has the same dimensions as x\mathbf{x}. The dummy feature is included in x\mathbf{x} and the corresponding weight is included in w\mathbf{w}. If T=e21+e2T = \frac{e^2}{1 + e^2}, what is the value of the unknown quantity uu? Here, ee is the Euler's number that is associated with the natural logarithm and is the same one found on your calculator. Enter the closest integer as your answer.

Show answer

Correct answer: 2

Question 27

+4 marksNumerical answer

An SVM has been trained for a 2D problem. The feature vector is x=[x1x2]\mathbf{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}.

It has the following weight vector and bias:

w=[21],b=−2\mathbf{w} = \begin{bmatrix} 2 \\ 1 \end{bmatrix}, b = -2

Recall that the labels in the SVM setup are +1+1 and −1-1. Consider a unit square whose vertices are at:

(0,0),(1,0),(0,1),(1,1)(0, 0), (1, 0), (0, 1), (1, 1)

The horizontal axis corresponds to x1x_1 and the vertical axis corresponds to x2x_2. A point is picked at random (uniformly) from the region bounded by the square. What is the probability that this point is predicted as belonging to class +1+1 by the SVM? Enter your answer correct to two decimal places.

Show answer

Correct answer: 0.25 (accepted within ±0.01)

Question 28

+4 marksNumerical answer

Find the hinge loss for this soft-margin SVM classifier on the dataset that is given in the table. The weight vector and bias are as follows:

w=[1−1],b=1\mathbf{w} = \begin{bmatrix} 1 \\ -1 \end{bmatrix}, \quad b = 1

The coefficient CC can be assumed to be 1.

x1x_1x2x_2yy
14-1
-12-1
-20-1
12-1
131
101
211
231

Note that you just need to report the hinge loss. Do not compute the margin loss which involves only the term w\mathbf{w}. Also note that the hinge loss does not have a factor of 0.5 before it. Enter the closest integer as your answer.

Show answer

Correct answer: 4

Question 29

+4 marksNumerical answer

Consider two networks N1N_1 and N2N_2 for a binary classification task. N1N_1 has two neurons at the output layer and uses the softmax activation function. N2N_2 has one neuron at the output layer and uses sigmoid activation function. We don't need the information about the hidden layers for this problem.

For some test data-point x\mathbf{x}, the pre-activations at the output layer for N1N_1 is given below. The first neuron corresponds to class-0 and the second corresponds to class-1:

z=[13]\mathbf{z} = \begin{bmatrix} 1 \\ 3 \end{bmatrix}

It turns out that for this data-point, both networks predict the same probability of this point belonging to class-1. That is P(y=1∣x)P(y = 1 \mid \mathbf{x}) is the same for both networks. If this is the case, what should be the pre-activation value at the output layer of N2N_2, call it zz, corresponding to this data-point? Enter the closest integer as your answer.

Notes

  • The activation of N2N_2 at the output-layer is interpreted as P(y=1∣x)P(y = 1 \mid \mathbf{x}).
  • The z\mathbf{z} for N1N_1 is a vector and the zz for N2N_2 is a scalar.
  • Be careful about the distinction between pre-activation and activation.
Show answer

Correct answer: 2

Question 30

+2 marksNumerical answer

Based on the above data, answer the given subquestions.

How many samples of the training data-set belong to Leaf 2?

Show answer

Correct answer: 1

Question 31

+3 marksNumerical answer

Based on the above data, answer the given subquestions.

If the present price of a car which is driven for 5 years is 9.5 lac. If the car has an LPG engine, what will be the prediction for the selling price of the car according to the given regression tree? Enter your answer in lac. If your answer is 5.6 lac, enter the answer 5.6.

Show answer

Correct answer: 7.0

Question 32

+4 marksNumerical answer

Consider that adaboost model is trained on the following binary classification data-set.

X1X_1X2X_2Label (yy)
3.72false
2.02false
54true
2.95false
4.16true

The data-set is split according to feature X2X_2 to create the first stump. Equal sample weights are assigned to each examples to create the first stump and Gini-index measure is used to split the data.

Based on the above data, answer the given subquestions.

What will be the performance of the first stump? Enter your answer correct to two decimal places.

Show answer

Correct answer: 0.695 (accepted within ±0.025)

Question 33

+4 marksNumerical answer

Consider that adaboost model is trained on the following binary classification data-set.

X1X_1X2X_2Label (yy)
3.72false
2.02false
54true
2.95false
4.16true

The data-set is split according to feature X2X_2 to create the first stump. Equal sample weights are assigned to each examples to create the first stump and Gini-index measure is used to split the data.

Based on the above data, answer the given subquestions.

What sample weight will be assigned to the last example to create the next stump? Don’t normalize the sample weights. Enter your answer correct to two decimal places.

Show answer

Correct answer: 0.1 (accepted within ±0.02)