Class Detrend

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

    public class Detrend
    extends weka.filters.SimpleBatchFilter
    Performs Detrend, using the specified correction scheme.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String ATT_REGEXP  
      static String CORRECTION  
      protected gnu.trove.list.TIntList m_AttIndices
      the determined indices.
      protected gnu.trove.set.TIntSet m_AttIndicesSet
      the determined indices (as set).
      protected adams.core.base.BaseRegExp m_AttRegExp
      the range of attributes to work on.
      protected AbstractDetrend m_Correction
      the correction to use.
      protected double[] m_WaveNo
      the extracted wave numbers.
      protected adams.core.base.BaseRegExp m_WaveNoRegExp
      the regexp for extracting the wavenumbers from the attribute name.
      static String WAVENO_REGEXP  
      • 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
      Detrend()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String attRegExpTipText()
      Returns the tip text for this property.
      String correctionTipText()
      Returns the tip text for this property.
      protected weka.core.Instances determineOutputFormat​(weka.core.Instances inputFormat)
      Determines the output format based on the input format and returns this.
      adams.core.base.BaseRegExp getAttRegExp()
      Returns the regular expression used for identifying the attributes to process.
      weka.core.Capabilities getCapabilities()  
      AbstractDetrend getCorrection()
      Returns the correction scheme to apply.
      protected adams.core.base.BaseRegExp getDefaultAttRegExp()
      Returns the default regular expression for identifying the attributes to process.
      protected AbstractDetrend getDefaultCorrection()
      Returns the default correction scheme.
      protected adams.core.base.BaseRegExp getDefaultWaveNoRegExp()
      Returns the default regular expression for extracting the wave numbers.
      String[] getOptions()
      Gets the current option settings for the OptionHandler.
      String getRevision()
      Returns the revision string.
      adams.core.base.BaseRegExp getWaveNoRegExp()
      Returns the regular expression used for extracting the wave number from the attribute name (using the first group).
      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 testing this class.
      protected weka.core.Instances process​(weka.core.Instances instances)
      Processes the given data (may change the provided dataset) and returns the modified version.
      protected void reset()
      Resets the filter.
      void setAttRegExp​(adams.core.base.BaseRegExp value)
      Sets the regular expression used for identifying the attributes to process.
      void setCorrection​(AbstractDetrend value)
      Sets the correction scheme to apply.
      void setOptions​(String[] options)
      Sets the OptionHandler's options using the given list.
      void setWaveNoRegExp​(adams.core.base.BaseRegExp value)
      Sets the regular expression used for extracting the wave number from the attribute name (using the first group).
      String waveNoRegExpTipText()
      Returns the tip text for this property.
      • Methods inherited from class weka.filters.SimpleBatchFilter

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

        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, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
    • Field Detail

      • m_AttRegExp

        protected adams.core.base.BaseRegExp m_AttRegExp
        the range of attributes to work on.
      • m_WaveNoRegExp

        protected adams.core.base.BaseRegExp m_WaveNoRegExp
        the regexp for extracting the wavenumbers from the attribute name.
      • m_Correction

        protected AbstractDetrend m_Correction
        the correction to use.
      • m_AttIndices

        protected gnu.trove.list.TIntList m_AttIndices
        the determined indices.
      • m_AttIndicesSet

        protected gnu.trove.set.TIntSet m_AttIndicesSet
        the determined indices (as set).
      • m_WaveNo

        protected double[] m_WaveNo
        the extracted wave numbers.
    • Constructor Detail

      • Detrend

        public Detrend()
    • 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
        Sets the OptionHandler's options using the given list. All options will be set (or reset) during this call (i.e. incremental setting of options is not possible).
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Overrides:
        setOptions in class weka.filters.Filter
        Parameters:
        options - the list of options as an array of strings
        Throws:
        Exception - if an option is not supported
      • getOptions

        public String[] getOptions()
        Gets the current option settings for the OptionHandler.
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Overrides:
        getOptions in class weka.filters.Filter
        Returns:
        the list of current option settings as an array of strings
      • getDefaultAttRegExp

        protected adams.core.base.BaseRegExp getDefaultAttRegExp()
        Returns the default regular expression for identifying the attributes to process.
        Returns:
        the default
      • setAttRegExp

        public void setAttRegExp​(adams.core.base.BaseRegExp value)
        Sets the regular expression used for identifying the attributes to process.
        Parameters:
        value - the regexp
      • getAttRegExp

        public adams.core.base.BaseRegExp getAttRegExp()
        Returns the regular expression used for identifying the attributes to process.
        Returns:
        the regexp
      • attRegExpTipText

        public String attRegExpTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDefaultWaveNoRegExp

        protected adams.core.base.BaseRegExp getDefaultWaveNoRegExp()
        Returns the default regular expression for extracting the wave numbers.
        Returns:
        the default
      • setWaveNoRegExp

        public void setWaveNoRegExp​(adams.core.base.BaseRegExp value)
        Sets the regular expression used for extracting the wave number from the attribute name (using the first group).
        Parameters:
        value - the regexp
      • getWaveNoRegExp

        public adams.core.base.BaseRegExp getWaveNoRegExp()
        Returns the regular expression used for extracting the wave number from the attribute name (using the first group).
        Returns:
        the regexp
      • waveNoRegExpTipText

        public String waveNoRegExpTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDefaultCorrection

        protected AbstractDetrend getDefaultCorrection()
        Returns the default correction scheme.
        Returns:
        the default
      • setCorrection

        public void setCorrection​(AbstractDetrend value)
        Sets the correction scheme to apply.
        Parameters:
        value - the scheme
      • getCorrection

        public AbstractDetrend getCorrection()
        Returns the correction scheme to apply.
        Returns:
        the scheme
      • correctionTipText

        public String correctionTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getCapabilities

        public weka.core.Capabilities getCapabilities()
        Specified by:
        getCapabilities in interface weka.core.CapabilitiesHandler
        Overrides:
        getCapabilities in class weka.filters.Filter
      • reset

        protected void reset()
        Resets the filter.
        Overrides:
        reset in class weka.filters.SimpleFilter
      • 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
        See Also:
        SimpleBatchFilter.hasImmediateOutputFormat(), SimpleBatchFilter.batchFinished()
      • 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 testing this class.
        Parameters:
        args - should contain arguments to the filter: use -h for help