The supervised learning framework: inputs, labels, loss and generalisation; how regression (real-valued output) differs from classification (class label); and the error measures GATE asks you to compute.
In supervised learning you are given a training set of labelled pairs , where is a feature vector and is the label (target). You choose a hypothesis from a model family (lines, trees, networks) so that on new data drawn from the same distribution.
The type of decides the problem:
Regression
Classification
Output
real number, e.g. price, temperature
one of classes, e.g. spam / not spam
Typical loss
squared error
0–1 loss, cross-entropy, hinge
Output of model
a number
a class, often via scores or
Syllabus methods
linear, multiple, ridge regression; kNN and tree regression
A classification problem with is binary; is multiclass. Predicting an ordered count or score with a real-valued model is still regression.
Learning means minimising the average training loss (empirical risk) , but the goal is low loss on unseen data, called the test or generalisation error.
2. Measuring a regression model
For predictions and residuals :
Mean squared error: . Penalises large errors heavily. RMSE is in the units of .
Mean absolute error: . Less sensitive to outliers.
Coefficient of determination: , where and .
Reading :
: perfect fit. : no better than always predicting .
On training data with an intercept, least squares gives . On test data can be negative (worse than the mean).
Adding a feature to a least-squares model never lowers the training , so a higher training alone does not mean a better model.
Squared error is the default regression loss because it is differentiable and gives a closed-form least-squares solution; its minimiser over constants is the mean, while the minimiser of absolute error is the median.
3. Measuring a classifier: the confusion matrix
For a binary classifier, count the four outcomes on the evaluation set:
TP (true positive), FN (false negative: a missed positive), FP (false positive: a false alarm), TN (true negative).
From these:
Accuracy ; error rate accuracy.
Precision : of the predicted positives, how many are real.
Recall (sensitivity, true positive rate) : of the real positives, how many were found.
Specificity .
F1 score , the harmonic mean of precision and recall.
When accuracy misleads: with imbalanced classes (say 95% negatives), a model that always says "negative" has 95% accuracy but recall 0. Use precision, recall or F1 there. Precision matters when false alarms are costly (spam filter); recall matters when misses are costly (disease screening). Raising the decision threshold usually raises precision and lowers recall.
Binary confusion matrix: rows are actual classes, columns are predicted classes
4. Decision boundaries and multiclass strategies
A classifier splits the feature space into regions, one per class; the surface between regions is the decision boundary.
Linear classifiers (logistic regression, LDA, linear SVM, perceptron) use a hyperplane and predict by the sign of .
Non-linear boundaries come from kNN, decision trees, kernel SVMs, MLPs, and from linear models on transformed features (e.g. ).
Parametric vs non-parametric: a parametric model has a fixed number of parameters (linear regression has ). A non-parametric model such as kNN keeps the training data and grows with .
Binary methods for classes:
One-vs-rest: train classifiers, class vs the rest; predict the class with the highest score.
One-vs-one: train classifiers, one per pair; predict by majority vote.
Some models are multiclass by nature: softmax regression, naive Bayes, LDA, kNN, decision trees.
A discriminative model learns or the boundary directly (logistic regression, SVM). A generative model learns and and applies Bayes' theorem (naive Bayes, LDA).
5. Training error, test error and overfitting
Training error is an optimistic estimate: the model has seen those points. To estimate generalisation, keep a test set that is never used for fitting or for choosing settings; use a validation set (or cross-validation) for choosing hyperparameters such as in kNN, tree depth or the ridge penalty .
Underfitting: the model is too simple; both training and test error are high (high bias).
Overfitting: the model fits noise; training error is low but test error is high (high variance).
As model complexity grows, training error keeps falling, while test error first falls and then rises. The best model sits near the bottom of the test error curve.
Practical checks:
A 1-nearest-neighbour classifier or a fully grown tree has zero training error on distinct points; that says nothing about test error.
More training data usually reduces overfitting.
Regularisation (penalising large weights, pruning trees) trades a little bias for less variance.
These ideas are developed in the bias–variance and cross-validation topics.
Formulas to remember
Mean squared error
Coefficient of determination
Accuracy
Precision and recall
F1 scoreHarmonic mean of precision and recall
One-vs-one classifier count classes; one-vs-rest needs only
Common mistakes
Using accuracy on a heavily imbalanced dataset; a trivial majority-class model can score high.
Swapping precision and recall: precision divides by predicted positives (TP + FP), recall by actual positives (TP + FN).
Treating a numeric target such as a score or price as classification just because it takes integer values.
Reading a low training error as proof of a good model; only held-out data estimates generalisation.
Forgetting that test-set can be negative; the bound holds only for least squares on its own training data.
Worked examples
Try each step yourself, then reveal the working.
Example 1: Metrics from a confusion matrix
numerical
A disease test is evaluated on 200 people: TP = 40, FP = 10, FN = 20, TN = 130. Find accuracy, precision, recall and F1.
Step 1: Find accuracy.
Try it on paper first.
Example 2: MSE, MAE and R-squared
numerical
True values and predictions . Find MSE, MAE and .
Step 1: Write the residuals.
Try it on paper first.
Example 3: Regression or classification?
conceptual
Classify each task: (a) predict tomorrow's rainfall in mm; (b) decide whether a loan applicant will default; (c) recognise a handwritten digit 0–9; (d) predict a student's GATE score out of 100.
Step 1: Ask: is the target a real quantity or a category?
Try it on paper first.
Example 4: Why accuracy can mislead
conceptual
In a fraud dataset, 2% of transactions are fraud. Model M always predicts 'not fraud'. Comment on its accuracy, precision and recall for the fraud class.
Step 1: Find its accuracy.
Try it on paper first.
Previous year questions
4 official GATE DA questions on this topic, newest first.
10 questions: up to 4 official PYQs and original practice questions, with GATE marking (MCQ wrong answers lose marks). Score 60% or more to pass. A new set is drawn each time.
Mark as mastered
Loading your progress…
My revision notes
Notes written by the GATEiit team against the official GATE DA syllabus; being checked by a reviewer. Updated 2026-11-21. Spotted a mistake? Use Report an issue on any question, or contact us.