Machine Learning

GATE DA previous year questions · 18 questions

GATE DA 2024 | Question 19

MCQ · 1 mark · −0.33

Euclidean distance based \(k\)-means clustering algorithm was run on a dataset of 100 points with \(k = 3\). If the points \(\begin{bmatrix} 1 \\ 1 \end{bmatrix}\) and \(\begin{bmatrix} -1 \\ 1 \end{bmatrix}\) are both part of cluster 3, then which ONE of the following points is necessarily also part of cluster 3?

Options for GATE DA 2024 | Question 19

Explanation

Answer: (D)

\(k\)-means assigns every point to its nearest centroid, so cluster 3 holds the points that are closer to its centroid \(\boldsymbol{c}_{3}\) than to \(\boldsymbol{c}_{1}\) and \(\boldsymbol{c}_{2}\). For each other centroid \(\boldsymbol{c}_{j}\), the condition \(\lVert\boldsymbol{p} - \boldsymbol{c}_{3}\rVert^{2} \leq \lVert\boldsymbol{p} - \boldsymbol{c}_{j}\rVert^{2}\) simplifies to a linear inequality in \(\boldsymbol{p}\), that is, a half-plane. The region of cluster 3 is an intersection of half-planes, so it is convex: with any two of its points it contains the whole segment between them.

The point \((0, 1)\) is the midpoint of \((1, 1)\) and \((-1, 1)\), so it must belong to cluster 3. The points in A, B and C lie off that segment, and another centroid could be nearer to them.

Answer: D

GATE DA 2024 | Question 20

MCQ · 1 mark · −0.33

Given a dataset with \(K\) binary-valued attributes (where \(K > 2\)) for a two-class classification task, the number of parameters to be estimated for learning a naïve Bayes classifier is

Options for GATE DA 2024 | Question 20

Explanation

Answer: (B)

Naïve Bayes assumes that the attributes are conditionally independent given the class, so it needs only these parameters:

  • the class prior \(P(y = 1)\): one parameter, because \(P(y = 0) = 1 - P(y = 1)\);
  • for each of the 2 classes and each of the \(K\) attributes, \(P(x_{k} = 1 \mid y)\): \(2K\) parameters, because \(P(x_{k} = 0 \mid y)\) follows from it.

The total is \(2K + 1\). Counts that grow like \(2^{K}\) (A and C) are what a model of the full joint distribution of the attributes within each class would need, which is exactly what the independence assumption avoids.

Answer: B

GATE DA 2024 | Question 22

MCQ · 1 mark · −0.33

For any binary classification dataset, let \(S_{B} \in \mathbb{R}^{d \times d}\) and \(S_{W} \in \mathbb{R}^{d \times d}\) be the between-class and within-class scatter (covariance) matrices, respectively. The Fisher linear discriminant is defined by \(u^{*} \in \mathbb{R}^{d}\), that maximizes

\[J(u) = \frac{u^{T} S_{B} u}{u^{T} S_{W} u}\]

If \(\lambda = J(u^{*})\), \(S_{W}\) is non-singular and \(S_{B} \neq 0\), then \((u^{*}, \lambda)\) must satisfy which ONE of the following equations?

Note: \(\mathbb{R}\) denotes the set of real numbers.

Options for GATE DA 2024 | Question 22

Explanation

Answer: (A)

At the maximum the gradient of \(J\) is zero. Both matrices are symmetric, so by the quotient rule

\[\nabla J(u) = \frac{2 S_{B} u \,(u^{T} S_{W} u) - 2 S_{W} u \,(u^{T} S_{B} u)}{(u^{T} S_{W} u)^{2}} = 0 \;\Rightarrow\; S_{B} u^{*} = J(u^{*})\, S_{W} u^{*} = \lambda S_{W} u^{*}.\]

Since \(S_{W}\) is non-singular, multiplying by \(S_{W}^{-1}\) gives \(S_{W}^{-1} S_{B} u^{*} = \lambda u^{*}\): \(u^{*}\) is an eigenvector of \(S_{W}^{-1} S_{B}\) for its largest eigenvalue \(\lambda\).

Option B has \(\lambda\) on the wrong side (it would hold with \(1/\lambda\)), C multiplies by \(S_{W}\) instead of its inverse, and D fails because \(J\) does not depend on the length of \(u\), so \(u^{*}\) can be rescaled freely.

Answer: A

GATE DA 2024 | Question 42

MCQ · 2 marks · −0.66

Consider the table below, where the \((i, j)^{th}\) element of the table is the distance between points \(x_{i}\) and \(x_{j}\). Single linkage clustering is performed on data points, \(x_{1}, x_{2}, x_{3}, x_{4}, x_{5}\).

\(x_{1}\)\(x_{2}\)\(x_{3}\)\(x_{4}\)\(x_{5}\)
\(x_{1}\)01436
\(x_{2}\)10353
\(x_{3}\)43025
\(x_{4}\)35201
\(x_{5}\)63510

Which ONE of the following is the correct representation of the clusters produced?

Options for GATE DA 2024 | Question 42

Explanation

Answer: (A)

Single linkage repeatedly merges the two clusters whose closest members are nearest to each other.

  • Distance 1: \(x_{1}\) joins \(x_{2}\), and \(x_{4}\) joins \(x_{5}\).
  • Distance 2: \(x_{3}\) joins \(\{x_{4}, x_{5}\}\) through \(d(x_{3}, x_{4}) = 2\); the pair \(\{x_{1}, x_{2}\}\) is at least 3 from every other point.
  • Distance 3: \(\{x_{1}, x_{2}\}\) joins \(\{x_{3}, x_{4}, x_{5}\}\), for example through \(d(x_{1}, x_{4}) = 3\).

Dendrogram A shows exactly this. B attaches \(x_{3}\) to \(\{x_{1}, x_{2}\}\), where its nearest link is 3, not 2. C and D pair \(x_{3}\) with \(x_{4}\) first, although \(d(x_{4}, x_{5}) = 1\) is smaller than \(d(x_{3}, x_{4}) = 2\).

Answer: A

GATE DA 2024 | Question 43

MCQ · 2 marks · −0.66

Consider the two neural networks (NNs) shown in Figures 1 and 2, with \(ReLU\) activation (\(ReLU(z) = \max\{0, z\}, \forall z \in \mathbb{R}\)). \(\mathbb{R}\) denotes the set of real numbers. The connections and their corresponding weights are shown in the Figures. The biases at every neuron are set to 0. For what values of \(p, q, r\) in Figure 2 are the two NNs equivalent, when \(x_{1}, x_{2}, x_{3}\) are positive?

Figure 1

Network with inputs x1, x2 and x3, a first layer of three neurons, a second layer of two neurons and one output neuron. All input edges have weight 1 (x1 connects to all three first-layer neurons, x2 to the top and bottom ones, x3 to the middle and bottom ones); every first-layer neuron connects to both second-layer neurons with weight 2, and both second-layer neurons connect to the output with weight 3.

Figure 2

Network in which inputs x1, x2 and x3 connect directly to a single output neuron with weights p, q and r respectively.
Options for GATE DA 2024 | Question 43

Explanation

Answer: (A)

The inputs and all weights are positive, so every neuron receives a positive value and \(ReLU\) acts as the identity. Both networks are then linear, and only the total weight from each input to the output matters.

  • First layer (weights 1): the neurons receive \(x_{1} + x_{2}\), \(x_{1} + x_{3}\) and \(x_{1} + x_{2} + x_{3}\), which add up to \(s = 3x_{1} + 2x_{2} + 2x_{3}\).
  • Second layer: each of its two neurons receives \(2s\).
  • Output: \(3(2s) + 3(2s) = 12s\).

So Figure 1 computes \(36x_{1} + 24x_{2} + 24x_{3}\), giving \(p = 36\), \(q = 24\), \(r = 24\). Option D would need \(x_{2}\) and \(x_{3}\) to reach all three first-layer neurons, but each has only two connections.

Answer: A

GATE DA 2024 | Question 53

MSQ · 2 marks

Consider the following figures representing datasets consisting of two-dimensional features with two classes denoted by circles and squares.

Four scatter plots labelled (i) to (iv), each with filled circles and filled squares on axes marked 1 to 3. In (i) circles are at (1, 3), (2, 3) and (1, 2) and squares at about (2, 1), (3, 1) and (2, 0.3); in (ii) a circle is at (2, 2) and squares at (1, 2), (3, 2), (2, 3) and (2, 1); in (iii) squares are at (1, 3) and (3, 1) and circles at (1, 1) and (3, 3); in (iv) squares are at about (1, 2.2), (1, 1.2) and (2, 2.6) and circles at about (2, 0.5), (3, 1.5) and (3, 0.6).

Which of the following is/are TRUE?

Options for GATE DA 2024 | Question 53

Explanation

Answer: (A), (D)

A dataset is linearly separable when a single straight line puts every circle on one side and every square on the other.

  • A holds: in (i) the circles have \(y \ge 2\) and the squares lie around \(y = 1\) or lower, so the line \(y = 1.6\) splits them.
  • B fails: in (ii) the circle at (2, 2) is the midpoint of the squares at (1, 2) and (3, 2). A half-plane holding both squares also holds their midpoint, so the circle cannot be cut off.
  • C fails: (iii) is the XOR pattern. The circles (1, 1), (3, 3) and the squares (1, 3), (3, 1) have the same midpoint (2, 2), which would have to lie on both sides.
  • D holds: in (iv) the squares sit to the upper left and the circles to the lower right, so a slanted line such as \(y = x - 0.3\) works.

Answer: A, D

GATE DA 2024 | Question 62

NAT · 2 marks

Details of ten international cricket games between two teams “Green” and “Blue” are given in Table C. This table consists of matches played on different pitches, across formats along with their winners. The attribute Pitch can take one of two values: spin-friendly (represented as \(S\)) or pace-friendly (represented as \(F\)). The attribute Format can take one of two values: one-day match (represented as \(O\)) or test match (represented as \(T\)).

A cricket organization would like to use the information given in Table C to develop a decision-tree model to predict outcomes of future games between these two teams.

To develop such a model, the computed InformationGain(C, Pitch) with respect to the Target is ______ (rounded off to two decimal places).

Table C
Match NumberPitchFormatWinner (Target)
1\(S\)\(T\)Green
2\(S\)\(T\)Blue
3\(F\)\(O\)Blue
4\(S\)\(O\)Blue
5\(F\)\(T\)Green
6\(F\)\(O\)Blue
7\(S\)\(O\)Green
8\(F\)\(T\)Blue
9\(F\)\(O\)Blue
10\(S\)\(O\)Green

Explanation

Answer: 0.12 to 0.13

Information gain is the entropy of the Target minus the weighted entropy left after splitting on Pitch (logarithms to base 2).

  • All 10 games: 4 Green and 6 Blue, so \(H(C) = -0.4\log_{2}0.4 - 0.6\log_{2}0.6 \approx 0.971\).
  • \(S\) pitches (games 1, 2, 4, 7, 10): 3 Green and 2 Blue, the same 0.6 / 0.4 split with the colours swapped, so the entropy is again \(\approx 0.971\).
  • \(F\) pitches (games 3, 5, 6, 8, 9): 1 Green and 4 Blue, so the entropy is \(-0.2\log_{2}0.2 - 0.8\log_{2}0.8 \approx 0.722\).

Each branch holds half of the games, so

\[ \text{Gain} = 0.971 - \left(\tfrac{1}{2} \times 0.971 + \tfrac{1}{2} \times 0.722\right) = \tfrac{1}{2}(0.971 - 0.722) \approx 0.1245 \]

which is 0.12 to two decimal places (the key accepts 0.12 to 0.13).

Answer: 0.12

GATE DA 2024 | Question 63

NAT · 2 marks

Given the two-dimensional dataset consisting of 5 data points from two classes (circles and squares) and assume that the Euclidean distance is used to measure the distance between two points. The minimum odd value of \(k\) in \(k\)-nearest neighbor algorithm for which the diamond (\(\diamond\)) shaped data point is assigned the label square is ______.

Grid with both axes marked 1 to 3: filled circles at (1, 1) and (1, 2), filled squares at (2, 3), (3, 3) and (3, 2), and a hollow diamond at (2, 1), each point labelled with its coordinates.

Explanation

Answer: 5

Distances from the diamond at (2, 1):

  • circle (1, 1): 1
  • circle (1, 2) and square (3, 2): \(\sqrt{2} \approx 1.41\) each
  • square (2, 3): 2
  • square (3, 3): \(\sqrt{5} \approx 2.24\)

Now try the odd values of \(k\) in turn:

  • \(k = 1\): the nearest point is a circle, so the label is circle.
  • \(k = 3\): two circles and one square; the tie at \(\sqrt{2}\) does not matter because both tied points are among the three. The label is circle.
  • \(k = 5\): all five points vote, 3 squares to 2 circles, so the label is square.

Answer: 5