public class AddClassification extends SimpleBatchFilter
-D Turns on output of debugging information.
-W <classifier specification> Full class name of classifier to use, followed by scheme options. eg: "weka.classifiers.bayes.NaiveBayes -D" (default: weka.classifiers.rules.ZeroR)
-serialized <file> Instead of training a classifier on the data, one can also provide a serialized model and use that for tagging the data.
-classification Adds an attribute with the actual classification. (default: off)
-remove-old-class Removes the old class attribute. (default: off)
-distribution Adds attributes with the distribution for all classes (for numeric classes this will be identical to the attribute output with '-classification'). (default: off)
-error Adds an attribute indicating whether the classifier output a wrong classification (for numeric classes this is the numeric difference). (default: off)
| Modifier and Type | Field and Description |
|---|---|
protected Classifier |
m_ActualClassifier
The actual classifier used to do the classification.
|
protected Classifier |
m_Classifier
The classifier template used to do the classification.
|
protected boolean |
m_OutputClassification
whether to output the classification.
|
protected boolean |
m_OutputDistribution
whether to output the class distribution.
|
protected boolean |
m_OutputErrorFlag
whether to output the error flag.
|
protected boolean |
m_RemoveOldClass
whether to remove the old class attribute.
|
protected File |
m_SerializedClassifierFile
The file from which to load a serialized classifier.
|
protected Instances |
m_SerializedHeader
the header of the file the serialized classifier was trained with.
|
m_Debugm_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts| Constructor and Description |
|---|
AddClassification() |
| Modifier and Type | Method and Description |
|---|---|
String |
classifierTipText()
Returns the tip text for this property.
|
protected Instances |
determineOutputFormat(Instances inputFormat)
Determines the output format based on the input format and returns
this.
|
protected Classifier |
getActualClassifier()
Returns the actual classifier to use, either from the serialized model
or the one specified by the user.
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
Classifier |
getClassifier()
Gets the classifier used by the filter.
|
protected String |
getClassifierSpec()
Gets the classifier specification string, which contains the class name of
the classifier and any options to the classifier.
|
String[] |
getOptions()
Gets the current settings of the classifier.
|
boolean |
getOutputClassification()
Get whether the classifiction of the classifier is output.
|
boolean |
getOutputDistribution()
Get whether the classifiction of the classifier is output.
|
boolean |
getOutputErrorFlag()
Get whether the classifiction of the classifier is output.
|
boolean |
getRemoveOldClass()
Get whether the old class attribute is removed.
|
String |
getRevision()
Returns the revision string.
|
File |
getSerializedClassifierFile()
Gets the file pointing to a serialized, trained classifier.
|
String |
globalInfo()
Returns a string describing this filter.
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] args)
runs the filter with the given arguments.
|
String |
outputClassificationTipText()
Returns the tip text for this property.
|
String |
outputDistributionTipText()
Returns the tip text for this property.
|
String |
outputErrorFlagTipText()
Returns the tip text for this property.
|
protected Instances |
process(Instances instances)
Processes the given data (may change the provided dataset) and returns
the modified version.
|
String |
removeOldClassTipText()
Returns the tip text for this property.
|
protected void |
reset()
resets the filter, i.e., m_ActualClassifier to null.
|
String |
serializedClassifierFileTipText()
Returns the tip text for this property.
|
void |
setClassifier(Classifier value)
Sets the classifier to classify instances with.
|
void |
setOptions(String[] options)
Parses the options for this object.
|
void |
setOutputClassification(boolean value)
Set whether the classification of the classifier is output.
|
void |
setOutputDistribution(boolean value)
Set whether the Distribution of the classifier is output.
|
void |
setOutputErrorFlag(boolean value)
Set whether the classification of the classifier is output.
|
void |
setRemoveOldClass(boolean value)
Set whether the old class attribute is removed.
|
void |
setSerializedClassifierFile(File value)
Sets the file pointing to a serialized, trained classifier.
|
batchFinished, hasImmediateOutputFormat, inputdebugTipText, getDebug, setDebug, setInputFormatbatchFilterFile, bufferInput, copyValues, copyValues, filterFile, flushInput, getCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputFormatPeek, outputPeek, push, resetQueue, runFilter, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapperprotected Classifier m_Classifier
protected File m_SerializedClassifierFile
protected Classifier m_ActualClassifier
protected Instances m_SerializedHeader
protected boolean m_OutputClassification
protected boolean m_RemoveOldClass
protected boolean m_OutputDistribution
protected boolean m_OutputErrorFlag
public String globalInfo()
globalInfo in class SimpleFilterpublic Enumeration listOptions()
listOptions in interface OptionHandlerlistOptions in class SimpleFilterpublic void setOptions(String[] options) throws Exception
-D Turns on output of debugging information.
-W <classifier specification> Full class name of classifier to use, followed by scheme options. eg: "weka.classifiers.bayes.NaiveBayes -D" (default: weka.classifiers.rules.ZeroR)
-serialized <file> Instead of training a classifier on the data, one can also provide a serialized model and use that for tagging the data.
-classification Adds an attribute with the actual classification. (default: off)
-remove-old-class Removes the old class attribute. (default: off)
-distribution Adds attributes with the distribution for all classes (for numeric classes this will be identical to the attribute output with '-classification'). (default: off)
-error Adds an attribute indicating whether the classifier output a wrong classification (for numeric classes this is the numeric difference). (default: off)
setOptions in interface OptionHandlersetOptions in class SimpleFilteroptions - the options to useException - if setting of options failsSimpleFilter.reset()public String[] getOptions()
getOptions in interface OptionHandlergetOptions in class SimpleFilterprotected void reset()
reset in class SimpleFilterm_ActualClassifierprotected Classifier getActualClassifier()
public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiespublic String classifierTipText()
public void setClassifier(Classifier value)
value - The classifier to be used (with its options set).public Classifier getClassifier()
protected String getClassifierSpec()
public String serializedClassifierFileTipText()
public File getSerializedClassifierFile()
public void setSerializedClassifierFile(File value)
value - the file pointing to the serialized, trained classifierpublic String outputClassificationTipText()
public boolean getOutputClassification()
public void setOutputClassification(boolean value)
value - whether the classification of the classifier is output.public String removeOldClassTipText()
public boolean getRemoveOldClass()
public void setRemoveOldClass(boolean value)
value - whether the old class attribute is removed.public String outputDistributionTipText()
public boolean getOutputDistribution()
public void setOutputDistribution(boolean value)
value - whether the distribution of the classifier is output.public String outputErrorFlagTipText()
public boolean getOutputErrorFlag()
public void setOutputErrorFlag(boolean value)
value - whether the classification of the classifier is output.protected Instances determineOutputFormat(Instances inputFormat) throws Exception
determineOutputFormat in class SimpleFilterinputFormat - the input format to base the output format onException - in case the determination goes wrongSimpleBatchFilter.hasImmediateOutputFormat(),
SimpleBatchFilter.batchFinished()protected Instances process(Instances instances) throws Exception
process in class SimpleFilterinstances - the data to processException - in case the processing goes wrongSimpleBatchFilter.batchFinished()public String getRevision()
getRevision in interface RevisionHandlergetRevision in class Filterpublic static void main(String[] args)
args - the commandline argumentsCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.