chapter

    Chapter 1 — Unit 2 — Machine Learning Short Notes for Gate Da

    Chapter 1 — Unit 2 — Machine Learning short notes for GATE DA: 0 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice quest

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    Level 4: Challenger

    Consider a hard-margin SVM trained on the following 2D dataset with labels :

    The optimal decision boundary is , with weight vector and bias .

    Which of the following statements are correct?

    Question 2
    Level 4: Challenger

    Consider a dataset in consisting of four points:

    • Positive class (): and
    • Negative class (): and

    This dataset is not linearly separable in . We apply the feature map defined by .

    Find the maximum margin of a hard-margin support vector machine trained on the transformed dataset . Express your answer as a decimal rounded to two decimal places.

    Question 3
    Level 4: Challenger

    Consider a dataset in with three points: with target , with target , and with target .

    First, apply Principal Component Analysis (PCA) to reduce the input data to one dimension. Let the projected values be corresponding to the three points in the given order.

    Next, fit a LASSO regression model on the projected data: minimize

    over , where is the regularization parameter.

    Find the minimum value of (rounded to two decimal places) such that the optimal LASSO coefficient is exactly zero.

    Question 4
    Level 4: Challenger
    Consider the one-dimensional dataset , . Two regularised linear models (with no intercept) are fit: - Ridge: minimise with . - Lasso: minimise with . Let and be the respective optimal coefficients. Compute the ratio .
    Question 5
    Level 4: Challenger

    Consider a 2D dataset consisting of the points . Let be the covariance matrix of this dataset (computed with divisor ). If the data is projected onto the line , the variance of the projected data is , and the total variance of the original data is . The reconstruction error of this projection is

    Question 6
    Level 4: Challenger

    A logistic regression model with L2 regularization (parameter ) is evaluated at a single data point with label . The current parameters are and . The regularized objective to minimize is , where and .

    Which of the following values are correctly computed for this point?

    Question 7
    Level 4: Challenger

    Consider a dataset in consisting of four points: , , , and .

    First, apply Principal Component Analysis (PCA) to reduce the data to one dimension. Let the projected values be corresponding to the four points in the given order.

    Next, run -means clustering with on the projected 1D data. Initialize the centroids at and , where . In each iteration, assign each point to the nearest centroid; if a point is equidistant from both centroids, assign it to .

    Find the maximum value of (rounded to two decimal places) such that after exactly one iteration of -means, the resulting clusters are and .

    Question 8
    Level 4: Challenger

    Consider the following 2D dataset with four points: . We apply k-means clustering with and initial centroids .

    After the algorithm converges, which of the following are the final centroids?

    Question 9
    Level 4: Challenger

    Consider the polynomial kernel on . Let be the feature map induced by this kernel, so that for all .

    Given and , compute the squared distance in the feature space .

    Question 10
    Level 4: Challenger

    Consider a single-neuron perceptron with initial weights and bias . The activation function is the sign function ( if , else ). The perceptron learning rule is applied sequentially with learning rate : if a point with true label is misclassified, update .

    The training sequence is with , followed by with .

    After processing both points, what is the value of for the test point ?

    Free preview ends here

    Login to view the complete short notes

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Chapter 1 — Unit 2 — Machine Learning Short Notes for GATE DA

    Chapter 1 — Unit 2 — Machine Learning short notes for GATE DA: 0 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    Chapter 1 — Unit 2 — Machine Learning: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Machine Learning MSQ

    Consider a hard-margin SVM trained on the following 2D dataset with labels :

    The optimal decision boundary is , with weight vector and bias .

    Which of the following statements are correct?

    1. A.

      The margin width is $2$.

    2. B.

      The support vectors are and .

    3. C.

      The geometric margin (distance from any support vector to the decision boundary) is $1$.

    4. D.

      The functional margin of is $2$.

    Correct Answer:

    ["A","B","C","D"]

    Step-by-Step Solution

    Key idea: this is a direct formula application for SVM geometry. You can recognise it from the explicit mention of the decision boundary, weight vector, and the request to identify support vectors and compute margins.

    Insight: the margin width is , support vectors satisfy , and the functional margin of a point is .

    Exam route (fastest legal path):

    1. Margin width .
    2. Check each point:
    • : . Support vector.
    • : . Not a support vector.
    • : . Support vector.
    • : . Support vector.
    1. Geometric margin .
    2. Functional margin of (computed in step 2).

    Learning route (full justification):

    Step 1: The margin width is the distance between the two supporting hyperplanes . This distance is .

    Step 2: A point is a support vector if it lies exactly on one of the supporting hyperplanes, i.e., .

    Step 3: The geometric margin is the distance from a support vector to the decision boundary, which is .

    Step 4: The functional margin of any point is , which measures how confidently the point is classified.

    The tempting wrong path: a student might use the wrong formula for the margin width, computing instead of . This would lead to rejecting option A. Another mistake is to think that all points with are support vectors, when only those with equality are. This would incorrectly include . The break is at Step 2, where the tight constraint must be checked.

    Generalisation: for a linear SVM, the margin width is always , and only points that satisfy the constraint with equality are support vectors. Points with functional margin are correctly classified but not on the margin boundary.

    Verification: check that all points satisfy : , , , . All , so the solution is feasible. The margin width $2$ is consistent with the distance between and .

    Answer: A, B, C, D.

    Question 2 · Machine Learning NAT

    Consider a dataset in consisting of four points:

    • Positive class (): and
    • Negative class (): and

    This dataset is not linearly separable in . We apply the feature map defined by .

    Find the maximum margin of a hard-margin support vector machine trained on the transformed dataset . Express your answer as a decimal rounded to two decimal places.

    Correct Answer:

    1.15

    Step-by-Step Solution

    Key idea: This is a hard-margin SVM problem in a transformed feature space. The margin equals , so we minimize subject to functional margin constraints for all . At the optimum, all four points become support vectors (tight constraints).

    Step 1: Compute the transformed points.

    • ,
    • ,
    • ,
    • ,

    Step 2: Write the four margin constraints.

    • :
    • :
    • :
    • :

    Step 3: At the optimal separating hyperplane, all constraints are tight (every point is a support vector — this is the key observation for this small, symmetric dataset).

    Step 4: Compute the margin.

    , so .

    Margin .

    Answer: 1.15

    Question 3 · Machine Learning NAT

    Consider a dataset in with three points: with target , with target , and with target .

    First, apply Principal Component Analysis (PCA) to reduce the input data to one dimension. Let the projected values be corresponding to the three points in the given order.

    Next, fit a LASSO regression model on the projected data: minimize

    over , where is the regularization parameter.

    Find the minimum value of (rounded to two decimal places) such that the optimal LASSO coefficient is exactly zero.

    Correct Answer:

    2.83

    Step-by-Step Solution

    Key idea: This is a synthesis of PCA and LASSO regularization. The key observation is that LASSO produces a sparse solution (exactly zero) when the regularization parameter exceeds a threshold determined by the unregularized OLS solution. We must first compute the PCA projection, then find the LASSO threshold.

    Step 1: PCA projection.

    The data matrix is . The mean is . The centered data is . The covariance matrix is . The eigenvalues are and $0$. The first eigenvector is . Projecting the centered data onto gives .

    Step 2: LASSO threshold.

    The LASSO objective is . The unregularized OLS solution is .

    Compute: .

    .

    .

    The LASSO solution is .

    when , i.e., .

    Step 3: Compute the threshold.

    .

    Answer: 2.83

    Question 4 · Machine Learning MCQ
    Consider the one-dimensional dataset , . Two regularised linear models (with no intercept) are fit: - Ridge: minimise with . - Lasso: minimise with . Let and be the respective optimal coefficients. Compute the ratio .
    1. A.

      9/8

    2. B.

      3/2

    3. C.

      8/9

    4. D.

      15/8

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: this is a regularisation-comparison question. The pivot is that Ridge has a single closed-form solution (differentiate and set to zero), while Lasso has a non-differentiable penalty, so you must do casework on the sign of . Step 1: simplify the unregularised loss. Step 2: Ridge. Step 3: Lasso — casework on the sign of . - Case : , so . Setting gives . This is consistent with . - Case : , so . Setting gives , which contradicts . Discard. - Boundary : , which is larger than . So . Step 4: ratio. Answer: (option A). Common wrong path: in the Lasso case, using instead of for the subgradient of gives and . Then (option D). The sign of the subgradient of at is , not .
    Question 5 · Machine Learning MCQ

    Consider a 2D dataset consisting of the points . Let be the covariance matrix of this dataset (computed with divisor ). If the data is projected onto the line , the variance of the projected data is , and the total variance of the original data is . The reconstruction error of this projection is

    1. A.

      0.65

    2. B.

      1.85

    3. C.

      2.50

    4. D.

      1.50

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: this is a PCA reconstruction error question, recognisable because it asks for the error after projecting onto a specific line. The reconstruction error is simply the total variance minus the variance captured by the projection direction.

    Insight: Total variance is the trace of ; captured variance is the quadratic form where is the unit vector along the line.

    Exam route (fastest legal path):

    1. Mean of the data is .
    2. Centered points: .
    3. .
    4. by symmetry.
    5. .
    6. Total variance .
    7. Direction .
    8. .
    9. Reconstruction error .

    Learning route (full justification):

    Step 1: The covariance matrix captures the spread of the data. The trace is the sum of variances along the axes, which equals the total variance in any orthonormal basis.

    Step 2: The variance of the data when projected onto a unit vector is given by the quadratic form . This is a direct application of the definition of variance for a linear combination of random variables.

    Step 3: The reconstruction error is the variance that is lost during projection. By the Pythagorean theorem for variance (or the trace property), this is exactly .

    Step 4: Substituting the computed values gives .

    The tempting wrong path: a student might use the wrong formula for the projected variance, computing instead of . This leads to a reconstruction error of (option D). Another common mistake is to report the captured variance (option B) or the total variance (option C) instead of the error. The break in the wrong path is at Step 8, where the covariance structure must be included.

    Generalisation: for any projection direction , the reconstruction error is . Only when is the first principal component is this error minimised.

    Verification: the eigenvalues of are $2.0$ and $0.5$ (summing to $2.5$). The direction is not an eigenvector, so the captured variance $1.85$ must lie strictly between the minimum ($0.5$) and maximum ($2.0$) possible variances. The error $0.65$ is consistent with this bound.

    Answer: $0.65$ (option A).

    Question 6 · Machine Learning MSQ

    A logistic regression model with L2 regularization (parameter ) is evaluated at a single data point with label . The current parameters are and . The regularized objective to minimize is , where and .

    Which of the following values are correctly computed for this point?

    1. A.

      The linear predictor is $2$.

    2. B.

      The unregularized cross-entropy loss is .

    3. C.

      The regularized objective is .

    4. D.

      The partial derivative of with respect to is 1 - rac{2}{1+e^2}.

    Correct Answer:

    ["A","C","D"]

    Step-by-Step Solution

    Key idea: this is a synthesis of logistic regression's forward pass, loss, and gradient with L2 regularization. You can recognise it from the combination of a linear predictor, the sigmoid function, and a penalty term .

    Insight: the unregularized gradient is , and the regularized gradient simply adds . The loss for is always , not .

    Exam route (fastest legal path):

    1. .
    2. .
    3. Unregularized loss .
    4. Regularized .
    5. Gradient . For : .

    Learning route (full justification):

    Step 1: Compute the linear predictor . This is a direct dot product.

    Step 2: Apply the sigmoid function to get the predicted probability .

    Step 3: Compute the unregularized cross-entropy loss for , which is .

    Step 4: Add the L2 penalty to get the regularized objective .

    Step 5: Differentiate with respect to . The derivative of the loss is , and the derivative of the penalty is .

    The tempting wrong path: a student might use the wrong formula for the loss, computing instead of . This leads to selecting the second option. Another mistake is forgetting the regularization term in the gradient, yielding just , or using the wrong sign for the penalty derivative.

    Generalisation: the gradient of the regularized logistic loss is the sum of the unregularized gradient and the regularization gradient . The loss for is always , which is bounded below by 0 and decreases as increases.

    Verification: check that . . Loss . . Gradient for . All values are consistent and mathematically sound.

    Answer: A, C, D.

    Question 7 · Machine Learning NAT

    Consider a dataset in consisting of four points: , , , and .

    First, apply Principal Component Analysis (PCA) to reduce the data to one dimension. Let the projected values be corresponding to the four points in the given order.

    Next, run -means clustering with on the projected 1D data. Initialize the centroids at and , where . In each iteration, assign each point to the nearest centroid; if a point is equidistant from both centroids, assign it to .

    Find the maximum value of (rounded to two decimal places) such that after exactly one iteration of -means, the resulting clusters are and .

    Correct Answer:

    3.00

    Step-by-Step Solution

    Key idea: This is a synthesis of PCA and -means with a boundary trap. The key observation is that all points lie on the -axis, so PCA's first principal component is , and the projected values are simply the -coordinates: . The problem then reduces to finding the maximum initialization such that the -means assignment produces the desired clustering.

    Step 1: PCA projection.

    The data matrix is . The mean is . The centered data is . The covariance matrix is . The first eigenvector is with eigenvalue $3.125$. Projecting onto gives .

    Step 2: -means assignment.

    Initial centroids: , . We want the assignment to be and .

    For $0$ to go to : (always true since ).

    For $1$ to go to : or . Since , we need .

    For $4$ to go to : . This means , so or . Since , we need .

    For $5$ to go to : , always true.

    Step 3: Boundary analysis.

    The binding constraint is . At , the point $4$ is equidistant from and (both distance $1$). The tie-breaking rule assigns it to , so the clustering is and as desired.

    If , then , so $4$ goes to , giving the wrong clustering.

    Answer: 3.00

    Question 8 · Machine Learning MSQ

    Consider the following 2D dataset with four points: . We apply k-means clustering with and initial centroids .

    After the algorithm converges, which of the following are the final centroids?

    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    ["A","B"]

    Step-by-Step Solution

    Key idea: this is a casework question for k-means clustering. You can recognise it from the sequential nature of the algorithm, the explicit mention of initial centroids, and the request for final centroids after convergence.

    Insight: k-means alternates between assignment (assign each point to the nearest centroid) and update (recompute centroids as the mean of assigned points). You must track the assignments carefully, as sign errors in distance computation can lead to wrong assignments.

    Exam route (fastest legal path):

    1. Iteration 1 - Assignment:
    • : dist to , dist to . Assign to cluster 1.
    • : dist to , dist to . Assign to cluster 2.
    • : dist to , dist to . Assign to cluster 1.
    • : dist to , dist to . Assign to cluster 2.
    1. Iteration 1 - Update:
    • .
    • .
    1. Iteration 2 - Assignment:
    • : dist to , dist to . Assign to cluster 1.
    • : dist to , dist to . Assign to cluster 1.
    • : dist to , dist to . Assign to cluster 2.
    • : dist to , dist to . Assign to cluster 2.
    1. Iteration 2 - Update:
    • .
    • .
    1. Iteration 3 - Assignment:
    • : dist to , dist to . Assign to cluster 1.
    • : dist to , dist to . Assign to cluster 1.
    • : dist to , dist to . Assign to cluster 2.
    • : dist to , dist to . Assign to cluster 2.
    1. Iteration 3 - Update:
    • , .
    • Converged!

    Learning route (full justification):

    Step 1: In each iteration, assign each point to the nearest centroid using Euclidean distance.

    Step 2: Recompute each centroid as the mean of the points assigned to it.

    Step 3: Repeat until the assignments no longer change.

    The tempting wrong path: a sign error in computing distances is the most common mistake. For example, in Iteration 1, a student might compute the distance from to as , but then incorrectly think and assign to cluster 1. This would lead to and , which are options C and D. The break is at Step 1 of Iteration 1, where , so should be assigned to cluster 2.

    Generalisation: k-means converges when the assignments stabilize. The final centroids depend on the initialization, and different initializations can lead to different local optima.

    Verification: check that the final assignments are consistent with the final centroids. Points and are closer to than to , and points and are closer to than to . The assignments are stable.

    Answer: A, B.

    Question 9 · Machine Learning MCQ

    Consider the polynomial kernel on . Let be the feature map induced by this kernel, so that for all .

    Given and , compute the squared distance in the feature space .

    1. A.

      22

    2. B.

      2

    3. C.

      18

    4. D.

      31

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: this is a kernel-trick geometry question. The pivot is the identity

    which lets you compute a distance in without ever constructing explicitly.

    Step 1: compute the three kernel values using .

    Step 2: plug into the identity.

    Answer: 22 (option A).

    Common wrong path: replacing with the linear kernel gives (option B). The mistake is using the wrong kernel formula — the polynomial kernel squares the entire affine inner product, not just the dot product.

    Question 10 · Machine Learning MCQ

    Consider a single-neuron perceptron with initial weights and bias . The activation function is the sign function ( if , else ). The perceptron learning rule is applied sequentially with learning rate : if a point with true label is misclassified, update .

    The training sequence is with , followed by with .

    After processing both points, what is the value of for the test point ?

    1. A.

      -1

    2. B.

      0

    3. C.

      5

    4. D.

      1

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: this is a perceptron update casework question. You must track the weight vector step by step, checking the sign of the dot product at each stage to determine if an update occurs.

    Insight: The update rule is only when misclassified. A sign error in evaluating or in the update direction will cascade into the final weights.

    Exam route (fastest legal path):

    1. Initial .
    2. Point 1: .
    3. Since (), update: .
    4. Point 2: .
    5. Since (), update: .
    6. Test point: .

    Learning route (full justification):

    Step 1: The perceptron algorithm updates weights only on mistakes. The direction of the update is determined by the true label .

    Step 2: For , the dot product is positive, so the prediction is . The true label is , so this is a mistake. We subtract from .

    Step 3: The new weights are . For , the dot product is negative, so the prediction is . The true label is , so this is also a mistake. We add to .

    Step 4: The final weights are . The dot product with the test point is .

    The tempting wrong path: a sign error in Step 3 (adding instead of subtracting) leads to . Then for , the dot product is , prediction , mistake, update to . The final dot product is $5$ (option C). A sign error in evaluating the dot product in Step 4 (thinking is positive) leads to no update, final weights , and a final dot product of $0$ (option B). A sign error in the update direction in Step 5 leads to and a final dot product of $1$ (option D).

    Generalisation: in sequential algorithms, a single sign error early on changes the state for all subsequent steps. Always verify the sign of the dot product before applying the update rule.

    Verification: trace the weights again. . The dot products are $4$ (mistake), (mistake). The final vector is correct.

    Answer: (option A).

    More short notes in this unit