Class AbstractRowFinderApplier

  • All Implemented Interfaces:
    Serializable, weka.core.CapabilitiesHandler, weka.core.CapabilitiesIgnorer, weka.core.CommandlineRunnable, weka.core.OptionHandler, weka.core.RevisionHandler
    Direct Known Subclasses:
    DatasetCleaner, DatasetLabeler

    public abstract class AbstractRowFinderApplier
    extends weka.filters.SimpleBatchFilter
    Ancestor for filters that apply RowFinder schemes to the data.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean m_Invert
      Whether to invert the row indices.
      protected boolean m_OnlyFirstBatch
      Whether to only apply during first batch.
      protected RowFinder m_RowFinder
      The classifier template used to do the classification.
      • Fields inherited from class weka.filters.Filter

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

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract weka.core.Instances apply​(weka.core.Instances data, int[] indices)
      Applies the indices to the data.
      protected abstract 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.
      boolean getInvert()
      Returns whether the invert the row indices.
      boolean getOnlyFirstBatch()
      Returns whether to apply row finder during first batch.
      String[] getOptions()
      Gets the current settings of the classifier.
      RowFinder getRowFinder()
      Returns the row finder used by the filter.
      String invertTipText()
      Returns the tip text for this property.
      Enumeration listOptions()
      Returns an enumeration describing the available options.
      boolean mayRemoveInstanceAfterFirstBatchDone()
      Derived filters may removed rows.
      protected abstract boolean mayRemoveInstances()
      Method that returns whether the filter may remove instances after the first batch has been done.
      String onlyFirstBatchTipText()
      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.
      abstract String rowFinderTipText()
      Returns the tip text for this property.
      void setInvert​(boolean value)
      Set whether the invert the row indices.
      void setOnlyFirstBatch​(boolean value)
      Set whether to apply row finder during first batch.
      void setOptions​(String[] options)
      Parses the options for this object.
      void setRowFinder​(RowFinder value)
      Sets the row finder to use.
      • Methods inherited from class weka.filters.SimpleBatchFilter

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

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

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

      • m_RowFinder

        protected RowFinder m_RowFinder
        The classifier template used to do the classification.
      • m_Invert

        protected boolean m_Invert
        Whether to invert the row indices.
      • m_OnlyFirstBatch

        protected boolean m_OnlyFirstBatch
        Whether to only apply during first batch.
    • Constructor Detail

      • AbstractRowFinderApplier

        public AbstractRowFinderApplier()
    • Method Detail

      • 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
      • mayRemoveInstances

        protected abstract boolean mayRemoveInstances()
        Method that returns whether the filter may remove instances after the first batch has been done.
        Returns:
        true if instances may get removed
        See Also:
        mayRemoveInstanceAfterFirstBatchDone()
      • mayRemoveInstanceAfterFirstBatchDone

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

        public void setRowFinder​(RowFinder value)
        Sets the row finder to use.
        Parameters:
        value - The row finder to be used (with its options set).
      • getRowFinder

        public RowFinder getRowFinder()
        Returns the row finder used by the filter.
        Returns:
        The row finder to be used.
      • rowFinderTipText

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

        public void setInvert​(boolean value)
        Set whether the invert the row indices.
        Parameters:
        value - true if to invert the indices
      • getInvert

        public boolean getInvert()
        Returns whether the invert the row indices.
        Returns:
        true if the indices get inverted
      • invertTipText

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

        public void setOnlyFirstBatch​(boolean value)
        Set whether to apply row finder during first batch.
        Parameters:
        value - true if to only apply during first batch
      • getOnlyFirstBatch

        public boolean getOnlyFirstBatch()
        Returns whether to apply row finder during first batch.
        Returns:
        true if to only apply during first batch
      • onlyFirstBatchTipText

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

        protected abstract 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
      • apply

        protected abstract weka.core.Instances apply​(weka.core.Instances data,
                                                     int[] indices)
        Applies the indices to the data. In case inverting is enabled, the indices have already been inverted.
        Parameters:
        data - the data to process
        indices - the indices to use
        Returns:
        the processed data
      • 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()