| Contents | Index |
Naive Bayes classifier
A NaiveBayes object defines a Naive Bayes classifier. A Naive Bayes classifier assigns a new observation to the most probable class, assuming the features are conditionally independent given the class value.
| NaiveBayes | Create NaiveBayes object |
| disp | Display NaiveBayes classifier object |
| display | Display NaiveBayes classifier object |
| fit | Create Naive Bayes classifier object by fitting training data |
| posterior | Compute posterior probability of each class for test data |
| predict | Predict class label for test data |
| subsasgn | Subscripted reference for NaiveBayes object |
| subsref | Subscripted reference for NaiveBayes object |
| CIsNonEmpty | Flag for non-empty classes |
| CLevels | Class levels |
| CNames | Class names |
| CPrior | Class priors |
| Dist | Distribution names |
| NClasses | Number of classes |
| NDims | Number of dimensions |
| Params | Parameter estimates |
Value. To learn how this affects your use of the class, see Comparing Handle and Value Classes in the MATLAB Object-Oriented Programming documentation.
Predict the class label using the Naive Bayes classifier
load fisheriris
Use the default Gaussian distribution and a confusion matrix:
O1 = NaiveBayes.fit(meas,species); C1 = O1.predict(meas); cMat1 = confusionmat(species,C1)
This returns:
cMat1 =
50 0 0
0 47 3
0 3 47Use the Gaussian distribution for features 1 and 3 and use the kernel density estimation for features 2 and 4:
O2 = NaiveBayes.fit(meas,species,'dist',...
{'normal','kernel','normal','kernel'});
C2 = O2.predict(meas);
cMat2 = confusionmat(species,C2)This returns:
cMat2 =
50 0 0
0 47 3
0 3 47[1] Mitchell, T. (1997) Machine Learning, McGraw Hill.
[2] Vangelis M., Ion A., and Geogios P. Spam Filtering with Naive Bayes - Which Naive Bayes? (2006) Third Conference on Email and Anti-Spam.
[3] George H. John and Pat Langley. Estimating continuous distributions in bayesian classifiers (1995) the Eleventh Conference on Uncertainty in Artificial Intelligence.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |