weka.classifiers.bayes
Class DMNBtext

java.lang.Object
  extended by weka.classifiers.Classifier
      extended by weka.classifiers.bayes.DMNBtext
All Implemented Interfaces:
java.io.Serializable, java.lang.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:

 @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:

 -D
  If set, classifier is run in debug mode and
  may output additional info to the console

Version:
$Revision: 5516 $
Author:
Jiang Su (Jiang.Su@unb.ca) 2008
See Also:
Serialized Form

Nested Class Summary
 class DMNBtext.DNBBinary
           
 
Constructor Summary
DMNBtext()
           
 
Method Summary
 java.lang.String binaryWordTipText()
          Returns the tip text for this property
 void buildClassifier(Instances data)
          Generates the classifier.
 double[] distributionForInstance(Instance instance)
          Calculates the class membership probabilities for the given test instance.
 boolean getBinaryWord()
          Gets whether use binary text representation
 Capabilities getCapabilities()
          Returns default capabilities of the classifier.
 int getNumIterations()
          Gets the number of iterations to be performed
 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.
 java.lang.String globalInfo()
          Returns a string describing this classifier
static void main(java.lang.String[] argv)
          Main method for testing this class.
 java.lang.String numIterationsTipText()
          Returns the tip text for this property
 void setBinaryWord(boolean val)
          Sets whether use binary text representation
 void setNumIterations(int numIterations)
          Sets the number of iterations to be performed
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 java.lang.String toString()
          Returns a string representation of the classifier.
 void updateClassifier(Instance instance)
          Updates the classifier with the given instance.
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, listOptions, makeCopies, makeCopy, setDebug
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface weka.core.OptionHandler
listOptions
 

Constructor Detail

DMNBtext

public DMNBtext()
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:
getTechnicalInformation in interface TechnicalInformationHandler
Returns:
the technical information about this class

getCapabilities

public Capabilities getCapabilities()
Returns default capabilities of the classifier.

Specified by:
getCapabilities in interface CapabilitiesHandler
Overrides:
getCapabilities in class Classifier
Returns:
the capabilities of this classifier
See Also:
Capabilities

buildClassifier

public void buildClassifier(Instances data)
                     throws java.lang.Exception
Generates the classifier.

Specified by:
buildClassifier in class Classifier
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)
                      throws java.lang.Exception
Updates the classifier with the given instance.

Specified by:
updateClassifier in interface UpdateableClassifier
Parameters:
instance - the new training instance to include in the model
Throws:
java.lang.Exception - if the instance could not be incorporated in the model.

distributionForInstance

public double[] distributionForInstance(Instance instance)
                                 throws java.lang.Exception
Calculates the class membership probabilities for the given test instance.

Overrides:
distributionForInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
predicted class probability distribution
Throws:
java.lang.Exception - if there is a problem generating the prediction

toString

public java.lang.String toString()
Returns a string representation of the classifier.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the classifier

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Description copied from class: Classifier
Parses 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:
setOptions in interface OptionHandler
Overrides:
setOptions in class Classifier
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:
getOptions in interface OptionHandler
Overrides:
getOptions in class Classifier
Returns:
an array of strings suitable for passing to setOptions

numIterationsTipText

public java.lang.String 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

binaryWordTipText

public java.lang.String binaryWordTipText()
Returns the tip text for this property

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

setBinaryWord

public void setBinaryWord(boolean val)
Sets whether use binary text representation


getBinaryWord

public boolean getBinaryWord()
Gets whether use binary text representation

Returns:
whether use binary text representation

getRevision

public java.lang.String getRevision()
Returns the revision string.

Specified by:
getRevision in interface RevisionHandler
Overrides:
getRevision in class Classifier
Returns:
the revision

main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - the options