chapter

    Decision Trees, Naive Bayes and K-nearest Neighbors Pyqs for Gate Da

    Solve 3+ Decision Trees, Naive Bayes and K-nearest Neighbors previous year questions for GATE DA with answers and detailed solutions. Free sample questions be

    Try a question

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

    Question 1
    2024 PYQ
    Level 3: Exam Standard
    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 ) or pace-friendly (represented as ). The
    attribute Format can take one of two values: one-day match (represented as ) or
    test match (represented as .
    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).

    Match NumberPitchFormatWinner (Target)
    1Green
    2Blue
    3Blue
    4Blue
    5Green
    6Blue
    7Green
    8Blue
    9Blue
    10Green
    Question 2
    2024 PYQ
    Level 3: Exam Standard
    Given a dataset with binary-valued attributes (where ) for a two-class
    classification task, the number of parameters to be estimated for learning a naïve
    Bayes classifier is
    Question 3
    2024 PYQ
    Level 3: Exam Standard
    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 in -nearest neighbor
    algorithm for which the diamond (⋄) shaped data point is assigned the label square
    is ______.
    12341234
    Free preview ends here

    Login to view the complete previous-year questions and solutions

    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.

    Decision Trees, Naive Bayes and K-nearest Neighbors PYQs for GATE DA

    Solve 3+ Decision Trees, Naive Bayes and K-nearest Neighbors previous year questions for GATE DA with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Decision Trees, Naive Bayes and k-NN

    Chapter Roadmap

    Decision Trees, Naive Bayes & k-NN

    01 | k-Nearest Neighbors
    Instance-based, lazy learning. Distance metrics, choosing k, decision boundaries.
    02 | Naive Bayes
    Generative, probability-based. Conditional independence, priors, likelihoods.
    03 | Decision Trees
    Eager, rule-based. Attribute splits, impurity measures, pruning.
    What you will master: How each classifier predicts, solving numerical problems step-by-step, and comparing methods by cost and assumptions.

    k-Nearest Neighbors Classification

    k-Nearest Neighbors

    "A point is classified by the company it keeps."

    What you will learn
    • Why k-NN is an instance-based and lazy learner.
    • How to use distance metrics to find nearest points.
    • How the choice of k changes the decision boundary.
    • How to solve small numerical prediction problems safely.
    • Common traps: ties, even k, and high-dimensional data.
    Context: The simplest non-parametric classifier in this chapter, showing a purely distance-driven way of thinking.

    Decision Trees, Naive Bayes and K-nearest Neighbors: Solved Questions with Step-by-Step Explanations (3 Problems)

    Question 1 · Machine Learning · 2024 NAT
    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 ) or pace-friendly (represented as ). The
    attribute Format can take one of two values: one-day match (represented as ) or
    test match (represented as .
    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).

    Match NumberPitchFormatWinner (Target)
    1Green
    2Blue
    3Blue
    4Blue
    5Green
    6Blue
    7Green
    8Blue
    9Blue
    10Green
    Correct Answer:

    0.12

    Step-by-Step Solution

    Insight: Information Gain is the parent entropy minus the weighted average entropy of the children. We must carefully count the class distributions for the parent and the specific split (Pitch).

    Exam route: Count total Green (4) and Blue (6). Calculate parent entropy. Count Green/Blue for Pitch=S (3G, 2B) and Pitch=F (1G, 4B). Calculate child entropies, weight them by 0.5 each, and subtract from parent entropy.

    Learning route:

    Step 1: Analyze the parent dataset. Total instances .

    Green wins: Matches 1, 5, 7, 10 4 instances.

    Blue wins: Matches 2, 3, 4, 6, 8, 9 6 instances.

    Parent Entropy .

    Step 2: Analyze the split on "Pitch".

    • Pitch = S: Matches 1, 2, 4, 7, 10 (5 instances). Green = 3, Blue = 2.

    .

    • Pitch = F: Matches 3, 5, 6, 8, 9 (5 instances). Green = 1, Blue = 4.

    .

    Step 3: Calculate the weighted average entropy of the children.

    .

    Step 4: Calculate Information Gain.

    .

    Step 5: Round to two decimal places as required. The result is 0.12.

    Answer: 0.12

    Question 2 · Machine Learning · 2024 MCQ
    Given a dataset with binary-valued attributes (where ) for a two-class
    classification task, the number of parameters to be estimated for learning a naïve
    Bayes classifier is
    1. A.

    2. B.

    3. C.

    4. D.

    Correct Answer:

    B

    Step-by-Step Solution

    Insight: The number of independent parameters in Naive Bayes is the sum of independent prior probabilities and independent conditional probabilities, leveraging the fact that probabilities for a given variable must sum to 1.

    Exam route: For 2 classes, priors need parameter. For binary attributes, each needs parameter per class. Total conditionals = . Total = .

    Learning route:

    Step 1: Prior Probabilities. There are classes. Since , we only need to estimate independent parameter (e.g., ).

    Step 2: Conditional Probabilities. There are binary-valued attributes. For each attribute , and for each of the 2 classes, we need to estimate . The probability is simply . Thus, each attribute requires independent parameter per class.

    Step 3: Total conditional parameters = .

    Step 4: Total parameters to estimate = .

    Answer: B

    Question 3 · Machine Learning · 2024 NAT
    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 in -nearest neighbor
    algorithm for which the diamond (⋄) shaped data point is assigned the label square
    is ______.
    12341234
    Correct Answer:

    5.00

    Step-by-Step Solution

    Insight: The minimum odd is found by sorting the squared Euclidean distances from the query point to all training points and finding the smallest odd where the majority class among the nearest neighbors is the target class.

    Exam route: Identify coordinates from the SVG. Query is at (2, 1). Calculate squared distances to all 5 points. Sort them. Count classes cumulatively for odd until "Square" wins.

    Learning route:

    Step 1: Extract coordinates from the SVG grid.

    Circles are at (1, 1) and (1, 2).

    Squares are at (2, 3), (3, 4), and (4, 3).

    The query Diamond is at (2, 1).

    Step 2: Calculate squared Euclidean distances from the query (2, 1) to each point:

    • To Circle (1, 1):
    • To Circle (1, 2):
    • To Square (2, 3):
    • To Square (4, 3):
    • To Square (3, 4):

    Step 3: Sort the neighbors by ascending distance:

    1st: Circle (dist = 1)

    2nd: Circle (dist = 2)

    3rd: Square (dist = 4)

    4th: Square (dist = 8)

    5th: Square (dist = 10)

    Step 4: Evaluate the majority class for odd values of :

    • For : 1 Circle, 0 Squares Label is Circle.
    • For : 2 Circles, 1 Square Label is Circle.
    • For : 2 Circles, 3 Squares Label is Square.

    Step 5: The minimum odd value of for which the label is Square is 5.

    Answer: 5.00

    More previous year questions (pyqs) in this unit