Class WekaFilterToReport

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.io.ModelFileHandler, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.ShallowCopySupporter<adams.data.filter.Filter>, adams.core.SizeOfHandler, adams.data.filter.Filter<Spectrum>, adams.flow.core.FlowContextHandler, adams.flow.core.ModelLoaderSupporter, Serializable, Comparable

    public class WekaFilterToReport
    extends adams.data.filter.AbstractFilter<Spectrum>
    implements adams.flow.core.FlowContextHandler, adams.flow.core.ModelLoaderSupporter
    Generates a Weka Instance using the specified instance generator. The Instance gets pushed through the prebuilt Weka filter that was loaded. The values of the matching attributes from the filtered data get transferred to the spectrum's report.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -no-id-update <boolean> (property: dontUpdateID)
        If enabled, suppresses updating the ID of adams.data.id.IDHandler data containers.
        default: false
     
    -generator <adams.data.instances.AbstractInstanceGenerator> (property: generator)
        The generator to use for turning spectra into weka.core.Instance objects.
        default: adams.data.instances.SimpleInstanceGenerator
     
    -model-loading-type <AUTO|FILE|SOURCE_ACTOR|STORAGE> (property: modelLoadingType)
        Determines how to load the model, in case of AUTO, first the model file
        is checked, then the callable actor and then the storage.
        default: AUTO
     
    -model <adams.core.io.PlaceholderFile> (property: modelFile)
        The file to load the model from, ignored if pointing to a directory.
        default: ${CWD}
     
    -model-actor <adams.flow.core.CallableActorReference> (property: modelActor)
        The callable actor (source) to obtain the model from, ignored if not present.
        default:
     
    -model-storage <adams.flow.control.StorageName> (property: modelStorage)
        The storage item to obtain the model from, ignored if not present.
        default: storage
     
    -prefix <java.lang.String> (property: prefix)
        The prefix to use for the report fields.
        default:
     
    -regexp <adams.core.base.BaseRegExp> (property: regExp)
        The regular expression that the Instance attribute names must match in order
        to get transferred into the report.
        default: .*
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class adams.data.filter.AbstractFilter

        adams.data.filter.AbstractFilter.FilterJob<T extends adams.data.container.DataContainer>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected weka.filters.Filter m_Filter
      the Weka filter.
      protected adams.flow.core.Actor m_FlowContext
      the flow context.
      protected adams.data.instances.AbstractInstanceGenerator m_Generator
      the instance generator to use.
      protected adams.flow.core.WekaFilterModelLoader m_ModelLoader
      the loader for the Weka filter.
      protected String m_Prefix
      the prefix for the report.
      protected adams.core.base.BaseRegExp m_RegExp
      the regular expression for the attribute names to transfer.
      • Fields inherited from class adams.data.filter.AbstractFilter

        m_DontUpdateID
      • 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 Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void defineOptions()
      Adds options to the internal list of options.
      String generatorTipText()
      Returns the tip text for this property.
      adams.flow.core.Actor getFlowContext()
      Returns the flow context.
      adams.data.instances.AbstractInstanceGenerator getGenerator()
      Returns the generator in use.
      adams.flow.core.CallableActorReference getModelActor()
      Returns the filter source actor.
      adams.core.io.PlaceholderFile getModelFile()
      Returns the file to load the model from.
      adams.flow.core.AbstractModelLoader.ModelLoadingType getModelLoadingType()
      Returns the loading type.
      adams.flow.control.StorageName getModelStorage()
      Returns the filter storage item.
      String getPrefix()
      Returns the prefix for the report fields.
      adams.core.base.BaseRegExp getRegExp()
      Returns the regular expression that the Instance attribute names must match in order to get transferred into the report.
      String globalInfo()
      Returns a string describing the object.
      protected void initialize()
      Initializes the members.
      String modelActorTipText()
      Returns the tip text for this property.
      String modelFileTipText()
      Returns the tip text for this property.
      String modelLoadingTypeTipText()
      Returns the tip text for this property.
      String modelStorageTipText()
      Returns the tip text for this property.
      String prefixTipText()
      Returns the tip text for this property.
      protected Spectrum processData​(Spectrum data)
      Performs the actual filtering.
      String regExpTipText()
      Returns the tip text for this property.
      void reset()
      Resets the scheme.
      void setFlowContext​(adams.flow.core.Actor value)
      Sets the flow context.
      void setGenerator​(adams.data.instances.AbstractInstanceGenerator value)
      Sets the generator to use.
      void setLoggingLevel​(adams.core.logging.LoggingLevel value)
      Sets the logging level.
      void setModelActor​(adams.flow.core.CallableActorReference value)
      Sets the filter source actor.
      void setModelFile​(adams.core.io.PlaceholderFile value)
      Sets the file to load the model from.
      void setModelLoadingType​(adams.flow.core.AbstractModelLoader.ModelLoadingType value)
      Sets the loading type.
      void setModelStorage​(adams.flow.control.StorageName value)
      Sets the filter storage item.
      void setPrefix​(String value)
      Sets the prefix for the report fields.
      void setRegExp​(adams.core.base.BaseRegExp value)
      Sets the regular expression that the Instance attribute names must match in order to get transferred into the report.
      • Methods inherited from class adams.data.filter.AbstractFilter

        checkData, cleanUp, compareTo, destroy, dontUpdateIDTipText, equals, filter, forCommandLine, getDontUpdateID, setDontUpdateID, shallowCopy, shallowCopy
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, 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
      • Methods inherited from interface adams.core.logging.LoggingSupporter

        getLogger, isLoggingEnabled
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager, toCommandLine
    • Field Detail

      • m_Generator

        protected adams.data.instances.AbstractInstanceGenerator m_Generator
        the instance generator to use.
      • m_ModelLoader

        protected adams.flow.core.WekaFilterModelLoader m_ModelLoader
        the loader for the Weka filter.
      • m_Filter

        protected weka.filters.Filter m_Filter
        the Weka filter.
      • m_Prefix

        protected String m_Prefix
        the prefix for the report.
      • m_RegExp

        protected adams.core.base.BaseRegExp m_RegExp
        the regular expression for the attribute names to transfer.
      • m_FlowContext

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

      • WekaFilterToReport

        public WekaFilterToReport()
    • 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.filter.AbstractFilter<Spectrum>
      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class adams.core.option.AbstractOptionHandler
      • reset

        public void reset()
        Resets the scheme.
        Specified by:
        reset in interface adams.data.filter.Filter<Spectrum>
        Overrides:
        reset in class adams.data.filter.AbstractFilter<Spectrum>
      • 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
      • setLoggingLevel

        public void setLoggingLevel​(adams.core.logging.LoggingLevel value)
        Sets the logging level.
        Specified by:
        setLoggingLevel in interface adams.core.logging.LoggingLevelHandler
        Overrides:
        setLoggingLevel in class adams.core.option.AbstractOptionHandler
        Parameters:
        value - the level
      • setGenerator

        public void setGenerator​(adams.data.instances.AbstractInstanceGenerator value)
        Sets the generator to use.
        Parameters:
        value - the generator
      • getGenerator

        public adams.data.instances.AbstractInstanceGenerator getGenerator()
        Returns the generator in use.
        Returns:
        the generator
      • generatorTipText

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

        public void setModelLoadingType​(adams.flow.core.AbstractModelLoader.ModelLoadingType value)
        Sets the loading type. In case of AbstractModelLoader.ModelLoadingType.AUTO, first file, then callable actor, then storage.
        Specified by:
        setModelLoadingType in interface adams.flow.core.ModelLoaderSupporter
        Parameters:
        value - the type
      • getModelLoadingType

        public adams.flow.core.AbstractModelLoader.ModelLoadingType getModelLoadingType()
        Returns the loading type. In case of AbstractModelLoader.ModelLoadingType.AUTO, first file, then callable actor, then storage.
        Specified by:
        getModelLoadingType in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        the type
      • modelLoadingTypeTipText

        public String modelLoadingTypeTipText()
        Returns the tip text for this property.
        Specified by:
        modelLoadingTypeTipText in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setModelFile

        public void setModelFile​(adams.core.io.PlaceholderFile value)
        Sets the file to load the model from.
        Specified by:
        setModelFile in interface adams.core.io.ModelFileHandler
        Specified by:
        setModelFile in interface adams.flow.core.ModelLoaderSupporter
        Parameters:
        value - the model file
      • getModelFile

        public adams.core.io.PlaceholderFile getModelFile()
        Returns the file to load the model from.
        Specified by:
        getModelFile in interface adams.core.io.ModelFileHandler
        Specified by:
        getModelFile in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        the model file
      • modelFileTipText

        public String modelFileTipText()
        Returns the tip text for this property.
        Specified by:
        modelFileTipText in interface adams.core.io.ModelFileHandler
        Specified by:
        modelFileTipText in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setModelActor

        public void setModelActor​(adams.flow.core.CallableActorReference value)
        Sets the filter source actor.
        Specified by:
        setModelActor in interface adams.flow.core.ModelLoaderSupporter
        Parameters:
        value - the source
      • getModelActor

        public adams.flow.core.CallableActorReference getModelActor()
        Returns the filter source actor.
        Specified by:
        getModelActor in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        the source
      • modelActorTipText

        public String modelActorTipText()
        Returns the tip text for this property.
        Specified by:
        modelActorTipText in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setModelStorage

        public void setModelStorage​(adams.flow.control.StorageName value)
        Sets the filter storage item.
        Specified by:
        setModelStorage in interface adams.flow.core.ModelLoaderSupporter
        Parameters:
        value - the storage item
      • getModelStorage

        public adams.flow.control.StorageName getModelStorage()
        Returns the filter storage item.
        Specified by:
        getModelStorage in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        the storage item
      • modelStorageTipText

        public String modelStorageTipText()
        Returns the tip text for this property.
        Specified by:
        modelStorageTipText in interface adams.flow.core.ModelLoaderSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPrefix

        public void setPrefix​(String value)
        Sets the prefix for the report fields.
        Parameters:
        value - the prefix
      • getPrefix

        public String getPrefix()
        Returns the prefix for the report fields.
        Returns:
        the prefix
      • prefixTipText

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

        public void setRegExp​(adams.core.base.BaseRegExp value)
        Sets the regular expression that the Instance attribute names must match in order to get transferred into the report.
        Parameters:
        value - the expression
      • getRegExp

        public adams.core.base.BaseRegExp getRegExp()
        Returns the regular expression that the Instance attribute names must match in order to get transferred into the report.
        Returns:
        the expression
      • regExpTipText

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

        protected Spectrum processData​(Spectrum data)
        Performs the actual filtering.
        Specified by:
        processData in class adams.data.filter.AbstractFilter<Spectrum>
        Parameters:
        data - the data to filter
        Returns:
        the filtered data