How Naive Bayes Classifier works?
How Naive Bayes Classifier works? Data Science Project
Classification in Depth with Scikit-Learn

How Naive Bayes Classifier works?

This project focuses on learning about Bayes' theorem and its application in the Naive Bayes Classifier, which is a popular machine learning model. The project will likely involve understanding the basic principles of the theorem, as well as implementing and training a Naive Bayes Classifier on a simple dataset to gain practical experience.

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

Bayes' theorem

Suppose we have a box of 20 marbles, 5 of which are red and 15 of which are blue. We randomly pick a marble from the box without looking, and we want to calculate the probability that the marble is red, given that it is round. Let's say we know that 3 out of the 5 red marbles are round, and 8 out of the 15 blue marbles are round.

# Prior probability of the marble being red
p_red = 0.25

# Likelihood probability of the marble being round given it is red
p_round_given_red = 0.6

# Likelihood probability of the marble being round given it is blue
p_round_given_blue = 8 / 15

Let's use Bayes' theorem to calculate the probability of the marble being red given that it is round. Store the result in p_red_given_round.

codevalidated

Performance evalution

Let's evaluate the performance of the classifier by comparing its predictions to the true labels of the testing data.

Store the accuracy in accuracy_test

multiplechoice

Naïve Bayes assumes that the features are independent of each other given the class label. True or False?

multiplechoice

Naïve Bayes can handle missing data by ignoring the missing values. True or False?

multiplechoice

Naïve Bayes is a type of unsupervised learning algorithm. True or False?

How Naive Bayes Classifier works?How Naive Bayes Classifier works?
Author

Verónica Barraza

This project is part of

Classification in Depth with Scikit-Learn

Explore other projects