Class FastWavelet

  • 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 FastWavelet
    extends weka.filters.SimpleBatchFilter
    implements weka.core.TechnicalInformationHandler, weka.filters.UnsupervisedFilter
    A filter for wavelet transformation using the JSci library's fast wavelet transform (FWT) algorithms.

    For more information see:

    (2009). JSci - A science API for Java.

    BibTeX:
     @misc{missing_id,
        title = {JSci - A science API for Java},
        year = {2009},
        HTTP = {http://jsci.sourceforge.net/}
     }
     


    Valid options are:

     -D
      Turns on output of debugging information.
     -A <HAAR|CDF2_4|DAUBECHIES2|SYMMLET8>
      The algorithm to use.
      (default: HAAR)
     -P <ZERO>
      The padding to use.
      (default: ZERO)
     -F <filter specification>
      The filter to use as preprocessing step (classname and options).
      (default: MultiFilter with ReplaceMissingValues and Normalize)
     -inverse
      Whether to perform the inverse transform (from wavelet space into
      normal space again).
      (default: off)
     Options specific to filter weka.filters.MultiFilter ('-F'):
     
     -D
      Turns on output of debugging information.
     -F <classname [options]>
      A filter to apply (can be specified multiple times).
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ALGORITHM_CDF2_4
      the type of algorithm: CDF2 4.
      static int ALGORITHM_DAUBECHIES2
      the type of algorithm: Daubechies2.
      static int ALGORITHM_HAAR
      the type of algorithm: Haar.
      static int ALGORITHM_SYMMLET8
      the type of algorithm: Symmlet8.
      protected int m_Algorithm
      the type of algorithm.
      protected weka.filters.Filter m_Filter
      an optional filter for preprocessing of the data.
      protected boolean m_InverseTransform
      whether to perform inverse transformation.
      protected int m_Padding
      the type of padding.
      static int PADDING_ZERO
      the type of padding: Zero padding.
      static weka.core.Tag[] TAGS_ALGORITHM
      the types of algorithm.
      static weka.core.Tag[] TAGS_PADDING
      the types of padding.
      • 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
      FastWavelet()
      default constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String algorithmTipText()
      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.
      String filterTipText()
      Returns the tip text for this property.
      weka.core.SelectedTag getAlgorithm()
      Gets the type of algorithm to use.
      weka.core.Capabilities getCapabilities()
      Returns the Capabilities of this filter.
      weka.filters.Filter getFilter()
      Get the preprocessing filter.
      boolean getInverseTransform()
      Gets whether to use the inverse transform.
      String[] getOptions()
      returns the options of the current setup.
      weka.core.SelectedTag getPadding()
      Gets the type of Padding to use.
      String getRevision()
      Returns the revision string.
      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 classifier.
      protected weka.core.Instances inverse​(weka.core.Instances data)
      Renames the attributes when using the inverse transform.
      String inverseTransformTipText()
      Returns the tip text for this property.
      Enumeration listOptions()
      Gets an enumeration describing the available options.
      static void main​(String[] args)
      runs the filter with the given arguments.
      protected static int nextPowerOf2​(int n)
      returns the next bigger number that's a power of 2.
      protected weka.core.Instances pad​(weka.core.Instances data)
      pads the data to conform to the necessary number of attributes.
      String paddingTipText()
      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.
      protected weka.core.Instances processData​(weka.core.Instances instances)
      processes the instances using the HAAR/JSci algorithm.
      void setAlgorithm​(weka.core.SelectedTag value)
      Sets the type of algorithm to use.
      void setFilter​(weka.filters.Filter value)
      Set the preprocessing filter (only used for setup).
      void setInverseTransform​(boolean value)
      Sets whether to use the inverse tranform.
      void setOptions​(String[] options)
      Parses the options for this object.
      void setPadding​(weka.core.SelectedTag value)
      Sets the type of Padding to use.
      • Methods inherited from class weka.filters.SimpleBatchFilter

        allowAccessToFullInputFormat, batchFinished, hasImmediateOutputFormat, input, 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, getCopyOfInputFormat, 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

      • ALGORITHM_HAAR

        public static final int ALGORITHM_HAAR
        the type of algorithm: Haar.
        See Also:
        Constant Field Values
      • ALGORITHM_CDF2_4

        public static final int ALGORITHM_CDF2_4
        the type of algorithm: CDF2 4.
        See Also:
        Constant Field Values
      • ALGORITHM_DAUBECHIES2

        public static final int ALGORITHM_DAUBECHIES2
        the type of algorithm: Daubechies2.
        See Also:
        Constant Field Values
      • ALGORITHM_SYMMLET8

        public static final int ALGORITHM_SYMMLET8
        the type of algorithm: Symmlet8.
        See Also:
        Constant Field Values
      • TAGS_ALGORITHM

        public static final weka.core.Tag[] TAGS_ALGORITHM
        the types of algorithm.
      • PADDING_ZERO

        public static final int PADDING_ZERO
        the type of padding: Zero padding.
        See Also:
        Constant Field Values
      • TAGS_PADDING

        public static final weka.core.Tag[] TAGS_PADDING
        the types of padding.
      • m_Filter

        protected weka.filters.Filter m_Filter
        an optional filter for preprocessing of the data.
      • m_Algorithm

        protected int m_Algorithm
        the type of algorithm.
      • m_Padding

        protected int m_Padding
        the type of padding.
      • m_InverseTransform

        protected boolean m_InverseTransform
        whether to perform inverse transformation.
    • Constructor Detail

      • FastWavelet

        public FastWavelet()
        default constructor.
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing this classifier.
        Specified by:
        globalInfo in class weka.filters.SimpleFilter
        Returns:
        a description of the classifier 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()
        Gets 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.
      • getOptions

        public String[] getOptions()
        returns the options of the current setup.
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Overrides:
        getOptions in class weka.filters.Filter
        Returns:
        the current options
      • setOptions

        public void setOptions​(String[] options)
                        throws Exception
        Parses the options for this object.

        Valid options are:

         -D
          Turns on output of debugging information.
         -A <HAAR|CDF2_4|DAUBECHIES2|SYMMLET8>
          The algorithm to use.
          (default: HAAR)
         -P <ZERO>
          The padding to use.
          (default: ZERO)
         -F <filter specification>
          The filter to use as preprocessing step (classname and options).
          (default: MultiFilter with ReplaceMissingValues and Normalize)
         -inverse
          Whether to perform the inverse transform (from wavelet space into
          normal space again).
          (default: off)
         Options specific to filter weka.filters.MultiFilter ('-F'):
         
         -D
          Turns on output of debugging information.
         -F <classname [options]>
          A filter to apply (can be specified multiple times).
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Overrides:
        setOptions in class weka.filters.Filter
        Parameters:
        options - the options to use
        Throws:
        Exception - if the option setting fails
      • filterTipText

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

        public void setFilter​(weka.filters.Filter value)
        Set the preprocessing filter (only used for setup).
        Parameters:
        value - the preprocessing filter.
      • getFilter

        public weka.filters.Filter getFilter()
        Get the preprocessing filter.
        Returns:
        the preprocessing filter
      • algorithmTipText

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

        public void setAlgorithm​(weka.core.SelectedTag value)
        Sets the type of algorithm to use.
        Parameters:
        value - the algorithm type
      • getAlgorithm

        public weka.core.SelectedTag getAlgorithm()
        Gets the type of algorithm to use.
        Returns:
        the current algorithm type.
      • paddingTipText

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

        public void setPadding​(weka.core.SelectedTag value)
        Sets the type of Padding to use.
        Parameters:
        value - the Padding type
      • getPadding

        public weka.core.SelectedTag getPadding()
        Gets the type of Padding to use.
        Returns:
        the current Padding type.
      • inverseTransformTipText

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

        public void setInverseTransform​(boolean value)
        Sets whether to use the inverse tranform.
        Parameters:
        value - true if to use inverse transform
      • getInverseTransform

        public boolean getInverseTransform()
        Gets whether to use the inverse transform.
        Returns:
        true if inverse transform is used
      • nextPowerOf2

        protected static int nextPowerOf2​(int n)
        returns the next bigger number that's a power of 2. If the number is already a power of 2 then this will be returned. The number will be at least 2^2..
        Parameters:
        n - the number to start from
        Returns:
        the next bigger number
      • pad

        protected weka.core.Instances pad​(weka.core.Instances data)
        pads the data to conform to the necessary number of attributes.
        Parameters:
        data - the data to pad
        Returns:
        the padded data
      • inverse

        protected weka.core.Instances inverse​(weka.core.Instances data)
        Renames the attributes when using the inverse transform.
        Parameters:
        data - the data to transform.
        Returns:
        the transformed data
      • 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()
      • processData

        protected weka.core.Instances processData​(weka.core.Instances instances)
                                           throws Exception
        processes the instances using the HAAR/JSci algorithm.
        Parameters:
        instances - the data to process
        Returns:
        the modified data
        Throws:
        Exception - in case the processing goes wrong
        See Also:
        FastHaar
      • 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
      • 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)
        runs the filter with the given arguments.
        Parameters:
        args - the commandline arguments