Class WekaForecasting

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

    public class WekaForecasting
    extends AbstractSimpleSource
    implements ModelFileHandler, DynamicInitializer
    Uses a serialized model to perform predictions on the data being passed through.
    The model can also be obtained from a callable actor, if the model file is pointing to a directory.

    Input/output:
    - generates:
       adams.flow.container.WekaForecastContainer


    Container information:
    - adams.flow.container.WekaForecastContainer: Model, Forecasts

    -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: WekaForecasting
     
    -annotation <adams.core.base.BaseText> (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 gets stopped in case this actor encounters an error;
         useful for critical actors.
        default: false
     
    -model <adams.core.io.PlaceholderFile> (property: modelFile)
        The model file to load (when not pointing to a directory).
        default: ${CWD}
     
    -model-actor <adams.flow.core.CallableActorReference> (property: modelActor)
        The callable actor to use for obtaining the model in case serialized model 
        file points to a directory; can be a adams.flow.container.WekaModelContainer 
        or a weka.classifiers.timeseries.AbstractForecaster.
        default: 
     
    -on-the-fly <boolean> (property: onTheFly)
        If set to true, the model file is not required to be present at set up time 
        (eg if built on the fly), only at execution time.
        default: false
     
    -num-steps <int> (property: numSteps)
        The number of steps to forecast.
        default: 1
        minimum: 1
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ModelFile

        protected PlaceholderFile m_ModelFile
        the serialized model to load.
      • m_Model

        protected weka.classifiers.timeseries.AbstractForecaster m_Model
        the model that was loaded from the model file.
      • m_OnTheFly

        protected boolean m_OnTheFly
        whether the model gets built on the fly and might not be present at the start.
      • m_NumSteps

        protected int m_NumSteps
        the number of steps to forecast.
    • Constructor Detail

      • WekaForecasting

        public WekaForecasting()
    • Method Detail

      • modelFileTipText

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

        public void setModelActor​(CallableActorReference value)
        Sets the callable actor to obtain the model from if model file is pointing to a directory.
        Parameters:
        value - the actor reference
      • getModelActor

        public CallableActorReference getModelActor()
        Returns the callable actor to obtain the model from if model file is pointing to a directory.
        Returns:
        the actor reference
      • modelActorTipText

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

        public void setOnTheFly​(boolean value)
        Sets whether the model file gets built on the fly and might not be present at start up time.
        Specified by:
        setOnTheFly in interface DynamicInitializer
        Parameters:
        value - if true then the model does not have to be present at start up time
      • getOnTheFly

        public boolean getOnTheFly()
        Returns whether the model file gets built on the fly and might not be present at start up time.
        Specified by:
        getOnTheFly in interface DynamicInitializer
        Returns:
        true if the model is not necessarily present at start up time
      • onTheFlyTipText

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

        public void setNumSteps​(int value)
        Sets the number of steps to forecast.
        Parameters:
        value - the steps
      • getNumSteps

        public int getNumSteps()
        Returns the number of steps to forecast.
        Returns:
        the steps
      • numStepsTipText

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

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        Returns:
        adams.flow.container.WekaForecastContainer.class
      • setUpModel

        protected String setUpModel()
        Loads the model from the model file.
        Returns:
        null if everything worked, otherwise an error message
      • doExecute

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