public class NaiveBayes extends Classifier implements OptionHandler, WeightedInstancesHandler, TechnicalInformationHandler
@inproceedings{John1995,
address = {San Mateo},
author = {George H. John and Pat Langley},
booktitle = {Eleventh Conference on Uncertainty in Artificial Intelligence},
pages = {338-345},
publisher = {Morgan Kaufmann},
title = {Estimating Continuous Distributions in Bayesian Classifiers},
year = {1995}
}
Valid options are:
-K Use kernel density estimator rather than normal distribution for numeric attributes
-D Use supervised discretization to process numeric attributes
-O Display model in old format (good when there are many classes)
| Constructor and Description |
|---|
NaiveBayes() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildClassifier(Instances instances)
Generates the classifier.
|
java.lang.String |
displayModelInOldFormatTipText()
Returns the tip text for this property
|
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given test
instance.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
boolean |
getDisplayModelInOldFormat()
Get whether to display model output in the old, original
format.
|
java.lang.String[] |
getOptions()
Gets the current settings of the classifier.
|
java.lang.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.
|
boolean |
getUseKernelEstimator()
Gets if kernel estimator is being used.
|
boolean |
getUseSupervisedDiscretization()
Get whether supervised discretization is to be used.
|
java.lang.String |
globalInfo()
Returns a string describing this classifier
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
void |
setDisplayModelInOldFormat(boolean d)
Set whether to display model output in the old, original
format.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setUseKernelEstimator(boolean v)
Sets if kernel estimator is to be used.
|
void |
setUseSupervisedDiscretization(boolean newblah)
Set whether supervised discretization is to be used.
|
java.lang.String |
toString()
Returns a description of the classifier.
|
void |
updateClassifier(Instance instance)
Updates the classifier with the given instance.
|
java.lang.String |
useKernelEstimatorTipText()
Returns the tip text for this property
|
java.lang.String |
useSupervisedDiscretizationTipText()
Returns the tip text for this property
|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebugpublic java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class ClassifierCapabilitiespublic void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier in class Classifierinstances - set of instances serving as training datajava.lang.Exception - if the classifier has not been generated
successfullypublic void updateClassifier(Instance instance) throws java.lang.Exception
instance - the new training instance to include in the modeljava.lang.Exception - if the instance could not be incorporated in
the model.public double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance in class Classifierinstance - the instance to be classifiedjava.lang.Exception - if there is a problem generating the predictionpublic java.util.Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class Classifierpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-K Use kernel density estimator rather than normal distribution for numeric attributes
-D Use supervised discretization to process numeric attributes
-O Display model in old format (good when there are many classes)
setOptions in interface OptionHandlersetOptions in class Classifieroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Classifierpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String useKernelEstimatorTipText()
public boolean getUseKernelEstimator()
public void setUseKernelEstimator(boolean v)
v - Value to assign to m_UseKernelEstimatory.public java.lang.String useSupervisedDiscretizationTipText()
public boolean getUseSupervisedDiscretization()
public void setUseSupervisedDiscretization(boolean newblah)
newblah - true if supervised discretization is to be used.public java.lang.String displayModelInOldFormatTipText()
public void setDisplayModelInOldFormat(boolean d)
d - true if model ouput is to be shown in the old formatpublic boolean getDisplayModelInOldFormat()
public java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Classifierpublic static void main(java.lang.String[] argv)
argv - the options