# Bayes’ Theorem Example for Classification and Prediction

**Bayes Theorem**

During 18th Century there was a mathematician named ‘Thomas Bayes’ in Britain. Bayes’ Theorem is named after this famous mathematician. Bayes’ Theorem is used to determine Conditional Probability. Mostly this theorem was used to check risk in finance evaluation. Basic equation for Bayes’ Theorem is:

Where: A can be Category or data and B can be Class or Category, then we can write like

`P(category|document)= (P(category).P(document|category)) / (P(document))`

Where

P(category|document) is the Probability that document belong to particular Category.

P(category) : is the Probability for Category that can be calculated by Number of docs in that category divide by total documents (In all category).

P(document|category) : is the