Class WekaInstanceBuffer

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, VariableMonitor, Serializable, Comparable

    public class WekaInstanceBuffer
    extends AbstractTransformer
    implements VariableMonitor
    Can act in two different ways:
    1. Instance -> Instances (row -> dataset)
    Buffers weka.core.Instance objects and outputs a weka.core.Instances object, whenever the interval condition has been met.
    2. Instances -> Instance (dataset -> row)
    Outputs all the weka.core.Instance objects that the incoming weka.core.Instances object contains.

    Input/output:
    - accepts:
       weka.core.Instance
       weka.core.Instance[]
    - generates:
       weka.core.Instances


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: WekaInstanceBuffer
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default:
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
     
    -operation <INSTANCES_TO_INSTANCE|INSTANCE_TO_INSTANCES> (property: operation)
        The way the buffer operates, 'dataset -> row' or 'row -> dataset'.
        default: INSTANCE_TO_INSTANCES
     
    -check <boolean> (property: checkHeader)
        Whether to check the headers - if the headers change, the Instance object
        gets dumped into a new file (in case of INSTANCE_TO_INSTANCES).
        default: false
     
    -interval <int> (property: interval)
        The interval at which to output the Instances object (in case of INSTANCE_TO_INSTANCES
        ).
        default: 1
        minimum: 1
     
    -clear-buffer <boolean> (property: clearBuffer)
        Whether to clear the buffer once the dataset has been forwarded (in case
        of INSTANCE_TO_INSTANCES).
        default: false
     
    -var-name <adams.core.VariableName> (property: variableName)
        The variable to monitor.
        default: variable
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • BACKUP_BUFFER

        public static final String BACKUP_BUFFER
        the key for storing the current buffer in the backup.
        See Also:
        Constant Field Values
      • BACKUP_ITERATOR

        public static final String BACKUP_ITERATOR
        the key for storing the current iterator in the backup.
        See Also:
        Constant Field Values
      • m_Buffer

        protected weka.core.Instances m_Buffer
        the currently buffered data.
      • m_Iterator

        protected Iterator<weka.core.Instance> m_Iterator
        the iterator for broadcasting Instance objects.
      • m_CheckHeader

        protected boolean m_CheckHeader
        whether to check the header.
      • m_Interval

        protected int m_Interval
        the interval of when to output the Instances object.
      • m_ClearBuffer

        protected boolean m_ClearBuffer
        whether to clear the buffer once it has been forwarded.
      • m_VariableName

        protected VariableName m_VariableName
        the variable to listen to.
      • m_ClearBufferRequired

        protected boolean m_ClearBufferRequired
        whether variable triggered clear of buffer.
    • Constructor Detail

      • WekaInstanceBuffer

        public WekaInstanceBuffer()
    • Method Detail

      • setOperation

        public void setOperation​(WekaInstanceBuffer.Operation value)
        Sets the way the buffer operates.
        Parameters:
        value - the operation
      • operationTipText

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

        public void setCheckHeader​(boolean value)
        Sets whether to check the header or not.
        Parameters:
        value - if true then the headers get checked
      • getCheckHeader

        public boolean getCheckHeader()
        Returns whether the header gets checked or not.
        Returns:
        true if the header gets checked
      • checkHeaderTipText

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

        public void setInterval​(int value)
        Sets the interval for outputting the Instances objects.
        Parameters:
        value - the interval
      • getInterval

        public int getInterval()
        Returns the interval for outputting the Instances objects.
        Returns:
        the interval
      • intervalTipText

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

        public void setClearBuffer​(boolean value)
        Sets whether to clear the buffer once the dataset has been forwarded.
        Parameters:
        value - true if to clear buffer
      • getClearBuffer

        public boolean getClearBuffer()
        Returns whether to clear the buffer once the dataset has been forwarded.
        Returns:
        true if to clear buffer
      • clearBufferTipText

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

        public String variableNameTipText()
        Returns the tip text for this property.
        Specified by:
        variableNameTipText in interface VariableMonitor
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        weka.core.Instance.class, weka.core.Instance[].class
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        Returns:
        weka.core.Instances.class
      • reset

        protected void reset()
        Resets the scheme.
        Overrides:
        reset in class AbstractActor
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message