Class WekaClassifying

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

    public class WekaClassifying
    extends AbstractProcessWekaInstanceWithModel<weka.classifiers.Classifier>
    Uses a serialized model to perform predictions on the data being passed through.
    The following order is used to obtain the model (when using AUTO):
    1. model file present?
    2. source actor present?
    3. storage item present?

    Input/output:
    - accepts:
       weka.core.Instance
    - generates:
       adams.flow.container.WekaPredictionContainer
       weka.core.Instance


    Container information:
    - adams.flow.container.WekaPredictionContainer: Instance, Classification, Classification label, Distribution, Range check, Abstention classification, Abstention classification label, Abstention distribution

    -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: WekaClassifying
     
    -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
     
    -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
     
    -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
     
    -use-model-reset-variable <boolean> (property: useModelResetVariable)
        If enabled, chnages to the specified variable are monitored in order to
        reset the model, eg when a storage model changed.
        default: false
     
    -model-reset-variable <adams.core.VariableName> (property: modelResetVariable)
        The variable to monitor for changes in order to reset the model, eg when
        a storage model changed.
        default: variable
     
    -output-instance <boolean> (property: outputInstance)
        Whether to output weka.core.Instance objects or PredictionContainer objects.
        default: false
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_OutputInstance

        protected boolean m_OutputInstance
        whether to output weka.core.Instance objects or PredictionContainers.
    • Constructor Detail

      • WekaClassifying

        public WekaClassifying()
    • Method Detail

      • setOutputInstance

        public void setOutputInstance​(boolean value)
        Sets whether to output Instance objects instead of PredictionContainer ones.
        Parameters:
        value - if true then Instance objects are output
      • getOutputInstance

        public boolean getOutputInstance()
        Returns whether Instance objects are output instead of PredictionContainer ones.
        Returns:
        true if Instance objects are output
      • outputInstanceTipText

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

        protected Token processInstance​(weka.core.Instance inst)
                                 throws Exception
        Processes the instance and generates the output token.
        Specified by:
        processInstance in class AbstractProcessWekaInstanceWithModel<weka.classifiers.Classifier>
        Parameters:
        inst - the instance to process
        Returns:
        the generated output token (e.g., container)
        Throws:
        Exception - if processing fails