Machine Learning Project 14 — Naive Bayes Classifier — Step by Step
If you are like me and enjoy Mathematics, then you’ll definitely enjoy this article. Before getting into the Naive Bayes Classifier, let’s look at the Bayes Theorem.
#100DaysOfMLCode #100ProjectsInML
Bayes Theorem
To understand the Bayes theorem, let’s walk through a simple probability example.
Let’s say we have 2 factories Factory 1 and Factory 2 manufacturing laptops. The laptops are labelled so we know which laptop came from which factory.
During the testing phase, we find some defective laptops.
This is the information that is given to us.
- Factory 1 produces 30 laptops per hour.
- Factory 2 produces 20 laptops per hour.
- 1% of all laptops are defective.
- 50% of defective laptops came from Factory 1.
- 50% of defective laptops came from Factory 2.
What is the probability that a laptop manufactured by Factory 2 is defective?
A question like this can be answered using Bayes Theorem.