Package weka.classifiers.bayes
Class DMNBtext
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.bayes.DMNBtext
- All Implemented Interfaces:
Serializable,Cloneable,UpdateableClassifier,CapabilitiesHandler,OptionHandler,RevisionHandler,TechnicalInformationHandler,WeightedInstancesHandler
public class DMNBtext
extends Classifier
implements OptionHandler, WeightedInstancesHandler, TechnicalInformationHandler, UpdateableClassifier
Class for building and using a Discriminative Multinomial Naive Bayes classifier. For more information see,
Jiang Su,Harry Zhang,Charles X. Ling,Stan Matwin: Discriminative Parameter Learning for Bayesian Networks. In: ICML 2008', 2008.
The core equation for this classifier:
P[Ci|D] = (P[D|Ci] x P[Ci]) / P[D] (Bayes rule)
where Ci is class i and D is a document. BibTeX:
Jiang Su,Harry Zhang,Charles X. Ling,Stan Matwin: Discriminative Parameter Learning for Bayesian Networks. In: ICML 2008', 2008.
The core equation for this classifier:
P[Ci|D] = (P[D|Ci] x P[Ci]) / P[D] (Bayes rule)
where Ci is class i and D is a document. BibTeX:
@inproceedings{JiangSu2008,
author = {Jiang Su,Harry Zhang,Charles X. Ling,Stan Matwin},
booktitle = {ICML 2008'},
title = {Discriminative Parameter Learning for Bayesian Networks},
year = {2008}
}
Valid options are:
-I <iterations> The number of iterations that the classifier will scan the training data (default = 1)
-M Use the frequency information in data
- Version:
- $Revision: 6363 $
- Author:
- Jiang Su (Jiang.Su@unb.ca) 2008
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildClassifier(Instances data) Generates the classifier.double[]distributionForInstance(Instance instance) Calculates the class membership probabilities for the given test instance.Returns default capabilities of the classifier.booleanGets whether use binary text representationintGets the number of iterations to be performedString[]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.Returns a string describing this classifierReturns an enumeration describing the available options.static voidMain method for testing this class.Returns the tip text for this propertyReturns the tip text for this propertyvoidsetMultinomialWord(boolean val) Sets whether use binary text representationvoidsetNumIterations(int numIterations) Sets the number of iterations to be performedvoidsetOptions(String[] options) Parses a given list of options.toString()Returns a string representation of the classifier.voidupdateClassifier(Instance instance) Updates the classifier with the given instance.Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
Constructor Details
-
DMNBtext
public DMNBtext()
-
-
Method Details
-
globalInfo
Returns a string describing this classifier- Returns:
- 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.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
getCapabilities
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classClassifier- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
Generates the classifier.- Specified by:
buildClassifierin classClassifier- Parameters:
instances- set of instances serving as training data- Throws:
Exception- if the classifier has not been generated successfully
-
updateClassifier
Updates the classifier with the given instance.- Specified by:
updateClassifierin interfaceUpdateableClassifier- Parameters:
instance- the new training instance to include in the model- Throws:
Exception- if the instance could not be incorporated in the model.
-
distributionForInstance
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:
Exception- if there is a problem generating the prediction
-
toString
Returns a string representation of the classifier. -
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classClassifier- Returns:
- an enumeration of all the available options.
-
setOptions
Description copied from class:ClassifierParses a given list of options. Valid options are:-D
If set, classifier is run in debug mode and may output additional info to the console.- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classClassifier- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
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
-
numIterationsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumIterations
public void setNumIterations(int numIterations) Sets the number of iterations to be performed -
getNumIterations
public int getNumIterations()Gets the number of iterations to be performed- Returns:
- the iterations to be performed
-
multinomialWordTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMultinomialWord
public void setMultinomialWord(boolean val) Sets whether use binary text representation -
getMultinomialWord
public boolean getMultinomialWord()Gets whether use binary text representation- Returns:
- whether use binary text representation
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
argv- the options
-