MauryaHub PYQ Practice

Machine Learning Techniques · Quiz 1 · Jan 2026

Machine Learning Techniques · Quiz 1 · Jan 2026

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

16 / 16 published solutions

Question 2 MCQ · 3.0 marks

Consider a clustering problem with
Source diagram or notation
data-points and two clusters
Source diagram or notation
. As initialization, a subset of the dataset comprising the first fifty data-points, call this
Source diagram or notation
, are assigned to cluster
Source diagram or notation
and the remaining points, call this
Source diagram or notation
, are assigned to cluster
Source diagram or notation
. K-means is run for this configuration and it converges after
Source diagram or notation
iterations. Consider the following scenarios:
Source diagram or notation
: After convergence, it is observed that all points in
Source diagram or notation
are assigned to cluster
Source diagram or notation
and all points in
Source diagram or notation
are assigned to cluster
Source diagram or notation
.
Source diagram or notation
: After convergence, it is observed that all points in
Source diagram or notation
are assigned to cluster
Source diagram or notation
and all points in
Source diagram or notation
are assigned to cluster
Source diagram or notation
. Which of the following is true?
6406536344671.
Scenario-1 is possible, but scenario-2 is impossible.
6406536344672.
Scenario-1 is impossible, but scenario-2 is possible.
6406536344673.
Both scenarios are possible.
6406536344674.
Both scenarios are impossible.

Published solution

**1. Compare the partitions:** Scenario 2 returns to the initial partition; scenario 1 has exactly the same two groups with their labels exchanged. Both therefore have the initial partition’s within-cluster sum of squared distances after fitting its means. **2. Use Lloyd’s descent property:** Updating means minimizes that objective for a fixed assignment; reassigning points to strictly nearer means decreases it. A genuine ten-iteration run cannot return to the same objective-equivalent partition after making such progress. **3. Apply the convergence condition:** If the initial assignment were already stable, the algorithm would stop immediately rather than first converge after ten iterations. Thus neither proposed final assignment is compatible with the stated nontrivial run. **Answer: D — Both scenarios are impossible under standard Lloyd updates.** **Convention note:** This uses the usual deterministic, noncycling tie handling and nonempty-cluster convention. Gratuitous relabelling or arbitrary changes between tied assignments are not the standard run meant here. A: **Incorrect:** A label-swapped initial partition cannot result after a genuinely descending ten-iteration run. B: **Incorrect:** Returning to the initial partition would contradict the same descent argument. C: **Incorrect:** Neither return is compatible with the stated iteration count. D: **Correct:** Both have the initial partition’s objective and cannot be reached after strict progress.

Report a correction for Q2

Question 3 MSQ · 3.0 marks

Consider a centered dataset
Source diagram or notation
in
Source diagram or notation
such that every data-point
Source diagram or notation
in
Source diagram or notation
satisfies the equation
Source diagram or notation
. Standard PCA is performed on the dataset. Which of the following could be the fourth principal component?
6406536344675.Source diagram or notation
6406536344676.Source diagram or notation
6406536344677.Source diagram or notation
6406536344678.Source diagram or notation

Published solution

**1. Find a zero-variance direction:** All centered points satisfy \(a^Tx=0\) for \(a=(2,1,-1,2)^T\). Therefore \(Ca=0\), because every outer-product contribution \(xx^Ta\) is zero. **2. Normalize the normal vector:** \(\|a\|=\sqrt{4+1+1+4}=\sqrt{10}\). Thus \(a/\sqrt{10}\) and its negative are unit eigenvectors with eigenvalue zero. **3. Identify the last component:** PCA orders directions by decreasing variance; the hyperplane normal supplies the zero-variance fourth component. Both signs describe the same principal axis. **Answer: A, B — \(\pm(2,1,-1,2)/\sqrt{10}\).** **Convention note:** The intended answer assumes the data span the stated three-dimensional hyperplane. If their rank is smaller, additional zero-eigenvalue directions can also be chosen as the fourth component; the single equation alone does not exclude that degeneracy. A: **Correct:** It is the normalized normal vector with zero projected variance. B: **Correct:** It is the opposite orientation of the same zero-variance axis. C: **Incorrect:** It is not parallel to the stated hyperplane normal. D: **Incorrect:** It is not parallel to the stated hyperplane normal.

Report a correction for Q3

Question 4 NAT · 3.0 marks

Consider a polynomial kernel of degree
Source diagram or notation
on a feature space of dimension
Source diagram or notation
. How many features will the transformed space have
Source diagram or notation

Published solution

**1. State the kernel convention:** For the inhomogeneous polynomial kernel \(k(x,z)=(1+x^Tz)^3\), the feature map includes all monomials of total degree 0 through 3 in four variables. **2. Count monomials:** Introduce a slack exponent for the unused degree. Stars-and-bars gives \[\binom{4+3}{3}=\binom73=\frac{7\cdot6\cdot5}{3\cdot2\cdot1}=35.\] **Answer: 35.** **Convention note:** The question does not print the kernel formula. Its key uses the inhomogeneous convention. The homogeneous kernel (xᵀz)^3 has only degree-three monomials and dimension C(6,3)=20.

Report a correction for Q4

Question 5 NAT · 3.0 marks

Consider the Gaussian kernel,
Source diagram or notation
with
Source diagram or notation
. Compute the value of
Source diagram or notation
and enter your answer correct to two decimal places.

Published solution

**1. Use the Gaussian kernel:** \(k(x,z)=\exp[-\|x-z\|^2/(2\sigma^2)]\). Here \(x=(0,1)\), \(z=(1,0)\), and \(\sigma=1\). **2. Compute squared distance:** \(\|x-z\|^2=(-1)^2+1^2=2\). **3. Substitute:** \(k=e^{-2/(2\cdot1)}=e^{-1}\approx0.367879\), giving 0.37. **Answer: 0.37.**

Report a correction for Q5

Question 6 NAT · 3.0 marks

Consider the following data-points in a clustering problem with five data-points and three clusters (k = 3):
Source diagram or notation
K-means
Source diagram or notation
is used to initialize the three means. The first mean is chosen to be
Source diagram or notation
and the second mean to be
Source diagram or notation
. Find the probability of choosing
Source diagram or notation
as the third mean. That is, compute
Source diagram or notation
. Enter your answer correct to one decimal place.

Published solution

**1. Apply K-means++ sampling:** Each unchosen point is weighted by its squared distance to the nearest already chosen mean, (0,0) or (1,1). **2. Compute the weights:** For (−1,0), (2,1), and (1,−1), the nearest squared distances are respectively 1,1,2. The two chosen points have weight zero. **3. Normalize:** \[P(\mu_3=(1,-1))=\frac2{1+1+2}=\frac12=0.5.\] **Answer: 0.5.**

Report a correction for Q6

Question 7 NAT · 3.0 marks

Consider a cube of edge-length
Source diagram or notation
centered at the origin with its corners represented as
Source diagram or notation
. These eight points make up a dataset
Source diagram or notation
. Based on the above data, answer the given subquestions.
Find the covariance matrix
Source diagram or notation
of the dataset. Enter the sum of all the entries of
Source diagram or notation
as the answer.

Published solution

**1. Use symmetry:** The eight corners \((\pm1,\pm1,\pm1)\) have mean zero. Each coordinate has mean square 1; each cross-product averages to zero because all sign combinations occur. **2. Form covariance:** With normalization 1/8, \[C=\frac18\sum_{i=1}^8x_ix_i^T=\begin{pmatrix}1&0&0\\ 0&1&0\\ 0&0&1\end{pmatrix}.\] **3. Sum entries:** The three diagonal ones contribute \(1+1+1=3\). **Answer: 3.** **Convention note:** The course uses population/PCA normalization 1/n. The unbiased 1/(n−1) covariance would instead be (8/7)I.

Report a correction for Q7

Question 8 NAT · 2.0 marks

Consider a cube of edge-length
Source diagram or notation
centered at the origin with its corners represented as
Source diagram or notation
. These eight points make up a dataset
Source diagram or notation
. Based on the above data, answer the given subquestions.
Let
Source diagram or notation
be some unit vector. Find the variance of the dataset along the direction
Source diagram or notation
.

Published solution

**1. Compute covariance from the corners:** Equal coordinate sign combinations give \(C=I_3\) under the course’s 1/8 normalization. **2. Compute projected variance:** For any unit vector v, \[\operatorname{Var}(v^Tx)=v^TCv=v^Tv=\|v\|^2=1.\] The cube is equally variable in every direction. **Answer: 1.**

Report a correction for Q8

Question 9 NAT · 2.0 marks

Standard PCA is performed on a centered dataset in
Source diagram or notation
. The first three principal components are:
Source diagram or notation
The first two principal components are retained and the third is discarded. The coordinate representation of the data-point
Source diagram or notation
after projection onto the first two principal components is
Source diagram or notation
. Based on the above data, answer the given subquestions.
Find
Source diagram or notation
. Enter your answer correct to three decimal places.

Published solution

**1. Use PCA coordinates:** For centered data, the coordinate along a unit principal direction is the dot product \(a=w_1^Tx\). **2. Substitute:** With \(w_1=(1,1,0)/\sqrt2\) and \(x=(1,2,3)\), \[a=\frac{1+2+0}{\sqrt2}=\frac3{\sqrt2}\approx2.121320.\] To three decimal places: 2.121. **Answer: 2.121.**

Report a correction for Q9

Question 10 NAT · 2.0 marks

Standard PCA is performed on a centered dataset in
Source diagram or notation
. The first three principal components are:
Source diagram or notation
The first two principal components are retained and the third is discarded. The coordinate representation of the data-point
Source diagram or notation
after projection onto the first two principal components is
Source diagram or notation
. Based on the above data, answer the given subquestions.
Find
Source diagram or notation
. Enter your answer correct to three decimal places.

Published solution

**1. Select the second direction:** \(b=w_2^Tx\), where \(w_2=(-1,1,0)/\sqrt2\) and \(x=(1,2,3)\). **2. Take the dot product:** \[b=\frac{-1+2+0}{\sqrt2}=\frac1{\sqrt2}\approx0.707107.\] To three decimal places: 0.707. **Answer: 0.707.**

Report a correction for Q10

Question 11 MCQ · 2.0 marks

Answer true or false for the given subquestions.
If
Source diagram or notation
and
Source diagram or notation
are valid kernels, then
Source diagram or notation
is also a valid kernel.
6406536344686.
True
6406536344687.
False

Published solution

**1. Use positive-semidefinite Gram matrices:** If \(K_1,K_2\) are kernel Gram matrices, then for any coefficients c, \[c^T(2K_1+5K_2)c=2c^TK_1c+5c^TK_2c\ge0.\] **2. Conclude validity:** Symmetry is also preserved, so the positive weighted sum is a valid kernel. **Answer: A — True.** A: **Correct:** Nonnegative sums preserve the kernel’s positive-semidefinite property. B: **Incorrect:** The weights 2 and 5 are positive, so the closure property applies.

Report a correction for Q11

Question 12 MCQ · 2.0 marks

Answer true or false for the given subquestions.
If
Source diagram or notation
is a data-matrix of shape
Source diagram or notation
, then
Source diagram or notation
and
Source diagram or notation
have the same eigenvectors.
6406536344688.
True
6406536344689.
False

Published solution

**1. Compare dimensions:** For \(X\in\mathbb R^{d\times n}\), \(X^TX\) is n×n and \(XX^T\) is d×d. Their eigenvectors generally live in different spaces. **2. State the correct relationship:** They share nonzero eigenvalues. If \(X^TXv=\lambda v\), \(\lambda>0\), then \(Xv/\sqrt\lambda\) is an eigenvector of \(XX^T\), not generally the same vector. **Answer: B — False.** A: **Incorrect:** Shared nonzero eigenvalues do not imply shared eigenvectors. B: **Correct:** Their eigenvectors have different dimensions in general and are related by multiplication by X.

Report a correction for Q12

Question 13 MCQ · 2.0 marks

Consider a dataset in
Source diagram or notation
for a clustering problem with two clusters
Source diagram or notation
. The
Source diagram or notation
data-point is represented as
Source diagram or notation
.
Source diagram or notation
Source diagram or notation
indicates the cluster assignment vector at the end of time-step
Source diagram or notation
.
Source diagram or notation
indicates the initial assignment. The cluster indices are represented by
Source diagram or notation
and
Source diagram or notation
, that is,
Source diagram or notation
. Based on the above data, answer the given subquestions.
If
Source diagram or notation
, which of the following is the final cluster assignment after running K-means on this dataset with this initial configuration?
6406536344690.Source diagram or notation
6406536344691.Source diagram or notation
6406536344692.Source diagram or notation
6406536344693.Source diagram or notation
6406536344694.Source diagram or notation

Published solution

**1. Compute initial means:** For points (0,0),(3,0),(4,1),(1,1) and assignment (1,1,2,2), \(\mu_1=(1.5,0)\), \(\mu_2=(2.5,1)\). **2. Reassign by squared distances:** Ordered distance pairs to the means are (2.25,7.25), (2.25,1.25), (7.25,2.25), (1.25,2.25). This gives (1,2,2,1). **3. Update and check:** New means are (0.5,0.5) and (3.5,0.5). Every point remains with its nearer mean, so (1,2,2,1) is final. **Answer: B — (1,2,2,1).** A: **Incorrect:** The middle two near-boundary points change from the initial assignment. B: **Correct:** It agrees with both reassignment and the stable updated means. C: **Incorrect:** It places the far-right point with the far-left point. D: **Incorrect:** It incorrectly keeps the two right-side points in cluster 1. E: **Incorrect:** The second point is nearer the updated right-side cluster.

Report a correction for Q13

Question 14 MCQ · 2.0 marks

Consider a dataset in
Source diagram or notation
for a clustering problem with two clusters
Source diagram or notation
. The
Source diagram or notation
data-point is represented as
Source diagram or notation
.
Source diagram or notation
Source diagram or notation
indicates the cluster assignment vector at the end of time-step
Source diagram or notation
.
Source diagram or notation
indicates the initial assignment. The cluster indices are represented by
Source diagram or notation
and
Source diagram or notation
, that is,
Source diagram or notation
. Based on the above data, answer the given subquestions.
If
Source diagram or notation
, which of the following is the final cluster assignment after running K-means on this dataset with this initial configuration?
6406536344695.Source diagram or notation
6406536344696.Source diagram or notation
6406536344697.Source diagram or notation
6406536344698.Source diagram or notation
6406536344699.Source diagram or notation

Published solution

**1. Compute means from the given assignment:** For (1,2,2,1), cluster 1 contains (0,0),(1,1), so \(\mu_1=(0.5,0.5)\); cluster 2 contains (3,0),(4,1), so \(\mu_2=(3.5,0.5)\). **2. Check the distances:** The first and fourth points each have squared distance 0.5 to cluster 1; the second and third each have squared distance 0.5 to cluster 2. All alternative distances are larger. **3. Conclude:** No assignment changes, so the initial assignment is already the final one. **Answer: B — (1,2,2,1).** A: **Incorrect:** It mixes the left and right groups. B: **Correct:** It is stable under its own centroid update. C: **Incorrect:** It pairs opposite-side points. D: **Incorrect:** It puts three points into the left cluster despite their distances. E: **Incorrect:** The second point belongs to the right cluster.

Report a correction for Q14

Question 15 MCQ · 2.0 marks

Let
Source diagram or notation
be i.i.d. observations from the mixture distribution
Source diagram or notation
where
Source diagram or notation
The observed data are
Source diagram or notation
Assume that the initial estimate of the mixing parameter is
Source diagram or notation
Based on the above data, answer the given subquestions.
Which of the following expressions correctly represents the log-likelihood function
Source diagram or notation
for the given data?
6406536344700.Source diagram or notation
6406536344701.Source diagram or notation
6406536344702.Source diagram or notation
6406536344703.Source diagram or notation

Published solution

**1. Form the observed-data likelihood:** Independence gives \[L(\theta)=\prod_{i=1}^4[\theta f_1(x_i)+(1-\theta)f_2(x_i)].\] **2. Take logs and insert the densities:** \[\ell(\theta)=\sum_{i=1}^4\log[\theta e^{-x_i}+(1-\theta)3e^{-3x_i}].\] The logarithm applies to each mixture sum before summing across observations. **Answer: C — \(\sum_i\log[\theta e^{-x_i}+(1-\theta)3e^{-3x_i}]\).** A: **Incorrect:** It averages component log-densities instead of taking the log of the mixture density. B: **Incorrect:** Independence gives a product across observations, not a sum inside one logarithm. C: **Correct:** It is the sum of log mixture densities. D: **Incorrect:** It omits the second component entirely.

Report a correction for Q15

Question 16 NAT · 3.0 marks

Let
Source diagram or notation
be i.i.d. observations from the mixture distribution
Source diagram or notation
where
Source diagram or notation
The observed data are
Source diagram or notation
Assume that the initial estimate of the mixing parameter is
Source diagram or notation
Based on the above data, answer the given subquestions.
Consider the E-step of the EM algorithm. Introduce latent variables
Source diagram or notation
such that
Source diagram or notation
if
Source diagram or notation
is generated from
Source diagram or notation
. Compute the posterior responsibility
Source diagram or notation
for each observation
Source diagram or notation
. Write down
Source diagram or notation
as your answer. Enter the answer correct to two decimal places.

Published solution

**1. Apply Bayes’ rule:** At \(\theta=0.6\), \[\gamma(x)=\frac{0.6e^{-x}}{0.6e^{-x}+0.4(3e^{-3x})}=\frac1{1+2e^{-2x}}.\] **2. Evaluate each observation:** For x=0.2,0.5,1.1,1.8, responsibilities are approximately 0.427234,0.576117,0.818594,0.948184. **3. Sum before rounding:** \(\sum_i\gamma_i\approx2.770129\), giving 2.77. **Answer: 2.77.**

Report a correction for Q16

Question 17 MCQ · 3.0 marks

Let
Source diagram or notation
be i.i.d. observations from the mixture distribution
Source diagram or notation
where
Source diagram or notation
The observed data are
Source diagram or notation
Assume that the initial estimate of the mixing parameter is
Source diagram or notation
Based on the above data, answer the given subquestions.
Using a Maximum A Posteriori (MAP) decision rule, a data point
Source diagram or notation
is assigned to mixture 2 if the posterior responsibility
Source diagram or notation
. Based on the values calculated in the E-step, which data point(s) are classified as belonging to Component 2?
6406536344705.Source diagram or notation
6406536344706.Source diagram or notation
6406536344707.Source diagram or notation
6406536344708.
All four points

Published solution

**1. Use the component-2 rule:** Since \(\gamma(x)=P(Z=1\mid x)\), assign component 2 when \(\gamma(x)\le0.5\). **2. Solve the boundary:** \(1/(1+2e^{-2x})\le1/2\) gives \(x\le(\ln2)/2\approx0.346574\). **3. Check the four observations:** Only 0.2 lies below this threshold; 0.5,1.1,1.8 are assigned to component 1. **Answer: A — {0.2} only.** A: **Correct:** Only 0.2 has first-component responsibility at most one-half. B: **Incorrect:** 0.5 has responsibility approximately 0.576, above one-half. C: **Incorrect:** Both larger observations have high first-component responsibility. D: **Incorrect:** Three observations exceed the decision threshold.

Report a correction for Q17