Machine Learning

GATE DA previous year questions · 18 questions

Topics

GATE DA 2025 | Question 22

MCQ · 1 mark · −0.33

Consider designing a linear classifier

\[y = \operatorname{sign}(f(x; w, b)), \quad f(x; w, b) = w^{\top}x + b\]

on a dataset \(D = \{(x_{1}, y_{1}), (x_{2}, y_{2}), \ldots, (x_{N}, y_{N})\}\), \(x_{i} \in \mathbb{R}^{d}, y_{i} \in \{+1, -1\}, i = 1, 2, \ldots, N\). Recall that the sign function outputs +1 if the argument is positive, and \(-1\) if the argument is non-positive. The parameters \(w\) and \(b\) are updated as per the following training algorithm:

\[w_{new} = w_{old} + y_{n}x_{n}, \quad b_{new} = b_{old} + y_{n}\]

whenever \(\operatorname{sign}(f(x_{n}; w_{old}, b_{old})) \neq y_{n}\). In other words, whenever the classifier wrongly predicts a sample \((x_{n}, y_{n})\) from the dataset, \(w_{old}\) gets updated to \(w_{new}\), and likewise \(b_{old}\) gets updated to \(b_{new}\). Consider the case \((x_{n}, +1)\), \(f(x_{n}; w_{old}, b_{old}) < 0\). Then

Options for GATE DA 2025 | Question 22

Explanation

Answer: (A)

Here \(y_{n} = +1\), so the update adds the sample: \(w_{new} = w_{old} + x_{n}\) and \(b_{new} = b_{old} + 1\). Evaluate the new score on the same point:

\[f(x_{n}; w_{new}, b_{new}) = (w_{old} + x_{n})^{\top}x_{n} + b_{old} + 1 = f(x_{n}; w_{old}, b_{old}) + \lVert x_{n} \rVert^{2} + 1.\]

Since \(\lVert x_{n} \rVert^{2} + 1 \geq 1\), the score strictly increases, moving towards the correct positive side, so B and C are false. Option D fails because \(y_{n}f(x_{n}; w_{old}, b_{old}) = f(x_{n}; w_{old}, b_{old}) < 0\).

Answer: A

GATE DA 2025 | Question 30

MSQ · 1 mark

Let \(C_{1}\) and \(C_{2}\) be two sets of objects. Let \(D(x, y)\) be a measure of dissimilarity between two objects \(x\) and \(y\). Consider the following definitions of dissimilarity between \(C_{1}\) and \(C_{2}\).

\[\begin{aligned} \textbf{DIS-1}(C_{1}, C_{2}) &= \max_{x \in C_{1},\, y \in C_{2}} D(x, y) \\ \textbf{DIS-2}(C_{1}, C_{2}) &= \min_{x \in C_{1},\, y \in C_{2}} D(x, y) \end{aligned}\]

Which of the following statements is/are correct?

Options for GATE DA 2025 | Question 30

Explanation

Answer: (B), (D)

In hierarchical clustering, the linkage rule sets the distance between two clusters from the distances between their members.

  • Single linkage uses the closest pair, one object from each cluster. That is the minimum of \(D(x, y)\), which is DIS-2.
  • Complete linkage uses the farthest pair. That is the maximum of \(D(x, y)\), which is DIS-1.

Options A and C swap the two rules.

Answer: B, D

GATE DA 2025 | Question 34

NAT · 1 mark

Given data \(\{(-1, 1), (2, -5), (3, 5)\}\) of the form \((x, y)\), we fit a model \(y = wx\) using linear least-squares regression. The optimal value of \(w\) is __________
(Round off to three decimal places)

Explanation

Answer: 0.29

The model has no intercept, so least squares picks \(w\) to minimise \(L(w) = \sum_i (y_i - w x_i)^{2}\). Setting \(L'(w) = -2\sum_i x_i (y_i - w x_i) = 0\) gives

\[w = \frac{\sum_i x_i y_i}{\sum_i x_i^{2}}.\]

Here \(\sum x_i y_i = (-1)(1) + (2)(-5) + (3)(5) = 4\) and \(\sum x_i^{2} = 1 + 4 + 9 = 14\), so \(w = \frac{4}{14} = \frac{2}{7} \approx 0.286\).

Fitting a line with an intercept would give a different slope (about 0.308), but this model is forced through the origin.

Answer: 0.286

GATE DA 2025 | Question 35

NAT · 1 mark

The naive Bayes classifier is used to solve a two-class classification problem with class-labels \(y_1, y_2\). Suppose the prior probabilities are \(P(y_1) = \frac{1}{3}\) and \(P(y_2) = \frac{2}{3}\). Assuming a discrete feature space with

\[P(x|y_1) = \frac{3}{4} \quad \text{and} \quad P(x|y_2) = \frac{1}{4}\]

for a specific feature vector \(x\). The probability of misclassifying \(x\) is __________
(Round off to two decimal places)

Explanation

Answer: 0.39 to 0.41

Naive Bayes compares prior times likelihood for the two classes:

  • \(P(y_1)P(x|y_1) = \frac{1}{3} \cdot \frac{3}{4} = \frac{1}{4}\)
  • \(P(y_2)P(x|y_2) = \frac{2}{3} \cdot \frac{1}{4} = \frac{1}{6}\)

So \(P(x) = \frac{1}{4} + \frac{1}{6} = \frac{5}{12}\), giving posteriors \(P(y_1|x) = \frac{3}{5}\) and \(P(y_2|x) = \frac{2}{5}\). The classifier picks the larger posterior, \(y_1\), and it is wrong exactly when \(x\) really belongs to \(y_2\), which has probability \(P(y_2|x) = 0.40\). The larger prior of \(y_2\) is outweighed by the much higher likelihood under \(y_1\).

Answer: 0.40

GATE DA 2025 | Question 42

MCQ · 2 marks · −0.66

Consider the neural network shown in the figure with
inputs: \(u, v\)
weights: \(a, b, c, d, e, f\)
output: \(y\)
\(R\) denotes the ReLU function, \(R(x) = \max(0, x)\).

Network diagram: input u connects to the upper ReLU node R with weight a and to the lower ReLU node R with weight c, and input v connects to the upper node with weight b and to the lower node with weight d. The upper and lower nodes feed an output ReLU node R with weights e and f, and that node outputs y.

Given \(u = 2, v = 3\),
\(a = 1, b = 1, c = 1, d = -1, e = 4, f = -1\),
which one of the following is correct?

Options for GATE DA 2025 | Question 42

Explanation

Answer: (A)

Forward pass, with \(h_1\) and \(h_2\) the outputs of the upper and lower hidden nodes:

  • \(h_1 = R(au + bv) = R(2 + 3) = 5\)
  • \(h_2 = R(cu + dv) = R(2 - 3) = R(-1) = 0\)
  • \(y = R(eh_1 + fh_2) = R(20 + 0) = 20\)

The output node and the upper node have positive inputs, so their ReLU slopes are 1. By the chain rule,

\[\frac{\partial y}{\partial a} = 1 \cdot e \cdot 1 \cdot u = 4 \times 2 = 8, \qquad \frac{\partial y}{\partial f} = 1 \cdot h_2 = 0.\]

The gradient for \(f\) is 0 because \(f\) only multiplies \(h_2\), and the lower ReLU outputs 0 here.

Answer: A

GATE DA 2025 | Question 53

MSQ · 2 marks

Consider designing a linear binary classifier \(f(x) = \operatorname{sign}(w^{\top}x + b)\), \(x \in \mathbb{R}^{2}\) on the following training data:

\[ \text{Class-1: } \left\{ \begin{pmatrix} 2 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 2 \end{pmatrix}, \begin{pmatrix} 2 \\ 2 \end{pmatrix} \right\}, \ \text{Class-2: } \left\{ \begin{pmatrix} 0 \\ 0 \end{pmatrix} \right\} \]

Hard-margin support vector machine (SVM) formulation is solved to obtain \(w\) and \(b\). Which of the following options is/are correct?

Options for GATE DA 2025 | Question 53

Explanation

Answer: (B), (C)

The triangle formed by the Class-1 points comes closest to the origin at \((1, 1)\), the midpoint of its edge from \((2, 0)\) to \((0, 2)\). The maximum-margin boundary is the perpendicular bisector of the segment from \((0, 0)\) to \((1, 1)\), the line \(x_{1} + x_{2} = 1\). In canonical form (Class-1 as \(+1\)), \(w = (1, 1)^{\top}\) and \(b = -1\): \(w^{\top}x + b\) is 1 at \((2, 0)\) and \((0, 2)\), \(-1\) at \((0, 0)\) and 3 at \((2, 2)\).

  • A fails: \(w = (4, 4)^{\top}\), \(b = 1\) gives every point, \((0, 0)\) included, a positive score, so it does not separate the classes.
  • B holds: \((2, 0)\), \((0, 2)\) and \((0, 0)\) lie on the margin lines; \((2, 2)\) lies beyond them.
  • C holds: the margin lines \(x_{1} + x_{2} = 0\) and \(x_{1} + x_{2} = 2\) are \(\frac{2}{\|w\|} = \sqrt{2}\) apart.
  • D fails: the data are separable, so training accuracy is 100%.

Answer: B, C

GATE DA 2025 | Question 55

MSQ · 2 marks

Consider a two-class problem in \(\mathbb{R}^{d}\) with class labels red and green. Let \(\mu_{\textit{red}}\) and \(\mu_{\textit{green}}\) be the means of the two classes. Given test sample \(x \in \mathbb{R}^{d}\), a classifier calculates the squared Euclidean distance (denoted by \(\| \cdot \|^{2}\)) between \(x\) and the means of the two classes and assigns the class label that the sample \(x\) is closest to. That is, the classifier computes

\[ f(x) = \|\mu_{\textit{red}} - x\|^{2} - \|\mu_{\textit{green}} - x\|^{2} \]

and assigns the label red to \(x\) if \(f(x) < 0\), and green otherwise. Which of the following statements is/are correct?

Options for GATE DA 2025 | Question 55

Explanation

Answer: (B), (C)

Expand each squared distance as \(\|\mu - x\|^{2} = \|\mu\|^{2} - 2\mu^{\top}x + \|x\|^{2}\). The \(\|x\|^{2}\) terms cancel in the difference:

\[ f(x) = 2(\mu_{\textit{green}} - \mu_{\textit{red}})^{\top}x + \|\mu_{\textit{red}}\|^{2} - \|\mu_{\textit{green}}\|^{2} \]

  • B and C hold: \(f(x) = w^{\top}x + b\) with \(w = 2(\mu_{\textit{green}} - \mu_{\textit{red}})\) and \(b = \|\mu_{\textit{red}}\|^{2} - \|\mu_{\textit{green}}\|^{2}\), so the decision boundary is a hyperplane.
  • D fails: the quadratic term cancels.
  • A fails: \(f(0) = \|\mu_{\textit{red}}\|^{2} - \|\mu_{\textit{green}}\|^{2} < 0\) when \(\|\mu_{\textit{red}}\| < \|\mu_{\textit{green}}\|\), so the origin gets the label red, the nearer mean.

Answer: B, C

GATE DA 2025 | Question 60

NAT · 2 marks

Let \(D = \{x^{(1)}, \ldots, x^{(n)}\}\) be a dataset of \(n\) observations where each \(x^{(i)} \in \mathbb{R}^{100}\). It is given that \(\sum_{i=1}^{n} x^{(i)} = 0\). The covariance matrix computed from \(D\) has eigenvalues \(\lambda_{i} = 100^{2-i}\), \(1 \le i \le 100\). Let \(u \in \mathbb{R}^{100}\) be the direction of maximum variance with \(u^{\top}u = 1\).

The value of

\[ \frac{1}{n}\sum_{i=1}^{n} \left(u^{\top}x^{(i)}\right)^{2} = \]

________ (Answer in integer)

Explanation

Answer: 100

Since \(\sum_{i} x^{(i)} = 0\), the data are already centred, so the covariance matrix is \(C = \frac{1}{n}\sum_{i=1}^{n} x^{(i)}x^{(i)\top}\). Then

\[ \frac{1}{n}\sum_{i=1}^{n} \left(u^{\top}x^{(i)}\right)^{2} = \frac{1}{n}\sum_{i=1}^{n} u^{\top}x^{(i)}x^{(i)\top}u = u^{\top}Cu, \]

the variance of the data along \(u\). Over unit vectors, \(u^{\top}Cu\) is largest for the top eigenvector of \(C\) (the first principal component), and that largest value is the top eigenvalue.

The eigenvalues \(100^{2-i}\) decrease with \(i\): \(100, 1, 0.01, \ldots\). So the value is \(\lambda_{1} = 100^{1} = 100\).

Answer: 100

GATE DA 2024 | Question 17

MCQ · 1 mark · −0.33

Consider the dataset with six datapoints: \(\{(\boldsymbol{x}_{1}, \boldsymbol{y}_{1}), (\boldsymbol{x}_{2}, \boldsymbol{y}_{2}), \ldots, (\boldsymbol{x}_{6}, \boldsymbol{y}_{6})\}\), where \(\boldsymbol{x}_{1} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\), \(\boldsymbol{x}_{2} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}\), \(\boldsymbol{x}_{3} = \begin{bmatrix} 0 \\ -1 \end{bmatrix}\), \(\boldsymbol{x}_{4} = \begin{bmatrix} -1 \\ 0 \end{bmatrix}\), \(\boldsymbol{x}_{5} = \begin{bmatrix} 2 \\ 2 \end{bmatrix}\), \(\boldsymbol{x}_{6} = \begin{bmatrix} -2 \\ -2 \end{bmatrix}\) and the labels are given by \(\boldsymbol{y}_{1} = \boldsymbol{y}_{2} = \boldsymbol{y}_{5} = 1\), and \(\boldsymbol{y}_{3} = \boldsymbol{y}_{4} = \boldsymbol{y}_{6} = -1\). A hard margin linear support vector machine is trained on the above dataset.

Which ONE of the following sets is a possible set of support vectors?

Options for GATE DA 2024 | Question 17

Explanation

Answer: (D)

Each negative point is the mirror image of a positive one through the origin. Write the separator as \(\boldsymbol{w}^{\top}\boldsymbol{x} + b\) with \(\boldsymbol{w} = (w_{1}, w_{2})\). The hard-margin constraints \(y_{i}(\boldsymbol{w}^{\top}\boldsymbol{x}_{i} + b) \geq 1\) for \(\boldsymbol{x}_{1}\) and \(\boldsymbol{x}_{4}\) read \(w_{1} + b \geq 1\) and \(w_{1} - b \geq 1\), so \(w_{1} \geq 1\); \(\boldsymbol{x}_{2}\) and \(\boldsymbol{x}_{3}\) give \(w_{2} \geq 1\) in the same way. So \(\lVert\boldsymbol{w}\rVert^{2} \geq 2\), and \(\boldsymbol{w} = (1, 1)\), \(b = 0\) reaches this while meeting every constraint, so it is the maximum-margin solution.

For this hyperplane, \(\boldsymbol{x}_{1}\) to \(\boldsymbol{x}_{4}\) give \(y_{i}(\boldsymbol{w}^{\top}\boldsymbol{x}_{i} + b) = 1\): they lie on the margin and are the support vectors. \(\boldsymbol{x}_{5}\) and \(\boldsymbol{x}_{6}\) give 4, well outside the margin, which rules out A, B and C (A even holds points of one class only).

Answer: D

GATE DA 2024 | Question 18

MCQ · 1 mark · −0.33

Match the items in Column 1 with the items in Column 2 in the following table:

Column 1Column 2
(p) Principal Component Analysis(i) Discriminative Model
(q) Naïve Bayes Classification(ii) Dimensionality Reduction
(r) Logistic Regression(iii) Generative Model
Options for GATE DA 2024 | Question 18

Explanation

Answer: (C)

Match each method by what it learns.

  • (p) Principal Component Analysis projects the data onto the few directions of largest variance, keeping most of the information in fewer features: dimensionality reduction, (ii).
  • (q) Naïve Bayes models how the data are generated, through \(P(\text{class})\) and \(P(\text{features} \mid \text{class})\), and gets the class from Bayes' theorem: a generative model, (iii).
  • (r) Logistic regression models \(P(\text{class} \mid \text{features})\) directly and never models the features themselves: a discriminative model, (i).

Options A and D call PCA a generative model, and B swaps the two classifiers.

Answer: C