Class RandomizableFilteredClassifier

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Classifier, IterativeClassifier, BatchPredictor, CapabilitiesHandler, CapabilitiesIgnorer, CommandlineRunnable, Drawable, OptionHandler, PartitionGenerator, Randomizable, RevisionHandler, WeightedAttributesHandler, WeightedInstancesHandler

    public class RandomizableFilteredClassifier
    extends FilteredClassifier
    Class for running an arbitrary classifier on data that has been passed through an arbitrary filter. Like the classifier, the structure of the filter is based exclusively on the training data and test instances will be processed by the filter without changing their structure.

    Valid options are:

     -F <filter specification>
      Full class name of filter to use, followed
      by filter options.
      default: "weka.filters.unsupervised.attribute.RandomProjection -N 10 -D Sparse1"
     -D
      If set, classifier is run in debug mode and
      may output additional info to the console
     -W
      Full name of base classifier.
      (default: weka.classifiers.lazy.IBk)
     -S num
     Set the random number seed (default 1). 
     
     Options specific to classifier weka.classifiers.lazy.IBk:
     
     -I
      Weight neighbours by the inverse of their distance
      (use when k > 1)
     -F
      Weight neighbours by 1 - their distance
      (use when k > 1)
     -K <number of neighbors>
      Number of nearest neighbours (k) used in classification.
      (Default = 1)
     -E
      Minimise mean squared error rather than mean absolute
      error when using -X option with numeric prediction.
     -W <window size>
      Maximum number of training instances maintained.
      Training instances are dropped FIFO. (Default = no window)
     -X
      Select the number of nearest neighbours between 1
      and the k value specified using hold-one-out evaluation
      on the training data (use when k > 1)
     -A
      The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
     
    Version:
    $Revision: 9117 $
    Author:
    Eibe Frank
    See Also:
    Serialized Form
    • Constructor Detail

      • RandomizableFilteredClassifier

        public RandomizableFilteredClassifier()
        Default constructor.
    • Method Detail

      • globalInfo

        public java.lang.String globalInfo()
        Returns a string describing this classifier
        Overrides:
        globalInfo in class FilteredClassifier
        Returns:
        a description of the classifier suitable for displaying in the explorer/experimenter gui
      • initializeClassifier

        public void initializeClassifier​(Instances data)
                                  throws java.lang.Exception
        Initializes an iterative classifier. (If the base classifier supports this.)
        Specified by:
        initializeClassifier in interface IterativeClassifier
        Overrides:
        initializeClassifier in class FilteredClassifier
        Parameters:
        data - the instances to be used in induction
        Throws:
        java.lang.Exception - if the model cannot be initialized
      • buildClassifier

        public void buildClassifier​(Instances data)
                             throws java.lang.Exception
        Build the classifier on the filtered data.
        Specified by:
        buildClassifier in interface Classifier
        Overrides:
        buildClassifier in class FilteredClassifier
        Parameters:
        data - the training data
        Throws:
        java.lang.Exception - if the classifier could not be built successfully
      • toString

        public java.lang.String toString()
        Output a representation of this classifier
        Overrides:
        toString in class FilteredClassifier
        Returns:
        a representation of this classifier
      • main

        public static void main​(java.lang.String[] argv)
        Main method for testing this class.
        Parameters:
        argv - should contain the following arguments: -t training file [-T test file] [-c class index]