Package weka.filters

Class FilteredFilter

  • All Implemented Interfaces:
    Serializable, weka.core.CapabilitiesHandler, weka.core.CapabilitiesIgnorer, weka.core.CommandlineRunnable, weka.core.OptionHandler, weka.core.RevisionHandler

    public class FilteredFilter
    extends weka.filters.SimpleBatchFilter
    First applies the pre-filter to the data and the generated data is fed into the main filter.

    Valid options are:

     -output-debug-info
      If set, filter is run in debug mode and
      may output additional info to the console
     -do-not-check-capabilities
      If set, filter capabilities are not checked before filter is built
      (use with caution).
     -pre <filter specification>
      Full class name of pre-filter to use, followed by scheme options.
      (default: weka.filters.unsupervised.instance.DatasetCleaner)
     -main <filter specification>
      Full class name of main filter to use, followed by scheme options.
      (default: weka.filters.supervised.attribute.PLS)
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected weka.filters.Filter m_MainFilter
      The main filter to apply to the data.
      protected weka.filters.Filter m_PreFilter
      The pre-filter to apply to the data.
      • Fields inherited from class weka.filters.Filter

        m_Debug, m_DoNotCheckCapabilities, m_FirstBatchDone, m_InputRelAtts, m_InputStringAtts, m_NewBatch, m_OutputRelAtts, m_OutputStringAtts
    • Constructor Summary

      Constructors 
      Constructor Description
      FilteredFilter()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allowAccessToFullInputFormat()
      Returns whether to allow the determineOutputFormat(Instances) method access to the full dataset rather than just the header.
      protected weka.core.Instances determineOutputFormat​(weka.core.Instances inputFormat)
      Determines the output format based on the input format and returns this.
      weka.core.Capabilities getCapabilities()
      Returns the Capabilities of this filter.
      protected weka.filters.Filter getDefaultMainFilter()
      Returns the default main filter.
      protected weka.filters.Filter getDefaultPreFilter()
      Returns the default pre-filter.
      weka.filters.Filter getMainFilter()
      Returns the main filter in use.
      String[] getOptions()
      Gets the current settings of the classifier.
      weka.filters.Filter getPreFilter()
      Returns the pre-filter in use.
      String getRevision()
      Returns the revision string.
      String globalInfo()
      Returns a string describing this filter.
      Enumeration listOptions()
      Returns an enumeration describing the available options.
      static void main​(String[] args)
      Main method for running this filter.
      String mainFilterTipText()
      Returns the tip text for this property.
      boolean mayRemoveInstanceAfterFirstBatchDone()
      Derived filters may removed rows.
      String preFilterTipText()
      Returns the tip text for this property.
      protected weka.core.Instances process​(weka.core.Instances instances)
      Processes the given data (may change the provided dataset) and returns the modified version.
      void setMainFilter​(weka.filters.Filter value)
      Sets the main filter to use.
      void setOptions​(String[] options)
      Parses the options for this object.
      void setPreFilter​(weka.filters.Filter value)
      Sets the pre-filter to use.
      • Methods inherited from class weka.filters.SimpleBatchFilter

        batchFinished, hasImmediateOutputFormat, input
      • Methods inherited from class weka.filters.SimpleFilter

        reset, setInputFormat
      • Methods inherited from class weka.filters.Filter

        batchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
    • Field Detail

      • m_PreFilter

        protected weka.filters.Filter m_PreFilter
        The pre-filter to apply to the data.
      • m_MainFilter

        protected weka.filters.Filter m_MainFilter
        The main filter to apply to the data.
    • Constructor Detail

      • FilteredFilter

        public FilteredFilter()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing this filter.
        Specified by:
        globalInfo in class weka.filters.SimpleFilter
        Returns:
        a description of the filter suitable for displaying in the explorer/experimenter gui
      • listOptions

        public Enumeration listOptions()
        Returns an enumeration describing the available options.
        Specified by:
        listOptions in interface weka.core.OptionHandler
        Overrides:
        listOptions in class weka.filters.Filter
        Returns:
        an enumeration of all the available options.
      • setOptions

        public void setOptions​(String[] options)
                        throws Exception
        Parses the options for this object.
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Overrides:
        setOptions in class weka.filters.Filter
        Parameters:
        options - the options to use
        Throws:
        Exception - if setting of options fails
      • getOptions

        public String[] getOptions()
        Gets the current settings of the classifier.
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Overrides:
        getOptions in class weka.filters.Filter
        Returns:
        an array of strings suitable for passing to setOptions
      • getCapabilities

        public weka.core.Capabilities getCapabilities()
        Returns the Capabilities of this filter.
        Specified by:
        getCapabilities in interface weka.core.CapabilitiesHandler
        Overrides:
        getCapabilities in class weka.filters.Filter
        Returns:
        the capabilities of this object
        See Also:
        Capabilities
      • mayRemoveInstanceAfterFirstBatchDone

        public boolean mayRemoveInstanceAfterFirstBatchDone()
        Derived filters may removed rows.
        Overrides:
        mayRemoveInstanceAfterFirstBatchDone in class weka.filters.Filter
        Returns:
        true if instances might get removed
      • getDefaultPreFilter

        protected weka.filters.Filter getDefaultPreFilter()
        Returns the default pre-filter.
        Returns:
        the default
      • setPreFilter

        public void setPreFilter​(weka.filters.Filter value)
        Sets the pre-filter to use.
        Parameters:
        value - the filter
      • getPreFilter

        public weka.filters.Filter getPreFilter()
        Returns the pre-filter in use.
        Returns:
        the filter
      • preFilterTipText

        public String preFilterTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • getDefaultMainFilter

        protected weka.filters.Filter getDefaultMainFilter()
        Returns the default main filter.
        Returns:
        the default
      • setMainFilter

        public void setMainFilter​(weka.filters.Filter value)
        Sets the main filter to use.
        Parameters:
        value - the filter
      • getMainFilter

        public weka.filters.Filter getMainFilter()
        Returns the main filter in use.
        Returns:
        the filter
      • mainFilterTipText

        public String mainFilterTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui
      • allowAccessToFullInputFormat

        public boolean allowAccessToFullInputFormat()
        Returns whether to allow the determineOutputFormat(Instances) method access to the full dataset rather than just the header.
        Overrides:
        allowAccessToFullInputFormat in class weka.filters.SimpleBatchFilter
        Returns:
        whether determineOutputFormat has access to the full input dataset
      • determineOutputFormat

        protected weka.core.Instances determineOutputFormat​(weka.core.Instances inputFormat)
                                                     throws Exception
        Determines the output format based on the input format and returns this. In case the output format cannot be returned immediately, i.e., immediateOutputFormat() returns false, then this method will be called from batchFinished().
        Specified by:
        determineOutputFormat in class weka.filters.SimpleFilter
        Parameters:
        inputFormat - the input format to base the output format on
        Returns:
        the output format
        Throws:
        Exception - in case the determination goes wrong
      • process

        protected weka.core.Instances process​(weka.core.Instances instances)
                                       throws Exception
        Processes the given data (may change the provided dataset) and returns the modified version. This method is called in batchFinished().
        Specified by:
        process in class weka.filters.SimpleFilter
        Parameters:
        instances - the data to process
        Returns:
        the modified data
        Throws:
        Exception - in case the processing goes wrong
        See Also:
        SimpleBatchFilter.batchFinished()
      • getRevision

        public String getRevision()
        Returns the revision string.
        Specified by:
        getRevision in interface weka.core.RevisionHandler
        Overrides:
        getRevision in class weka.filters.Filter
        Returns:
        the revision
      • main

        public static void main​(String[] args)
        Main method for running this filter.
        Parameters:
        args - should contain arguments to the filter: use -h for help