Class RangeBasedSavitzkyGolay

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

    public class RangeBasedSavitzkyGolay
    extends weka.filters.SimpleBatchFilter
    implements weka.core.TechnicalInformationHandler, weka.filters.UnsupervisedFilter
    Configures a weka.filters.unsupervised.attribute.PartitionedMultiFilter, using the supplied ranges and the number of points to configure the weka.filters.unsupervised.attribute.SavitzkyGolay2 filter to apply to that subset.

    BibTeX:

     @article{Savitzky1964,
        author = {A. Savitzky and Marcel J.E. Golay},
        journal = {Analytical Chemistry},
        pages = {1627-1639},
        title = {Smoothing and Differentiation of Data by Simplified Least Squares Procedures},
        volume = {36},
        year = {1964},
        HTTP = {http://dx.doi.org/10.1021/ac60214a047}
     }
     
     @inbook{Press1992,
        author = {William H. Press and Saul A. Teukolsky and William T. Vetterling and Brian P. Flannery},
        chapter = {14.8},
        edition = {Second},
        pages = {650-655},
        publisher = {Cambridge University Press},
        series = {Numerical Recipes in C},
        title = {Savitzky-Golay Smoothing Filters},
        year = {1992},
        PDF = {http://www.nrbook.com/a/bookcpdf/c14-8.pdf}
     }
     

    Valid options are:

     -range <weka.filters.unsupervised.attribute.SavitzkyGolayRange + options>
      The range definition(s) (can be specified multiple times).
      (default: none)
     -U
      Flag for leaving unused attributes out of the output, by default
      these are included in the filter output.
     -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).
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected SpectrumFilter m_Filter
      the filter used internally.
      protected weka.core.Instances m_FirstPassData
      the filteed data from the first pass.
      protected SavitzkyGolayRange[] m_Ranges
      the ranges to use.
      protected boolean m_RemoveUnused
      Whether unused attributes are left out of the output.
      static String PREFIX_AMPLITUDE
      the prefix for a spectral attribute.
      • 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 Concrete Methods 
      Modifier and Type Method Description
      boolean allowAccessToFullInputFormat()  
      protected weka.core.Instances determineOutputFormat​(weka.core.Instances inputFormat)
      Determines the output format based on the input format and returns this.
      String[] getOptions()
      Gets the current settings of the filter.
      SavitzkyGolayRange[] getRanges()
      Returns the ranges to use.
      boolean getRemoveUnused()
      Gets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.
      weka.core.TechnicalInformation getTechnicalInformation()
      Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
      String globalInfo()
      Returns a string describing this filter.
      Enumeration listOptions()
      Returns an enumeration describing the available options.
      protected weka.core.Instances process​(weka.core.Instances instances)
      Processes the given data (may change the provided dataset) and returns the modified version.
      String rangesTipText()
      Returns the tip text for this property.
      String removeUnusedTipText()
      Returns the tip text for this property.
      protected void reset()
      resets the filter, i.e., m_NewBatch to true and m_FirstBatchDone to false.
      void setOptions​(String[] options)
      Parses a list of options for this object.
      void setRanges​(SavitzkyGolayRange[] value)
      Sets the ranges to use.
      void setRemoveUnused​(boolean value)
      Sets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.
      • Methods inherited from class weka.filters.SimpleBatchFilter

        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, getCapabilities, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, getRevision, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, main, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
    • Field Detail

      • m_RemoveUnused

        protected boolean m_RemoveUnused
        Whether unused attributes are left out of the output.
      • m_Filter

        protected SpectrumFilter m_Filter
        the filter used internally.
      • m_FirstPassData

        protected weka.core.Instances m_FirstPassData
        the filteed data from the first pass.
    • Constructor Detail

      • RangeBasedSavitzkyGolay

        public RangeBasedSavitzkyGolay()
    • 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
      • getTechnicalInformation

        public weka.core.TechnicalInformation getTechnicalInformation()
        Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
        Specified by:
        getTechnicalInformation in interface weka.core.TechnicalInformationHandler
        Returns:
        the technical information about this class
      • 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 a list of options for this object. Also resets the state of the filter (this reset doesn't affect the options).
        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
        See Also:
        reset()
      • getOptions

        public String[] getOptions()
        Gets the current settings of the filter.
        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
      • setRanges

        public void setRanges​(SavitzkyGolayRange[] value)
        Sets the ranges to use.
        Parameters:
        value - the ranges
      • getRanges

        public SavitzkyGolayRange[] getRanges()
        Returns the ranges to use.
        Returns:
        the ranges
      • rangesTipText

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

        public void setRemoveUnused​(boolean value)
        Sets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.
        Parameters:
        value - if true then the unused attributes get removed
      • getRemoveUnused

        public boolean getRemoveUnused()
        Gets whether unused attributes (ones that are not covered by any of the ranges) are removed from the output.
        Returns:
        true if unused attributes are removed
      • removeUnusedTipText

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

        protected void reset()
        resets the filter, i.e., m_NewBatch to true and m_FirstBatchDone to false.
        Overrides:
        reset in class weka.filters.SimpleFilter
      • allowAccessToFullInputFormat

        public boolean allowAccessToFullInputFormat()
        Overrides:
        allowAccessToFullInputFormat in class weka.filters.SimpleBatchFilter
      • 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