Package weka.classifiers.meta
Class MOA
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.meta.MOA
-
- All Implemented Interfaces:
Serializable
,Cloneable
,weka.classifiers.Classifier
,weka.classifiers.UpdateableClassifier
,weka.core.BatchPredictor
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,weka.core.OptionHandler
,weka.core.RevisionHandler
public class MOA extends weka.classifiers.AbstractClassifier implements weka.classifiers.UpdateableClassifier
Wrapper for MOA classifiers.
Since MOA doesn't offer a mechanism to query a classifier for the types of attributes and classes it can handle, the capabilities of this wrapper are hard-coded: nominal and numeric attributes and only nominal class attributes are allowed. Valid options are:-B <classname + options> The MOA classifier to use. (default: moa.classifiers.DecisionStump)
-D If set, classifier is run in debug mode and may output additional info to the console
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected WekaToSamoaInstanceConverter
instanceConverter
protected Classifier
m_ActualClassifier
the actual moa classifier to use for learning.protected ClassOption
m_Classifier
the moa classifier option (this object is used in the GenericObjectEditor).
-
Constructor Summary
Constructors Constructor Description MOA()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildClassifier(weka.core.Instances data)
Generates a classifier.String
classifierTipText()
Returns the tooltip displayed in the GUI.double[]
distributionForInstance(weka.core.Instance instance)
Predicts the class memberships for a given instance.weka.core.Capabilities
getCapabilities()
Returns the Capabilities of this classifier.ClassOption
getClassifier()
Returns the current MOA classifier in use.String[]
getOptions()
Gets the current settings of the Classifier.String
getRevision()
Returns the revision string.String
globalInfo()
Returns a string describing the classifier.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] args)
Main method for testing this class.void
setClassifier(ClassOption value)
Sets the MOA classifier to use.void
setOptions(String[] options)
Parses a given list of options.String
toString()
Returns a string representation of the model.void
updateClassifier(weka.core.Instance instance)
Updates a classifier using the given instance.-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
m_ActualClassifier
protected Classifier m_ActualClassifier
the actual moa classifier to use for learning.
-
m_Classifier
protected ClassOption m_Classifier
the moa classifier option (this object is used in the GenericObjectEditor).
-
instanceConverter
protected WekaToSamoaInstanceConverter instanceConverter
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the classifier.- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in classweka.classifiers.AbstractClassifier
- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Parses a given list of options. Valid options are:-B <classname + options> The MOA classifier to use. (default: moa.classifiers.trees.DecisionStump)
-D If set, classifier is run in debug mode and may output additional info to the console
- Specified by:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in classweka.classifiers.AbstractClassifier
- Parameters:
options
- the list of options as an array of strings- Throws:
Exception
- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current settings of the Classifier.- Specified by:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classweka.classifiers.AbstractClassifier
- Returns:
- an array of strings suitable for passing to setOptions
-
setClassifier
public void setClassifier(ClassOption value)
Sets the MOA classifier to use.- Parameters:
value
- the classifier to use
-
getClassifier
public ClassOption getClassifier()
Returns the current MOA classifier in use.- Returns:
- the classifier in use
-
classifierTipText
public String classifierTipText()
Returns the tooltip displayed in the GUI.- Returns:
- the tooltip
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this classifier. Maximally permissive capabilities are allowed by default. MOA doesn't specify what- Specified by:
getCapabilities
in interfaceweka.core.CapabilitiesHandler
- Specified by:
getCapabilities
in interfaceweka.classifiers.Classifier
- Overrides:
getCapabilities
in classweka.classifiers.AbstractClassifier
- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws Exception
Generates a classifier.- Specified by:
buildClassifier
in interfaceweka.classifiers.Classifier
- Parameters:
data
- set of instances serving as training data- Throws:
Exception
- if the classifier has not been generated successfully
-
updateClassifier
public void updateClassifier(weka.core.Instance instance) throws Exception
Updates a classifier using the given instance.- Specified by:
updateClassifier
in interfaceweka.classifiers.UpdateableClassifier
- Parameters:
instance
- the instance to included- Throws:
Exception
- if instance could not be incorporated successfully
-
distributionForInstance
public double[] distributionForInstance(weka.core.Instance instance) throws Exception
Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero. If the class is numeric, the array must consist of only one element, which contains the predicted value.- Specified by:
distributionForInstance
in interfaceweka.classifiers.Classifier
- Overrides:
distributionForInstance
in classweka.classifiers.AbstractClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
- Throws:
Exception
- if distribution could not be computed successfully
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.classifiers.AbstractClassifier
- Returns:
- the revision
-
toString
public String toString()
Returns a string representation of the model.
-
main
public static void main(String[] args)
Main method for testing this class.- Parameters:
args
- the options
-
-