类 NaiveBayes
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.bayes.NaiveBayes
- 所有已实现的接口:
Serializable
,Cloneable
,CapabilitiesHandler
,OptionHandler
,RevisionHandler
,TechnicalInformationHandler
,WeightedInstancesHandler
- 直接已知子类:
NaiveBayesUpdateable
public class NaiveBayes
extends Classifier
implements OptionHandler, WeightedInstancesHandler, TechnicalInformationHandler
Class for a Naive Bayes classifier using estimator classes. Numeric estimator precision values are chosen based on analysis of the training data. For this reason, the classifier is not an UpdateableClassifier (which in typical usage are initialized with zero training instances) -- if you need the UpdateableClassifier functionality, use the NaiveBayesUpdateable classifier. The NaiveBayesUpdateable classifier will use a default precision of 0.1 for numeric attributes when buildClassifier is called with zero training instances.
For more information on Naive Bayes classifiers, see
George H. John, Pat Langley: Estimating Continuous Distributions in Bayesian Classifiers. In: Eleventh Conference on Uncertainty in Artificial Intelligence, San Mateo, 338-345, 1995. BibTeX:
For more information on Naive Bayes classifiers, see
George H. John, Pat Langley: Estimating Continuous Distributions in Bayesian Classifiers. In: Eleventh Conference on Uncertainty in Artificial Intelligence, San Mateo, 338-345, 1995. BibTeX:
@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)
- 版本:
- $Revision: 5516 $
- 作者:
- Len Trigg (trigg@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
buildClassifier
(Instances instances) Generates the classifier.Returns the tip text for this propertydouble[]
distributionForInstance
(Instance instance) Calculates the class membership probabilities for the given test instance.Returns default capabilities of the classifier.boolean
Get whether to display model output in the old, original format.String[]
Gets the current settings of the classifier.Returns the revision string.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
Gets if kernel estimator is being used.boolean
Get whether supervised discretization is to be used.Returns a string describing this classifierReturns an enumeration describing the available options.static void
Main method for testing this class.void
setDisplayModelInOldFormat
(boolean d) Set whether to display model output in the old, original format.void
setOptions
(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.toString()
Returns a description of the classifier.void
updateClassifier
(Instance instance) Updates the classifier with the given instance.Returns the tip text for this propertyReturns the tip text for this property从类继承的方法 weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
构造器详细资料
-
NaiveBayes
public NaiveBayes()
-
-
方法详细资料
-
globalInfo
Returns a string describing this classifier- 返回:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
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.- 指定者:
getTechnicalInformation
在接口中TechnicalInformationHandler
- 返回:
- the technical information about this class
-
getCapabilities
Returns default capabilities of the classifier.- 指定者:
getCapabilities
在接口中CapabilitiesHandler
- 覆盖:
getCapabilities
在类中Classifier
- 返回:
- the capabilities of this classifier
- 另请参阅:
-
buildClassifier
Generates the classifier.- 指定者:
buildClassifier
在类中Classifier
- 参数:
instances
- set of instances serving as training data- 抛出:
Exception
- if the classifier has not been generated successfully
-
updateClassifier
Updates the classifier with the given instance.- 参数:
instance
- the new training instance to include in the model- 抛出:
Exception
- if the instance could not be incorporated in the model.
-
distributionForInstance
Calculates the class membership probabilities for the given test instance.- 覆盖:
distributionForInstance
在类中Classifier
- 参数:
instance
- the instance to be classified- 返回:
- predicted class probability distribution
- 抛出:
Exception
- if there is a problem generating the prediction
-
listOptions
Returns an enumeration describing the available options.- 指定者:
listOptions
在接口中OptionHandler
- 覆盖:
listOptions
在类中Classifier
- 返回:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. 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)
- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中Classifier
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the classifier.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中Classifier
- 返回:
- an array of strings suitable for passing to setOptions
-
toString
Returns a description of the classifier. -
useKernelEstimatorTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUseKernelEstimator
public boolean getUseKernelEstimator()Gets if kernel estimator is being used.- 返回:
- Value of m_UseKernelEstimatory.
-
setUseKernelEstimator
public void setUseKernelEstimator(boolean v) Sets if kernel estimator is to be used.- 参数:
v
- Value to assign to m_UseKernelEstimatory.
-
useSupervisedDiscretizationTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUseSupervisedDiscretization
public boolean getUseSupervisedDiscretization()Get whether supervised discretization is to be used.- 返回:
- true if supervised discretization is to be used.
-
setUseSupervisedDiscretization
public void setUseSupervisedDiscretization(boolean newblah) Set whether supervised discretization is to be used.- 参数:
newblah
- true if supervised discretization is to be used.
-
displayModelInOldFormatTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setDisplayModelInOldFormat
public void setDisplayModelInOldFormat(boolean d) Set whether to display model output in the old, original format.- 参数:
d
- true if model ouput is to be shown in the old format
-
getDisplayModelInOldFormat
public boolean getDisplayModelInOldFormat()Get whether to display model output in the old, original format.- 返回:
- true if model ouput is to be shown in the old format
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 覆盖:
getRevision
在类中Classifier
- 返回:
- the revision
-
main
Main method for testing this class.- 参数:
argv
- the options
-