[chinese][all] If we assume that the features of the given dataset are independent, then we can perform PDF modeling on each dimension sequentially. The final PDF for each class is then given by the multiplication of the PDF of the same class over each dimension. In symbols, we assume that where

X= [X_{1}, X_{2}, ..., X_{d}] is a feature vector and C is a class. Despite the assumption seems too strong for real-world data, the resulting naive Bayes classifier (NBC for short) is highly successful in many practical applications.p( X|C) = P(X_{1}|C)P(X_{2}|C) ... P(X_{d}|C)where

X= [X_{1}, X_{2}, ..., X_{d}] is a feature vector and C is a class. Despite the assumption seems too strong for real-world data, the resulting naive Bayes classifier (NBC for short) is highly successful in many practical applications.In practice, we can apply 1D Gaussian functions for modeling the data of a specific class and a specific dimension. The training of a NBC can be summarized as follows:

- Assume that data in class
iand dimensionjis governed by a 1-dimensional Gaussian PDF:g(x, m where m_{i}, s_{i}^{2}) = [(2p)*s_{i}^{2}]^{-0.5}*exp[-(x-m_{i})^{2})/(2s_{i}^{2})]_{i}is the mean value and s_{i}^{2}is the variance of the PDF. Given the dimension-j training data {x_{1}, x_{2}, ... x_{n}} in class i, the optimum parameters in the sense of maximum likelihood can be expressed as follows:m _{i}= (x_{1}+x_{2}+...+x_{n})/ns _{i}^{2}= [ (x_{1}-m_{i})^{2}+ (x_{2}-m_{i})^{2}+ ... + (x_{n}-m_{i})^{2}] /(n-1)- Since the Gaussian PDF does not reflect the prior probability of class i (denoted by p(c
_{i})), we usually use p(c_{i})g(x,m_{i}, S_{i}) to represent the probability density of a given vectorx. In practice, p(c_{i}) is computed as the number of entries of class i divided by the number of total entries in the training set.- In application, for a given vector
xof unknown class, the higher the probability density p(c_{i})g(x,m_{i}, S_{i}) is, the more likelihood that this vector belongs to class i.When implementing the classifier, usually we do not calculate p(c

_{i})g(x,m_{i}, S_{i}) directly since the exponential function is likely to introduce round-off errors. Instead, we compute the natural logarithm of the probability density, as follows:log[p(c The decision boundary between class_{i})g(x,m_{i}, S_{i})] = log(p(c_{i})) - (d*log(2p) + log|S_{i}|)/2 - (x-m_{i})^{T}S_{i}^{-1}(x-m_{i})/2iandjis represented by the following trajectory:p(c Taking the logrithm of both sides, we have_{i})g(x,m_{i}, S_{i}) = p(c_{j})g(x,m_{j}, S_{j}).log(p(c After simplification, we have the decision boundary as the following equation:_{i})) - (d*log(2p) + log|S_{i}|)/2 - (x-m_{i})^{T}S_{i}^{-1}(x-m_{i})/2 = log(p(c_{j})) - (d*log(2p) + log|S|_{j})/2 - (x-m_{j})^{T}S_{j}^{-1}(x-m_{j})/2( where the right-hand side is a constant. Since both (x-m_{j})^{T}S_{j}^{-1}(x-m_{j}) - (x-m_{i})^{T}S_{i}^{-1}(x-m_{i}) = log{[|S|_{i}p^{2}(c_{i})]/[|S|_{j}p^{2}(c_{j})]}x-m_{j})^{T}S_{j}^{-1}(x-m_{j}) and (x-m_{i})^{T}S_{i}^{-1}(x-m_{i}) are quadratic, the above equation represents a decision boundary of the quadratic form in the d-dimensional feature space.In the following example, we shall use dimensions 3 and 4 of the Iris dataset for NBC:

In the above example, each misclassified data point is labeled with a cross. Moreover, we use the number of entries of each class as the class prior probability for computing the probability density. In general, there are two ways to specify class prior probabilities:

- Use the number of entries in each class as the prior probabilities. You can divide the total number of entries in the training set to have a real probability between 0 and 1. In practice, the division does not change the classification results since it is applied to every class' PDF. (You can use the function dsClassSize.m to find the number of entries in each class.)
- If we have the domain knowledge of the prior probabilities, we can assign them directly.
We can plot the 1d PDFs for all classes and dimensions, together with the corresponding data points, as follows:

For the above example, we can go one step further to plot the class-specific PDFs as 3D surfaces and display the corresponding contours, as follows:

Based on the computed PDF for each class, we can plot the decision boundaries, as follows:

Data Clustering and Pattern Recognition (ƤsP˦{)