perClass Documentation
version 5.1 (31-May-2017)

Classifiers, table of contents

Chapter 13.5: Naive bayes classifier

This section describes naive Bayes density estimation and classification.

13.5.1. Introduction ↩

Naive Bayes classifier is implemented by the sdnbayes function. For each feature, it estimates a class-conditional distribution using a histogram. Assuming independence of features, the per-class output is computed as a product of per-feature class conditional densities.

By default, sdnbayes uses histograms with 20 bins:

>> a
3000 by 2 sddata, 3 classes: 'apple'(1000) 'banana'(1000) 'stone'(1000)     
>> p=sdnbayes(a)
sequential pipeline       2x1 'naive Bayes+Decision'
 1 naive Bayes             2x3 
 2 Decision                3x1  weighting, 3 classes
>> sdscatter(a,p)

The number of histogram bins may be fixed manually with the second parameter (or 'bins' option):

>> p=sdnbayes(a,50)
sequential pipeline       2x1 'naive Bayes+Decision'
 1 naive Bayes             2x3 
 2 Decision                3x1  weighting, 3 classes