Bayes' Theorem

From CS Wiki

Bayes' theorem is a fundamental principle in probability theory and statistics, which describes how to update the probability of a hypothesis based on new evidence. It provides a mathematical framework for reasoning under uncertainty and is often used in machine learning, especially in algorithms like Naive Bayes.

The theorem is expressed as:

P(A | B) = (P(B | A) * P(A)) / P(B)

where:

  • P(A | B) is the posterior probability: the probability of event A occurring given that B is true.
  • P(B | A) is the likelihood: the probability of event B occurring given that A is true.
  • P(A) is the prior probability: the probability of event A occurring independently of B.
  • P(B) is the marginal probability: the total probability of event B occurring.

In the context of Naive Bayes, Bayes' theorem helps calculate the probability of each class given the observed data, allowing the algorithm to classify the data based on the highest probability class.