|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.DistributionClassifier | +--weka.classifiers.FilteredClassifier
Class for running an arbitrary classifier on data that has been passed through an arbitrary filter.
Valid options from the command line are:
-B classifierstring
Classifierstring should contain the full class name of a classifier
followed by options to the classifier.
(required).
-F filterstring
Filterstring should contain the full class name of a filter
followed by options to the filter.
(required).
Field Summary | |
protected Classifier |
m_Classifier
The classifier |
protected Filter |
m_Filter
The filter |
protected Instances |
m_FilteredInstances
The instance structure of the filtered instances |
Constructor Summary | |
FilteredClassifier()
Default constructor specifying ZeroR as the classifier and AllFilter as the filter. |
|
FilteredClassifier(Classifier classifier,
Filter filter)
Constructor that specifies the subclassifier and filter to use. |
Method Summary | |
void |
buildClassifier(Instances data)
Build the classifier on the filtered data. |
double[] |
distributionForInstance(Instance instance)
Classifies a given instance after filtering. |
Classifier |
getClassifier()
Gets the classifier used. |
protected java.lang.String |
getClassifierSpec()
Gets the classifier specification string, which contains the class name of the classifier and any options to the classifier |
Filter |
getFilter()
Gets the filter used. |
protected java.lang.String |
getFilterSpec()
Gets the filter specification string, which contains the class name of the filter and any options to the filter |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
void |
setClassifier(Classifier classifier)
Sets the classifier |
void |
setFilter(Filter filter)
Sets the filter |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString()
Output a representation of this classifier |
Methods inherited from class weka.classifiers.DistributionClassifier |
classifyInstance |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Classifier m_Classifier
protected Filter m_Filter
protected Instances m_FilteredInstances
Constructor Detail |
public FilteredClassifier()
public FilteredClassifier(Classifier classifier, Filter filter)
classifier
- the Classifier to receive filtered instances.filter
- the Filter that will process instances before
passing to the Classifier.Method Detail |
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-B classifierstring
Classifierstring should contain the full class name of a classifier
followed by options to the classifier.
(required).
-F filterstring
Filterstring should contain the full class name of a filter
followed by options to the filter.
(required).
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setClassifier(Classifier classifier)
classifier
- the classifier with all options set.public Classifier getClassifier()
protected java.lang.String getClassifierSpec()
public void setFilter(Filter filter)
filter
- the filter with all options set.public Filter getFilter()
protected java.lang.String getFilterSpec()
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training datajava.lang.Exception
- if the classifier could not be built successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class DistributionClassifier
instance
- the instance to be classifiedjava.lang.Exception
- if instance could not be classified
successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
argv
- should contain the following arguments:
-t training file [-T test file] [-c class index]
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |