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
- (A)
- (B)
- (C)
- (D)
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
ANSWER
The naïve Bayes classifier needs parameters (option B): 1 for the class prior and Bernoulli parameters for the attributes.
Official answer: BSource: Official answer key, GATE 2024 DA (IISc Bengaluru)
Naïve Bayes assumes the attributes are conditionally independent given the class, so the model is . Only these factors need to be estimated.
Class prior: takes 2 values and , so has free parameter.
Each attribute is binary, so for each class value the distribution is a Bernoulli distribution with one free parameter, . The value follows from it.
Conditional parameters: attributes 2 classes .
Total number of parameters: , which is option (B).
Without the independence assumption, the joint distribution of binary attributes would need free parameters per class, so in all. The naïve assumption therefore cuts the growth from exponential to linear in .
KEY IDEA
Conditional independence given the class turns the joint over attributes into separate one-parameter Bernoulli distributions per class. Count the free parameters: 1 for the prior, plus for the likelihoods.
WATCH OUT FOR
Counting the full joint table per class, which ignores the independence assumption. Another slip is counting both and , or both class priors, instead of only the free parameters.
From the GATE 2024 DA paper. Every question of this paper · Download the full paper · All 4 Logistic, k-NN, naive Bayes questions, with notes