Package weka.classifiers.bayes
Class AODE
- java.lang.Object
-
- weka.classifiers.Classifier
-
- weka.classifiers.bayes.AODE
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,UpdateableClassifier,CapabilitiesHandler,OptionHandler,RevisionHandler,TechnicalInformationHandler,WeightedInstancesHandler
public class AODE extends Classifier implements OptionHandler, WeightedInstancesHandler, UpdateableClassifier, TechnicalInformationHandler
AODE achieves highly accurate classification by averaging over all of a small space of alternative naive-Bayes-like models that have weaker (and hence less detrimental) independence assumptions than naive Bayes. The resulting algorithm is computationally efficient while delivering highly accurate classification on many learning tasks.
For more information, see
G. Webb, J. Boughton, Z. Wang (2005). Not So Naive Bayes: Aggregating One-Dependence Estimators. Machine Learning. 58(1):5-24.
Further papers are available at
http://www.csse.monash.edu.au/~webb/.
Can use an m-estimate for smoothing base probability estimates in place of the Laplace correction (via option -M).
Default frequency limit set to 1. BibTeX:@article{Webb2005, author = {G. Webb and J. Boughton and Z. Wang}, journal = {Machine Learning}, number = {1}, pages = {5-24}, title = {Not So Naive Bayes: Aggregating One-Dependence Estimators}, volume = {58}, year = {2005} }Valid options are:-D Output debugging information
-F <int> Impose a frequency limit for superParents (default is 1)
-M Use m-estimate instead of laplace correction
-W <int> Specify a weight to use with m-estimate (default is 1)
- Version:
- $Revision: 5516 $
- Author:
- Janice Boughton (jrbought@csse.monash.edu.au), Zhihai Wang (zhw@csse.monash.edu.au)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AODE()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(Instances instances)Generates the classifier.double[]distributionForInstance(Instance instance)Calculates the class membership probabilities for the given test instance.java.lang.StringfrequencyLimitTipText()Returns the tip text for this propertyCapabilitiesgetCapabilities()Returns default capabilities of the classifier.intgetFrequencyLimit()Gets the frequency limit.java.lang.String[]getOptions()Gets the current settings of the classifier.java.lang.StringgetRevision()Returns the revision string.TechnicalInformationgetTechnicalInformation()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.booleangetUseMEstimates()Gets if m-estimaces is being used.intgetWeight()Gets the weight used in m-estimatejava.lang.StringglobalInfo()Returns a string describing this classifierjava.util.EnumerationlistOptions()Returns an enumeration describing the available optionsstatic voidmain(java.lang.String[] argv)Main method for testing this class.doubleNBconditionalProb(Instance instance, int classVal)Calculates the probability of the specified class for the given test instance, using naive Bayes.voidsetFrequencyLimit(int f)Sets the frequency limitvoidsetOptions(java.lang.String[] options)Parses a given list of options.voidsetUseMEstimates(boolean value)Sets if m-estimates is to be used.voidsetWeight(int w)Sets the weight for m-estimatejava.lang.StringtoString()Returns a description of the classifier.voidupdateClassifier(Instance instance)Updates the classifier with the given instance.java.lang.StringuseMEstimatesTipText()Returns the tip text for this propertyjava.lang.StringweightTipText()Returns the tip text for this property-
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
-
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing this classifier- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
public 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.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classClassifier- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(Instances instances) throws java.lang.Exception
Generates the classifier.- Specified by:
buildClassifierin classClassifier- Parameters:
instances- set of instances serving as training data- Throws:
java.lang.Exception- if the classifier has not been generated successfully
-
updateClassifier
public void updateClassifier(Instance instance)
Updates the classifier with the given instance.- Specified by:
updateClassifierin interfaceUpdateableClassifier- Parameters:
instance- the new training instance to include in the model
-
distributionForInstance
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
Calculates the class membership probabilities for the given test instance.- Overrides:
distributionForInstancein classClassifier- Parameters:
instance- the instance to be classified- Returns:
- predicted class probability distribution
- Throws:
java.lang.Exception- if there is a problem generating the prediction
-
NBconditionalProb
public double NBconditionalProb(Instance instance, int classVal)
Calculates the probability of the specified class for the given test instance, using naive Bayes.- Parameters:
instance- the instance to be classifiedclassVal- the class for which to calculate the probability- Returns:
- predicted class probability
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClassifier- Returns:
- an enumeration of all the available options
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-D Output debugging information
-F <int> Impose a frequency limit for superParents (default is 1)
-M Use m-estimate instead of laplace correction
-W <int> Specify a weight to use with m-estimate (default is 1)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClassifier- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classClassifier- Returns:
- an array of strings suitable for passing to setOptions
-
weightTipText
public java.lang.String weightTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setWeight
public void setWeight(int w)
Sets the weight for m-estimate- Parameters:
w- the weight
-
getWeight
public int getWeight()
Gets the weight used in m-estimate- Returns:
- the frequency limit
-
useMEstimatesTipText
public java.lang.String useMEstimatesTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getUseMEstimates
public boolean getUseMEstimates()
Gets if m-estimaces is being used.- Returns:
- Value of m_MEstimates.
-
setUseMEstimates
public void setUseMEstimates(boolean value)
Sets if m-estimates is to be used.- Parameters:
value- Value to assign to m_MEstimates.
-
frequencyLimitTipText
public java.lang.String frequencyLimitTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setFrequencyLimit
public void setFrequencyLimit(int f)
Sets the frequency limit- Parameters:
f- the frequency limit
-
getFrequencyLimit
public int getFrequencyLimit()
Gets the frequency limit.- Returns:
- the frequency limit
-
toString
public java.lang.String toString()
Returns a description of the classifier.- Overrides:
toStringin classjava.lang.Object- Returns:
- a description of the classifier as a string.
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class.- Parameters:
argv- the options
-
-