public class NaiveBayesSimple extends Classifier implements TechnicalInformationHandler
@book{Duda1973, address = {New York}, author = {Richard Duda and Peter Hart}, publisher = {Wiley}, title = {Pattern Classification and Scene Analysis}, year = {1973} }Valid options are:
-D If set, classifier is run in debug mode and may output additional info to the console
Modifier and Type | Field and Description |
---|---|
protected double[][][] |
m_Counts
All the counts for nominal attributes.
|
protected double[][] |
m_Devs
The standard deviations for numeric attributes.
|
protected Instances |
m_Instances
The instances used for training.
|
protected double[][] |
m_Means
The means for numeric attributes.
|
protected double[] |
m_Priors
The prior probabilities of the classes.
|
protected static double |
NORM_CONST
Constant for normal distribution.
|
m_Debug
Constructor and Description |
---|
NaiveBayesSimple() |
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances instances)
Generates the classifier.
|
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given test instance.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
String |
globalInfo()
Returns a string describing this classifier
|
static void |
main(String[] argv)
Main method for testing this class.
|
protected double |
normalDens(double x,
double mean,
double stdDev)
Density function of normal distribution.
|
String |
toString()
Returns a description of the classifier.
|
classifyInstance, debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, makeCopy, runClassifier, setDebug, setOptions
protected double[][][] m_Counts
protected double[][] m_Means
protected double[][] m_Devs
protected double[] m_Priors
protected Instances m_Instances
protected static double NORM_CONST
public String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public void buildClassifier(Instances instances) throws Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training dataException
- if the classifier has not been generated successfullypublic double[] distributionForInstance(Instance instance) throws Exception
distributionForInstance
in class Classifier
instance
- the instance to be classifiedException
- if distribution can't be computedpublic String toString()
protected double normalDens(double x, double mean, double stdDev)
x
- the value to get the density formean
- the meanstdDev
- the standard deviationpublic String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class Classifier
public static void main(String[] argv)
argv
- the optionsCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.