Class SwapPLS

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.ShallowCopySupporter<adams.data.conversion.AbstractConversion>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.data.conversion.Conversion, adams.data.InPlaceProcessing, Serializable

    public class SwapPLS
    extends adams.data.conversion.AbstractSwapObject
    Swaps one PLS filter for another.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -no-copy <boolean> (property: noCopy)
        If enabled, no copy of the object is created before swapping.
        default: false
     
    -old-filter <weka.filters.Filter> (property: oldFilter)
        The old PLS filter to replace.
        default: weka.filters.supervised.attribute.PLSFilter -C 20 -M -A PLS1 -P center
     
    -exact-match <boolean> (property: exactMatch)
        If enabled, then the complete command-line is used for comparison rather
        than just the class name.
        default: false
     
    -new-filter <weka.filters.Filter> (property: newFilter)
        The new PLS filter to replace with.
        default: weka.filters.supervised.attribute.PLS -algorithm adams.data.instancesanalysis.pls.PLS1
     
    -keep-num-components <boolean> (property: keepNumComponents)
        If enabled, then the 'number of components' of the old filter are retained.
        default: true
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class adams.data.conversion.AbstractSwapObject

        adams.data.conversion.AbstractSwapObject.SwapObserver
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean m_ExactMatch
      whether to use an exact match (incl options) or just the class name.
      protected boolean m_KeepNumComponents
      whether to migrate the number of components.
      protected weka.filters.Filter m_NewFilter
      the new PLS filter.
      protected weka.filters.Filter m_OldFilter
      the old PLS filter.
      protected String m_OldFilterCommandLine
      the command-line of the old filter.
      • Fields inherited from class adams.data.conversion.AbstractSwapObject

        m_NoCopy, m_Traversal
      • Fields inherited from class adams.data.conversion.AbstractConversion

        m_Input, m_Output, m_Owner, m_Stopped
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Constructor Summary

      Constructors 
      Constructor Description
      SwapPLS()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canSwap​(adams.core.discovery.PropertyPath.Path path, PropertyDescriptor desc, Object parent, Object child)
      Checks whether a swap can be made.
      void defineOptions()
      Adds options to the internal list of options.
      String exactMatchTipText()
      Returns the tip text for this property.
      boolean getExactMatch()
      Returns whether to use the complete command-line for comparison rather than just the class name.
      boolean getKeepNumComponents()
      Returns whether the 'number of components' of the old filter are retained.
      weka.filters.Filter getNewFilter()
      Returns the new PLS filter to replace with.
      protected int getNumComponents​(Object filter)
      Retrieves the number of components from the filter.
      weka.filters.Filter getOldFilter()
      Returns the old PLS filter to replace.
      String getQuickInfo()
      Returns a quick info about the object, which can be displayed in the GUI.
      String globalInfo()
      Returns a string describing the object.
      protected boolean isPLSFilter​(weka.filters.Filter filter)
      Checks whether the filter is an actual PLS filter.
      String keepNumComponentsTipText()
      Returns the tip text for this property.
      String newFilterTipText()
      Returns the tip text for this property.
      String oldFilterTipText()
      Returns the tip text for this property.
      protected boolean performSwap​(adams.core.discovery.PropertyPath.Path path, PropertyDescriptor desc, Object parent, Object child)
      Performs the swap.
      protected void reset()
      Resets the scheme.
      void setExactMatch​(boolean value)
      Sets whether to use the complete command-line for comparison rather than just the class name.
      void setKeepNumComponents​(boolean value)
      Sets whether the 'number of components' of the old filter are retained.
      void setNewFilter​(weka.filters.Filter value)
      Sets the new PLS filter to replace with.
      protected boolean setNumComponents​(Object filter, int numComponents)
      Sets the number of components in the filter.
      void setOldFilter​(weka.filters.Filter value)
      Sets the old PLS filter to replace.
      • Methods inherited from class adams.data.conversion.AbstractSwapObject

        accepts, doConvert, doConvert, generates, getNoCopy, noCopyTipText, setNoCopy
      • Methods inherited from class adams.data.conversion.AbstractConversion

        checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_OldFilter

        protected weka.filters.Filter m_OldFilter
        the old PLS filter.
      • m_ExactMatch

        protected boolean m_ExactMatch
        whether to use an exact match (incl options) or just the class name.
      • m_NewFilter

        protected weka.filters.Filter m_NewFilter
        the new PLS filter.
      • m_KeepNumComponents

        protected boolean m_KeepNumComponents
        whether to migrate the number of components.
      • m_OldFilterCommandLine

        protected transient String m_OldFilterCommandLine
        the command-line of the old filter.
    • Constructor Detail

      • SwapPLS

        public SwapPLS()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.data.conversion.AbstractSwapObject
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class adams.data.conversion.AbstractConversion
      • setOldFilter

        public void setOldFilter​(weka.filters.Filter value)
        Sets the old PLS filter to replace.
        Parameters:
        value - the old filter
      • getOldFilter

        public weka.filters.Filter getOldFilter()
        Returns the old PLS filter to replace.
        Returns:
        the old filter
      • oldFilterTipText

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

        public void setExactMatch​(boolean value)
        Sets whether to use the complete command-line for comparison rather than just the class name.
        Parameters:
        value - true if to use exact match
      • getExactMatch

        public boolean getExactMatch()
        Returns whether to use the complete command-line for comparison rather than just the class name.
        Returns:
        true if to use exact match
      • exactMatchTipText

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

        public void setNewFilter​(weka.filters.Filter value)
        Sets the new PLS filter to replace with.
        Parameters:
        value - the new filter
      • getNewFilter

        public weka.filters.Filter getNewFilter()
        Returns the new PLS filter to replace with.
        Returns:
        the new filter
      • newFilterTipText

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

        public void setKeepNumComponents​(boolean value)
        Sets whether the 'number of components' of the old filter are retained.
        Parameters:
        value - true if to keep
      • getKeepNumComponents

        public boolean getKeepNumComponents()
        Returns whether the 'number of components' of the old filter are retained.
        Returns:
        true if to keep
      • keepNumComponentsTipText

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

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class adams.data.conversion.AbstractConversion
        Returns:
        null if no info available, otherwise short string
      • isPLSFilter

        protected boolean isPLSFilter​(weka.filters.Filter filter)
        Checks whether the filter is an actual PLS filter.
        Parameters:
        filter - the filter to check
        Returns:
        true if PLS filter
      • getNumComponents

        protected int getNumComponents​(Object filter)
        Retrieves the number of components from the filter.
        Parameters:
        filter - the filter to get the number of components from
        Returns:
        the number of components, -1 if failed to retrieve
      • setNumComponents

        protected boolean setNumComponents​(Object filter,
                                           int numComponents)
        Sets the number of components in the filter.
        Parameters:
        filter - the filter to update
        numComponents - the number of components to set
        Returns:
        true if successfully updated
      • canSwap

        protected boolean canSwap​(adams.core.discovery.PropertyPath.Path path,
                                  PropertyDescriptor desc,
                                  Object parent,
                                  Object child)
        Checks whether a swap can be made.
        Specified by:
        canSwap in class adams.data.conversion.AbstractSwapObject
        Parameters:
        path - the current path
        desc - the property descriptor
        parent - the parent object to swap
        child - the child object to swap
        Returns:
        true if swap can be done
      • performSwap

        protected boolean performSwap​(adams.core.discovery.PropertyPath.Path path,
                                      PropertyDescriptor desc,
                                      Object parent,
                                      Object child)
        Performs the swap.
        Specified by:
        performSwap in class adams.data.conversion.AbstractSwapObject
        Parameters:
        path - the current path
        desc - the property descriptor
        parent - the parent object to swap
        child - the child object to swap
        Returns:
        true if swap was successful