| Naive Bayes Classifier |
Article Index for Naive |
Shopping Bayes |
Information AboutNaive Bayes Classifier |
| CATEGORIES ABOUT NAIVE BAYES CLASSIFIER | |
| classification algorithms | |
| bayesian statistics | |
|
Depending on the precise nature of the probability model, naive Bayes classifiers can be trained very efficiently in a Supervised Learning setting. In many practical applications, parameter estimation for naive Bayes models uses the method of Maximum Likelihood ; in other words, one can work with the naive Bayes model without believing in Bayesian Probability or using any Bayesian methods. In spite of their naive design and apparently over-simplified assumptions, naive Bayes classifiers often work much better in many complex real-world situations than one might expect. Recently, careful analysis of the Bayesian classification problem has shown that there are some theoretical reasons for the apparently unreasonable Efficacy of naive Bayes classifiers( Zhang04 ). An advantage of the Naive Bayes classifier is that it requires a small amount of training data to estimate the parameters (means and variances of the variables) necessary for classification. Because independent variables are assumed, only the variances of the variables for each class need to be determined and not the entire covariance matrix. THE NAIVE BAYES PROBABILISTIC MODEL Abstractly, the probability model for a classifier is a conditional model : over a dependent class variable with a small number of outcomes or ''classes'', conditional on several feature variables through . The problem is that if the number of features is large or when a feature can take on a large number of values, then basing such a model on probability tables is infeasible. We therefore reformulate the model to make it more tractable. Using Bayes' Theorem , we write : In plain English the above equation can be written as : In practice we are only interested in the numerator of that fraction, since the denominator does not depend on and the values of the features are given, so that the denominator is effectively constant. The numerator is equivalent to the Joint Probability model : which can be rewritten as follows, using repeated applications of the definition of Conditional Probability : : :: :: :: :: and so forth. Now the "naive" of every other feature for . This means that : and so the joint model can be expressed as : : This means that under the above independence assumptions, the conditional distribution over the class variable can be expressed like this: : where is a scaling factor dependent only on , i.e., a constant if the values of the feature variables are known. Models of this form are much more manageable, since they factor into a so-called ''class prior'' and independent probability distributions . If there are classes and if a model for can be expressed in terms of parameters, then the corresponding naive Bayes model has (''k'' − 1) + ''n'' ''r'' ''k'' parameters. In practice, often (binary classification) and ( Bernoulli Variables as features) are common, and so the total number of parameters of the naive Bayes model is , where is the number of binary features used for prediction. PARAMETER ESTIMATION All model parameters (''i.e.'', class priors and feature probability distributions) can be approximated with relative frequencies from the training set. These are maximum likelihood estimates of the probabilities. Non-discrete features need to be Discretized first. Discretization can be Unsupervised (ad-hoc selection of bins) or Supervised (binning guided by information in training data). If a given class and feature value never occur together in the training set then the frequency-based probability estimate will be zero. This is problematic since it will wipe out all information in the other probabilities when they are multiplied. It is therefore often desirable to incorporate a small-sample correction in all probability estimates such that No Probability Is Ever Set To Be Exactly Zero . CONSTRUCTING A CLASSIFIER FROM THE PROBABILITY MODEL The discussion so far has derived the independent feature model, that is, the naive Bayes Probability Model . The naive Bayes Classifier combines this model with a Decision Rule . One common rule is to pick the hypothesis that is most probable; this is known as the '' Maximum A Posteriori '' or ''MAP'' decision rule. The corresponding classifier is the function defined as follows: : DISCUSSION One should notice that the independency assumption may lead to some unexpected results in the calculation of posteriori probability. In some circumstances when there is a dependency between observations, the above-mentioned probability may contradict with the second axiom of probability by which any probability must be less than or equal to one. Despite the fact that the far-reaching independence assumptions are often inaccurate, the naive Bayes classifier has several properties that make it surprisingly useful in practice. In particular, the decoupling of the class conditional feature distributions means that each distribution can be independently estimated as a one dimensional distribution. This in turn helps to alleviate problems stemming from the Curse Of Dimensionality , such as the need for data sets that scale exponentially with the number of features. Like all probabilistic classifiers under the MAP decision rule, it arrives at the correct classification as long as the correct class is more probable than any other class; hence class probabilities do not have to be estimated very well. In other words, the overall classifier is robust enough to ignore serious deficiencies in its underlying naive probability model. Other reasons for the observed success of the naive Bayes classifier are discussed in the literature cited below. EXAMPLE: DOCUMENT CLASSIFICATION Here is a worked example of naive Bayesian classification to the Document Classification problem. Consider the problem of classifying documents by their content, for example into Spam and non-spam E-mail s. Imagine that documents are drawn from a number of classes of documents which can be modelled as sets of words where the (independent) probability that the i-th word of a given document occurs in a document from class ''C'' can be written as : (For this treatment, we simplify things further by assuming that the probability of a word in a document is independent of the length of a document, or that all documents are of the same length.) Then the probability of a given document ''D'', given a class ''C'', is : The question that we desire to answer is: "what is the probability that a given document ''D'' belongs to a given class ''C''?" In other words, what is ? Now, by their definition, (see Probability Axiom ) : and : Bayes' theorem manipulates these into a statement of probability in terms of Likelihood . : Assume for the moment that there are only two classes, ''S'' and ¬''S'' (e.g. spam and not spam). : and : Using the Bayesian result above, we can write: : : Dividing one by the other gives: : Which can be re-factored as: : | ||
|   | The Actual Probability P(''S'' ''D'') Can Be Easily Computed From Log (p(''S'' ''D'') / P(&not''S'' ''D'')) Based On The Observation That P(''S'' ''D'') + P(&not''S'' ''D'') | 1 |
|
|