public class AddClassification extends SimpleBatchFilter implements WeightedAttributesHandler, WeightedInstancesHandler
-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 java.io.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_Debug, m_DoNotCheckCapabilities, m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts| Constructor and Description |
|---|
AddClassification() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.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 java.lang.String |
getClassifierSpec()
Gets the classifier specification string, which contains the class name of
the classifier and any options to the classifier.
|
java.lang.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.
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.io.File |
getSerializedClassifierFile()
Gets the file pointing to a serialized, trained classifier.
|
java.lang.String |
globalInfo()
Returns a string describing this filter.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] args)
runs the filter with the given arguments.
|
java.lang.String |
outputClassificationTipText()
Returns the tip text for this property.
|
java.lang.String |
outputDistributionTipText()
Returns the tip text for this property.
|
java.lang.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.
|
java.lang.String |
removeOldClassTipText()
Returns the tip text for this property.
|
protected void |
reset()
resets the filter, i.e., m_ActualClassifier to null.
|
java.lang.String |
serializedClassifierFileTipText()
Returns the tip text for this property.
|
void |
setClassifier(Classifier value)
Sets the classifier to classify instances with.
|
void |
setOptions(java.lang.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(java.io.File value)
Sets the file pointing to a serialized, trained classifier.
|
protected void |
testInputFormat(Instances instanceInfo)
Need to override this to deal with InputMappedClassifier case.
|
allowAccessToFullInputFormat, batchFinished, hasImmediateOutputFormat, inputsetInputFormatbatchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, toString, useFilter, wekaStaticWrapperprotected Classifier m_Classifier
protected java.io.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 java.lang.String globalInfo()
globalInfo in class SimpleFilterpublic java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class Filterpublic void setOptions(java.lang.String[] options)
throws java.lang.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 Filteroptions - the options to usejava.lang.Exception - if setting of options failspublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Filterprotected void reset()
reset in class SimpleFilterm_ActualClassifierprotected Classifier getActualClassifier()
protected void testInputFormat(Instances instanceInfo) throws java.lang.Exception
testInputFormat in class FilterinstanceInfo - the data to testjava.lang.Exception - if the test failspublic Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiespublic java.lang.String classifierTipText()
public void setClassifier(Classifier value)
value - The classifier to be used (with its options set).public Classifier getClassifier()
protected java.lang.String getClassifierSpec()
public java.lang.String serializedClassifierFileTipText()
public java.io.File getSerializedClassifierFile()
public void setSerializedClassifierFile(java.io.File value)
value - the file pointing to the serialized, trained classifierpublic java.lang.String outputClassificationTipText()
public boolean getOutputClassification()
public void setOutputClassification(boolean value)
value - whether the classification of the classifier is output.public java.lang.String removeOldClassTipText()
public boolean getRemoveOldClass()
public void setRemoveOldClass(boolean value)
value - whether the old class attribute is removed.public java.lang.String outputDistributionTipText()
public boolean getOutputDistribution()
public void setOutputDistribution(boolean value)
value - whether the distribution of the classifier is output.public java.lang.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 java.lang.Exception
determineOutputFormat in class SimpleFilterinputFormat - the input format to base the output format onjava.lang.Exception - in case the determination goes wrongSimpleBatchFilter.hasImmediateOutputFormat(),
SimpleBatchFilter.batchFinished()protected Instances process(Instances instances) throws java.lang.Exception
process in class SimpleFilterinstances - the data to processjava.lang.Exception - in case the processing goes wrongSimpleBatchFilter.batchFinished()public java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Filterpublic static void main(java.lang.String[] args)
args - the commandline arguments