Examples
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 47
Use 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
from:www.mathworks.com