Chapter 4
Naïve Bayes classifier
4.1 Introduction
The naïve Bayes classifier is one of the simplest approaches to the classification task that is still capable of providing reasonable accuracy. Whereas in many cases it cannot compete with much more refined algorithms, such as decision trees, it sometimes does not stay far behind, and it may be even superior for certain specific application domains, with text classification being the most prominent example. Its simplicity—conceptual, implementational, and computational—makes it easy and inexpensive to try besides or before more sophisticated classifiers.
4.2 Bayes rule
Bayesian inference, of which the naïve Bayes classifier is a particularly simple example, is based on the Bayes rule that relates conditional and marginal probabilities. More exactly, it shows how the conditional (posterior) probability of an event can be calculated based on its marginal (prior) probability and the inverse conditional probability. For two events and , the rule can be written as
where
- is the prior probability of ,
- is the ...
Get Data Mining Algorithms: Explained Using R now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.