chapter

    Model Selection, Cross-validation and Performance Metrics Notes for Gate Da

    Model Selection, Cross-validation and Performance Metrics notes for GATE DA: 34 study cards covering concepts, formulas, shortcuts and exam traps, plus solved

    Model Selection Cross Validation and Performance Metrics notes

    Chapter Roadmap: Model Selection, Cross-Validation and Performance Metrics

    Chapter Roadmap

    Master the art of evaluating machine learning models. By the end of this chapter, you will know how to reliably estimate generalization error and choose the best performing model.

    1. Cross-Validation and Model Selection (Part 1)
    K-Fold, LOOCV, and the bias-variance tradeoff in evaluation. Weightage: Moderate
    2. Cross-Validation and Model Selection (Part 2)
    Stratified sampling and practical model selection pipelines. Weightage: High
    3. Classification Performance Metrics (Part 1)
    Confusion matrix, Precision, Recall, and Accuracy. Weightage: Moderate
    4. Classification Performance Metrics (Part 2)
    F1 Score, ROC curves, and Area Under the Curve (AUC). Weightage: High

    Cross-Validation and Model Selection

    SUPERVISED LEARNING > MODEL SELECTION Cross-Validation and Model Selection

    Why this matters:
    A single train-test split can give a misleading estimate of model performance due to random chance. Cross-validation systematically rotates the data, providing a robust, reliable measure of how your model will generalize to unseen data.

    What you will learn here:

    • The fundamental flaw of a single holdout set.
    • The mechanics of K-Fold and Leave-One-Out Cross-Validation.
    • The bias-variance tradeoff in choosing the number of folds, K.
    • How to avoid the critical trap of data leakage during preprocessing.

    The Need for Cross-Validation

    The Need for Cross-Validation

    When evaluating a model, the gold standard is to test it on data it has never seen during training. The simplest approach is a single train-test split (holdout method).

    However, a single split has a major flaw: high variance in the performance estimate. Depending on how the data is randomly shuffled, the test set might be unusually easy or unusually hard. This "luck of the draw" can lead to overestimating or underestimating the model's true generalization ability.

    The Solution: Cross-validation systematically rotates which data is used for training and which is used for validation. This ensures every data point contributes to both training and evaluation, yielding a much more stable and reliable error estimate.

    31 more cards in this chapter

    Try a question

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

    Question 1
    Level 1: Warm-up

    A classifier evaluates a dataset with 100 positive and 100 negative samples. It achieves a Precision of 0.8 and a Recall of 0.6. What is the minimum number of True Negatives?

    Question 2
    Level 1: Warm-up

    Match the cross-validation method with the number of validation splits it generates on a training pool of size .

    P: Hold-out

    Q: -fold

    R: LOOCV

    1: $1$

    2:

    3:

    Question 3
    Level 1: Warm-up

    A machine learning practitioner uses Leave-One-Out Cross-Validation (LOOCV) on a training pool and obtains exactly 450 validation splits. If 50 samples were strictly held out as a final test set, what is the total number of samples in the original dataset?

    Question 4
    Level 1: Warm-up

    Match the cross-validation scenario with the exact number of validation splits it generates.

    P: , , $5$-fold CV on the training pool.

    Q: , no separate test set, Leave-One-Out CV (LOOCV).

    R: , single hold-out validation split.

    1: $1$

    2: $5$

    3: $400$

    4: $500$

    Question 5
    Level 1: Warm-up

    In a Leave-One-Out Cross-Validation (LOOCV) process on a training pool, the total number of sample-uses for training across all splits combined is $2450$. If the original dataset had $10$ samples strictly held out for testing, what is the total number of samples $N$ in the original dataset?

    Question 6
    Level 1: Warm-up

    Which of the following statements correctly bounds the Precision of a classifier that predicts the positive class for every single sample in a dataset with actual positives and actual negatives?

    Question 7
    Level 1: Warm-up

    Assertion (A): The F1 score of a classifier is exactly $0.5$ if its Precision is $1.0$ and its Recall is $0.0$.

    Reason (R): The F1 score is calculated as the arithmetic mean of Precision and Recall.

    Which of the following is correct?

    Question 8
    Level 1: Warm-up

    A classifier evaluates $100$ stories. The actual number of stories by Author X is $40$. The classifier achieves a Recall of $0.75$ for Author X. How many stories by Author X were incorrectly classified as not being by Author X?

    Question 9
    Level 1: Warm-up

    A classifier predicts 40 samples as Positive and 60 as Negative. The actual number of Positive samples is 35. If the True Positives are 25, what is the number of False Positives?

    Question 10
    Level 1: Warm-up

    Which of the following statements is strictly true regarding the F1 score of a classifier?

    Free preview ends here

    Login to view the complete 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.

    Model Selection, Cross-validation and Performance Metrics Notes for GATE DA

    Model Selection, Cross-validation and Performance Metrics notes for GATE DA: 34 study cards covering concepts, formulas, shortcuts and exam traps, plus solved practice questions.

    Chapter Roadmap: Model Selection, Cross-Validation and Performance Metrics

    Chapter Roadmap

    Master the art of evaluating machine learning models. By the end of this chapter, you will know how to reliably estimate generalization error and choose the best performing model.

    1. Cross-Validation and Model Selection (Part 1)
    K-Fold, LOOCV, and the bias-variance tradeoff in evaluation. Weightage: Moderate
    2. Cross-Validation and Model Selection (Part 2)
    Stratified sampling and practical model selection pipelines. Weightage: High
    3. Classification Performance Metrics (Part 1)
    Confusion matrix, Precision, Recall, and Accuracy. Weightage: Moderate
    4. Classification Performance Metrics (Part 2)
    F1 Score, ROC curves, and Area Under the Curve (AUC). Weightage: High

    Cross-Validation and Model Selection

    SUPERVISED LEARNING > MODEL SELECTION Cross-Validation and Model Selection

    Why this matters:
    A single train-test split can give a misleading estimate of model performance due to random chance. Cross-validation systematically rotates the data, providing a robust, reliable measure of how your model will generalize to unseen data.

    What you will learn here:

    • The fundamental flaw of a single holdout set.
    • The mechanics of K-Fold and Leave-One-Out Cross-Validation.
    • The bias-variance tradeoff in choosing the number of folds, K.
    • How to avoid the critical trap of data leakage during preprocessing.

    The Need for Cross-Validation

    The Need for Cross-Validation

    When evaluating a model, the gold standard is to test it on data it has never seen during training. The simplest approach is a single train-test split (holdout method).

    However, a single split has a major flaw: high variance in the performance estimate. Depending on how the data is randomly shuffled, the test set might be unusually easy or unusually hard. This "luck of the draw" can lead to overestimating or underestimating the model's true generalization ability.

    The Solution: Cross-validation systematically rotates which data is used for training and which is used for validation. This ensures every data point contributes to both training and evaluation, yielding a much more stable and reliable error estimate.

    K-Fold Cross-Validation Mechanics

    K-Fold Cross-Validation Mechanics

    K-Fold Cross-Validation is the standard procedure for robust model evaluation. The algorithm proceeds as follows:

    1. Shuffle: Randomly shuffle the entire dataset to remove any inherent ordering.
    2. Split: Divide the dataset into equal-sized (or nearly equal-sized) subsets, called folds.
    3. Iterate: For to :
      • Use fold as the validation set.
      • Use the remaining folds as the training set.
      • Train the model and record the validation error .
    4. Average: The final cross-validation error estimate is the average of the errors:

    This guarantees that every single data point is used for validation exactly once, and for training exactly times.

    Model Selection, Cross-validation and Performance Metrics: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Machine Learning MCQ

    A classifier evaluates a dataset with 100 positive and 100 negative samples. It achieves a Precision of 0.8 and a Recall of 0.6. What is the minimum number of True Negatives?

    1. A.

      15

    2. B.

      40

    3. C.

      85

    4. D.

      115

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: This is a contradiction/resolution question where you must use the fixed definitions of Precision and Recall to find the exact confusion matrix cells.

    Step 1: Use Recall to find TP and FN. Recall = TP / (TP + FN) = TP / Actual Positives. Since Actual Positives = 100, . Thus, .

    Step 2: Use Precision to find FP. Precision = TP / (TP + FP). .

    Step 3: Calculate TN. TN = Actual Negatives - FP. Since Actual Negatives = 100, .

    Answer: 85

    Question 2 · Machine Learning MCQ

    Match the cross-validation method with the number of validation splits it generates on a training pool of size .

    P: Hold-out

    Q: -fold

    R: LOOCV

    1: $1$

    2:

    3:

    1. A.

      P-1, Q-2, R-3

    2. B.

      P-2, Q-1, R-3

    3. C.

      P-1, Q-3, R-2

    4. D.

      P-3, Q-2, R-1

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: Each validation method has a fixed rule for the number of splits it produces.

    Step 1: Hold-out splits data once into train and validation, yielding exactly $1$ split. (P matches 1)

    Step 2: $k$-fold cross-validation divides data into $k$ folds, yielding exactly $k$ splits. (Q matches 2)

    Step 3: LOOCV uses each of the $N_{train}$ samples as a validation set once, yielding $N_{train}$ splits. (R matches 3)

    Answer: P-1, Q-2, R-3

    Question 3 · Machine Learning MCQ

    A machine learning practitioner uses Leave-One-Out Cross-Validation (LOOCV) on a training pool and obtains exactly 450 validation splits. If 50 samples were strictly held out as a final test set, what is the total number of samples in the original dataset?

    1. A.

      450

    2. B.

      500

    3. C.

      400

    4. D.

      50

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: LOOCV generates a number of splits equal to the size of the training pool (). The total dataset size is the sum of the training pool and the test set.

    Step 1: Identify from the LOOCV splits. Since splits = , we have .

    Step 2: Identify the test set size: .

    Step 3: Calculate total samples .

    Answer: 500

    Question 4 · Machine Learning MCQ

    Match the cross-validation scenario with the exact number of validation splits it generates.

    P: , , $5$-fold CV on the training pool.

    Q: , no separate test set, Leave-One-Out CV (LOOCV).

    R: , single hold-out validation split.

    1: $1$

    2: $5$

    3: $400$

    4: $500$

    1. A.

      P-2, Q-4, R-1

    2. B.

      P-3, Q-4, R-1

    3. C.

      P-2, Q-3, R-1

    4. D.

      P-4, Q-3, R-2

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: Each validation method has a fixed rule for the number of splits it produces, independent of (except LOOCV).

    Step 1: Scenario P uses $5$-fold CV. By definition, this generates exactly $5$ splits. (P matches 2)

    Step 2: Scenario Q uses LOOCV on with no test set. The training pool is $500$, so LOOCV generates $500$ splits. (Q matches 4)

    Step 3: Scenario R uses a single hold-out split. This always generates exactly $1$ split. (R matches 1)

    Answer: P-2, Q-4, R-1

    Question 5 · Machine Learning MCQ

    In a Leave-One-Out Cross-Validation (LOOCV) process on a training pool, the total number of sample-uses for training across all splits combined is $2450$. If the original dataset had $10$ samples strictly held out for testing, what is the total number of samples $N$ in the original dataset?

    1. A.

      49

    2. B.

      50

    3. C.

      60

    4. D.

      2460

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: In LOOCV, the number of splits equals , and each split trains on samples.

    Step 1: Let . The total sample-uses for training across all splits is .

    Step 2: Set up the equation: .

    Step 3: Solve for . We know , so . Thus, .

    Step 4: Calculate total samples .

    Answer: 60

    Question 6 · Machine Learning MCQ

    Which of the following statements correctly bounds the Precision of a classifier that predicts the positive class for every single sample in a dataset with actual positives and actual negatives?

    1. A.

      Precision is exactly $1.0$.

    2. B.

      Precision is exactly .

    3. C.

      Precision is exactly .

    4. D.

      Precision is bounded between $0.5$ and $1.0$.

    Correct Answer:

    C

    Step-by-Step Solution

    Key idea: Precision is the ratio of True Positives to all Predicted Positives.

    Step 1: If the model predicts Positive for every sample, then Predicted Positives = .

    Step 2: The True Positives (TP) will be exactly the actual positives, so TP = .

    Step 3: Precision = TP / (TP + FP) = .

    Answer: Precision is exactly .

    Question 7 · Machine Learning MCQ

    Assertion (A): The F1 score of a classifier is exactly $0.5$ if its Precision is $1.0$ and its Recall is $0.0$.

    Reason (R): The F1 score is calculated as the arithmetic mean of Precision and Recall.

    Which of the following is correct?

    1. A.

      Both A and R are true, and R is the correct explanation of A.

    2. B.

      Both A and R are true, but R is NOT the correct explanation of A.

    3. C.

      A is true, but R is false.

    4. D.

      Both A and R are false.

    Correct Answer:

    D

    Step-by-Step Solution

    Key idea: The F1 score is the harmonic mean, not the arithmetic mean, of Precision and Recall.

    Step 1: Evaluate Assertion (A). The harmonic mean of 1.0 and 0.0 is 0.0, not 0.5. Thus, A is false.

    Step 2: Evaluate Reason (R). The F1 score uses the harmonic mean formula: . It is not the arithmetic mean. Thus, R is false.

    Answer: Both A and R are false.

    Question 8 · Machine Learning MCQ

    A classifier evaluates $100$ stories. The actual number of stories by Author X is $40$. The classifier achieves a Recall of $0.75$ for Author X. How many stories by Author X were incorrectly classified as not being by Author X?

    1. A.

      10

    2. B.

      30

    3. C.

      40

    4. D.

      75

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: Recall measures the proportion of actual positives that were correctly identified. The incorrectly classified actual positives are False Negatives.

    Step 1: Identify the total actual positives for Author X: .

    Step 2: Recall = TP / (TP + FN) = TP / = 0.75.

    Step 3: Calculate True Positives (TP): .

    Step 4: Calculate False Negatives (FN): Total actual positives - TP = .

    Answer: 10

    Question 9 · Machine Learning MCQ

    A classifier predicts 40 samples as Positive and 60 as Negative. The actual number of Positive samples is 35. If the True Positives are 25, what is the number of False Positives?

    1. A.

      5

    2. B.

      15

    3. C.

      25

    4. D.

      35

    Correct Answer:

    B

    Step-by-Step Solution

    Key idea: This is a casework confusion matrix question where you must isolate the predicted positive column to find False Positives.

    Step 1: Identify the total number of samples predicted as Positive. The problem states this is 40.

    Step 2: Recall that all samples predicted as Positive are either True Positives (TP) or False Positives (FP). Therefore, Predicted Positives = TP + FP.

    Step 3: Substitute the known values: .

    Step 4: Solve for FP: .

    Answer: 15

    Question 10 · Machine Learning MCQ

    Which of the following statements is strictly true regarding the F1 score of a classifier?

    1. A.

      The F1 score is bounded between 0.0 and 1.0, inclusive.

    2. B.

      The F1 score is always greater than or equal to the arithmetic mean of Precision and Recall.

    3. C.

      The F1 score can be 1.0 even if the Recall is 0.0.

    4. D.

      The F1 score is equal to the Accuracy when the dataset is perfectly balanced.

    Correct Answer:

    A

    Step-by-Step Solution

    Key idea: This is a bounding question testing the mathematical properties and constraints of the harmonic mean used in the F1 score.

    Step 1: Evaluate Option A. Precision and Recall are both bounded between 0.0 and 1.0. The harmonic mean of two numbers in is also strictly bounded in . This statement is true.

    Step 2: Evaluate Option B. The harmonic mean is always less than or equal to the arithmetic mean, not greater. This statement is false.

    Step 3: Evaluate Option C. If Recall is 0.0, the numerator of the F1 formula () becomes 0, making the F1 score exactly 0.0. This statement is false.

    Step 4: Evaluate Option D. The F1 score only equals Accuracy under very specific symmetric conditions, not universally just because the dataset is balanced. This statement is false.

    Answer: The F1 score is bounded between 0.0 and 1.0, inclusive.

    More notes in this unit