Class AbstractPostProcessor

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, Serializable, Comparable
    Direct Known Subclasses:
    AbstractSerializablePostProcessor, PredictionErrorIQR

    public abstract class AbstractPostProcessor
    extends adams.core.option.AbstractOptionHandler
    implements Comparable, adams.core.CleanUpHandler, adams.flow.core.FlowContextHandler
    Abstract base class for postprocessing weka.core.Instances objects.
    Version:
    $Revision: 2242 $
    Author:
    dale (dale at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.flow.core.Actor m_FlowContext
      the flow context.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

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

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Object o)
      Compares this object with the specified object for order.
      boolean equals​(Object o)
      Returns whether the two objects are the same.
      static AbstractPostProcessor forCommandLine​(String cmdline)
      Instantiates the processor from the given commandline (i.e., classname and optional options).
      static AbstractPostProcessor forName​(String classname, String[] options)
      Instantiates the processor with the given options.
      static String[] getEvaluators()
      Returns a list with classnames of processors.
      adams.flow.core.Actor getFlowContext()
      Returns the flow context.
      protected abstract weka.core.Instance performPostProcess​(weka.core.Instance data)
      Performs the actual postprocessing.
      protected abstract weka.core.Instances performPostProcess​(weka.core.Instances data)
      Performs the actual postprocessing.
      weka.core.Instance postProcess​(weka.core.Instance data)
      Performs the processing.
      weka.core.Instances postProcess​(weka.core.Instances data)
      Performs the processing.
      protected void preCheck​(weka.core.Instance data)
      Performs some pre-checks whether the data is actually suitable.
      protected void preCheck​(weka.core.Instances data)
      Performs some pre-checks whether the data is actually suitable.
      void setFlowContext​(adams.flow.core.Actor value)
      Sets the flow context.
      AbstractPostProcessor shallowCopy()
      Returns a shallow copy of itself, i.e., based on the commandline options.
      AbstractPostProcessor shallowCopy​(boolean expand)
      Returns a shallow copy of itself, i.e., based on the commandline options.
      • Methods inherited from class adams.core.option.AbstractOptionHandler

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

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

        cleanUp
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_FlowContext

        protected transient adams.flow.core.Actor m_FlowContext
        the flow context.
    • Constructor Detail

      • AbstractPostProcessor

        public AbstractPostProcessor()
    • Method Detail

      • setFlowContext

        public void setFlowContext​(adams.flow.core.Actor value)
        Sets the flow context.
        Specified by:
        setFlowContext in interface adams.flow.core.FlowContextHandler
        Parameters:
        value - the context
      • getFlowContext

        public adams.flow.core.Actor getFlowContext()
        Returns the flow context.
        Specified by:
        getFlowContext in interface adams.flow.core.FlowContextHandler
        Returns:
        the context, null if not available
      • preCheck

        protected void preCheck​(weka.core.Instances data)
        Performs some pre-checks whether the data is actually suitable.
        Parameters:
        data - the dataset to check
      • performPostProcess

        protected abstract weka.core.Instances performPostProcess​(weka.core.Instances data)
        Performs the actual postprocessing.
        Parameters:
        data - the dataset to process
        Returns:
        the processed dataset
      • postProcess

        public weka.core.Instances postProcess​(weka.core.Instances data)
        Performs the processing.
        Parameters:
        data - the dataset to postprocess
        Returns:
        the processed dataset
      • preCheck

        protected void preCheck​(weka.core.Instance data)
        Performs some pre-checks whether the data is actually suitable.
        Parameters:
        data - the instance to check
      • performPostProcess

        protected abstract weka.core.Instance performPostProcess​(weka.core.Instance data)
        Performs the actual postprocessing.
        Parameters:
        data - the instance to process
        Returns:
        the processed instance
      • postProcess

        public weka.core.Instance postProcess​(weka.core.Instance data)
        Performs the processing.
        Parameters:
        data - the instance to postprocess
        Returns:
        the processed instance
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

        Only compares the commandlines of the two objects.
        Specified by:
        compareTo in interface Comparable
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Returns whether the two objects are the same.

        Only compares the commandlines of the two objects.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the object is the same as this one
      • shallowCopy

        public AbstractPostProcessor shallowCopy()
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Returns:
        the shallow copy
      • shallowCopy

        public AbstractPostProcessor shallowCopy​(boolean expand)
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Parameters:
        expand - whether to expand variables to their current values
        Returns:
        the shallow copy
      • getEvaluators

        public static String[] getEvaluators()
        Returns a list with classnames of processors.
        Returns:
        the processor classnames
      • forName

        public static AbstractPostProcessor forName​(String classname,
                                                    String[] options)
        Instantiates the processor with the given options.
        Parameters:
        classname - the classname of the processor to instantiate
        options - the options for the processor
        Returns:
        the instantiated processor or null if an error occurred
      • forCommandLine

        public static AbstractPostProcessor forCommandLine​(String cmdline)
        Instantiates the processor from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the processor to instantiate
        Returns:
        the instantiated processor or null if an error occurred