1. Home
  2. Explore
  3. Computer Science
  4. Naive Bayes ML Lecture

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Naive Bayes ML Lecture

  • 16Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Parameter Estimation
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What are the two main philosophies for estimating parameters in probabilistic models?

Tap to flipClick to flipspace

Maximum Likelihood Estimation (MLE) and Maximum a Posteriori (MAP) estimation.

Or swipe the card

16 cards

  1. What are the two main philosophies for estimating parameters in probabilistic models?

    Maximum Likelihood Estimation (MLE) and Maximum a Posteriori (MAP) estimation.

  2. How does MLE differ from MAP in terms of the objective function?

    MLE maximizes the log-likelihood: arg⁡max⁡θlog⁡P(data∣θ)\arg\max_\theta \log P(\text{data} | \theta)argmaxθ​logP(data∣θ). MAP adds a prior term: arg⁡max⁡θ[log⁡P(data∣θ)+log⁡P(θ)]\arg\max_\theta [\log P(\text{data} | \theta) + \log P(\theta)]argmaxθ​[logP(data∣θ)+logP(θ)].

  3. What is the Laplace prior and why is it used for Bernoulli parameter estimation?

    The Laplace prior is a Beta(2,2) distribution, which corresponds to one imaginary success and one imaginary failure before seeing data. It prevents probabilities of 0 or 1.

  4. In the classification problem, what do XXX and YYY represent?

    XXX is a vector of input features (e.g., binary indicators for movies or words). YYY is the class label (e.g., 0 or 1) to be predicted.

  5. What is the notation for the jjj-th feature of the iii-th training example?

    Xj(i)X_{j}^{(i)}Xj(i)​ where superscript iii indexes the example and subscript jjj indexes the feature.

  6. What is the brute-force Bayes classifier's decision rule for a binary output?

    Predict y^=arg⁡max⁡y∈{0,1}P(y∣X)=arg⁡max⁡yP(X∣y)P(y)\hat{y} = \arg\max_{y \in \{0,1\}} P(y | X) = \arg\max_{y} P(X | y) P(y)y^​=argmaxy∈{0,1}​P(y∣X)=argmaxy​P(X∣y)P(y) after dropping the denominator P(X)P(X)P(X).

  7. Why does brute-force Bayes become impractical with many binary features?

    The number of parameters grows exponentially as O(2m)O(2^m)O(2m) where mmm is the number of features, because we need a probability for each combination of feature values given YYY.

  8. What is the naive Bayes assumption?

    The features are conditionally independent given the class label YYY: P(X1,X2,…,Xm∣Y)=∏i=1mP(Xi∣Y)P(X_1, X_2, \dots, X_m | Y) = \prod_{i=1}^m P(X_i | Y)P(X1​,X2​,…,Xm​∣Y)=∏i=1m​P(Xi​∣Y).

  9. Write the naive Bayes classifier's prediction formula for a binary output.

    y^=arg⁡max⁡y∈{0,1}P(y)∏i=1mP(Xi∣y)\hat{y} = \arg\max_{y \in \{0,1\}} P(y) \prod_{i=1}^{m} P(X_i | y)y^​=argmaxy∈{0,1}​P(y)∏i=1m​P(Xi​∣y)

  10. How are the parameters P(Y=y)P(Y=y)P(Y=y) and P(Xi=1∣Y=y)P(X_i=1 | Y=y)P(Xi​=1∣Y=y) estimated using MLE?

    P(Y=y)=count(Y=y)total examplesP(Y=y) = \frac{\text{count}(Y=y)}{\text{total examples}}P(Y=y)=total examplescount(Y=y)​ and P(Xi=1∣Y=y)=count(Xi=1 and Y=y)count(Y=y)P(X_i=1 | Y=y) = \frac{\text{count}(X_i=1 \text{ and } Y=y)}{\text{count}(Y=y)}P(Xi​=1∣Y=y)=count(Y=y)count(Xi​=1 and Y=y)​.

  11. How does MAP with Laplace smoothing modify the MLE estimates for P(Xi=1∣Y=y)P(X_i=1|Y=y)P(Xi​=1∣Y=y)?

    P(Xi=1∣Y=y)=count(Xi=1 and Y=y)+1count(Y=y)+2P(X_i=1|Y=y) = \frac{\text{count}(X_i=1 \text{ and } Y=y) + 1}{\text{count}(Y=y) + 2}P(Xi​=1∣Y=y)=count(Y=y)+2count(Xi​=1 and Y=y)+1​

  12. Why is Laplace smoothing important in naive Bayes?

    It prevents zero probabilities for any feature-class combination, which would otherwise make the entire product zero and destroy the prediction.

  13. Why are log-probabilities often used in naive Bayes implementations?

    To avoid numerical underflow when multiplying many small probabilities, which can be represented as sums of log-probabilities.

  14. What is a test set and why is it used in classification?

    A test set is a set of labeled examples held out from training, used to evaluate the classifier's performance on unseen data.

  15. Define accuracy, precision, and recall in the context of binary classification.

    • Accuracy: correct predictionstotal predictions\frac{\text{correct predictions}}{\text{total predictions}}total predictionscorrect predictions​
    • Precision: true positivestrue positives+false positives\frac{\text{true positives}}{\text{true positives} + \text{false positives}}true positives+false positivestrue positives​
    • Recall: true positivestrue positives+false negatives\frac{\text{true positives}}{\text{true positives} + \text{false negatives}}true positives+false negativestrue positives​
  16. How was naive Bayes applied to spam classification?

    Features XiX_iXi​ indicate whether a specific word (from a large vocabulary) appears in the email. The class YYY is spam (1) or not spam (0). The naive Bayes assumption makes training feasible despite tens of thousands of features.

Card 1 of 16
Card 1 of 16

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent