adams.flow.transformer
Class WekaInstanceEvaluator

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.flow.core.AbstractActor
              extended by adams.flow.transformer.AbstractTransformer
                  extended by adams.flow.transformer.WekaInstanceEvaluator
All Implemented Interfaces:
AdditionalInformationHandler, CleanUpHandler, Debuggable, DebugOutputHandler, Destroyable, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<AbstractActor>, SizeOfHandler, Stoppable, VariableChangeListener, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

public class WekaInstanceEvaluator
extends AbstractTransformer

Adds a new attribute to the data being passed through (normally 'evaluation') and sets the value to the evaluation value returned by the chosen evaluator scheme.

Input/output:
- accepts:
   weka.core.Instance
- generates:
   weka.core.Instance

Valid options are:

-D (property: debug)
    If set to true, scheme may output additional info to the console.
 
-name <java.lang.String> (property: name)
    The name of the actor.
    default: InstanceEvaluator
 
-annotation <adams.core.base.BaseText> (property: annotations)
    The annotations to attach to this actor.
    default:
 
-skip (property: skip)
    If set to true, transformation is skipped and the input token is just forwarded
    as it is.
 
-evaluator <adams.data.weka.evaluator.AbstractInstanceEvaluator [options]> (property: evaluator)
    The evaluator to use.
    default: adams.data.weka.evaluator.PassThrough
 
-instances <java.lang.String> (property: instancesActor)
    The name of the global actor from which to retrieve Instances in case of
    adams.data.weka.evaluator.AbstractDatasetInstanceEvaluator-derived classes,
    default:
 
Default options for adams.data.weka.evaluator.PassThrough (-evaluator/evaluator):
-D (property: debug)
    If set to true, scheme may output additional info to the console.
 

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
static String ATTRIBUTE_NAME
          the default name of the attribute with the evaluation value.
protected  String m_AttributeName
          the attribute name of the evaluation object.
protected  AbstractInstanceEvaluator m_Evaluator
          the evaluator to use.
protected  weka.filters.unsupervised.attribute.Add m_Filter
          the filter that is used for generating the new data format.
protected  GlobalSource m_GlobalSource
          the global actor to use.
protected  weka.core.Instances m_Header
          the new header.
protected  GlobalActorReference m_InstancesActor
          the global actor to get the Instances from in case of AbstractDatasetInstanceEvaluator.
 
Fields inherited from class adams.flow.transformer.AbstractTransformer
BACKUP_INPUT, BACKUP_OUTPUT, m_InputToken, m_OutputToken
 
Fields inherited from class adams.flow.core.AbstractActor
FILE_EXTENSION, FILE_EXTENSION_GZ, m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_FullName, m_Headless, m_Name, m_Parent, m_Root, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
WekaInstanceEvaluator()
           
 
Method Summary
 Class[] accepts()
          Returns the class that the consumer accepts.
 void defineOptions()
          Adds options to the internal list of options.
protected  String determineAttributeName(weka.core.Instances data)
          Determines the name of the evaluation attribute.
protected  String doExecute()
          Executes the flow item.
 String evaluatorTipText()
          Returns the tip text for this property.
protected  String generateHeader(weka.core.Instance inst)
          Generates the new header for the data.
 Class[] generates()
          Returns the class of objects that it generates.
 AbstractInstanceEvaluator getEvaluator()
          Returns the evaluator to use.
 GlobalActorReference getInstancesActor()
          Returns the global actor from which to retrieve Instances in case of AbstractDatasetInstanceEvaluator-derived evaluators.
 String getQuickInfo()
          Returns a quick info about the actor, which will be displayed in the GUI.
 String globalInfo()
          Returns a string describing the object.
 String instancesActorTipText()
          Returns the tip text for this property.
protected  void reset()
          Resets the actor.
 void setEvaluator(AbstractInstanceEvaluator value)
          Sets the evaluator to use.
 void setInstancesActor(GlobalActorReference value)
          Sets the global actor from which to retrieve Instances in case of AbstractDatasetInstanceEvaluator-derived evaluators.
 String setUp()
          Initializes the item for flow execution.
protected  String setUpEvaluator()
          Initializes the evaluator.
 void wrapUp()
          Cleans up after the execution has finished.
 
Methods inherited from class adams.flow.transformer.AbstractTransformer
backupState, execute, hasPendingOutput, input, output, postExecute, restoreState
 
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, debug, destroy, equals, findVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFullName, getName, getNextSibling, getParent, getPreviousSibling, getRoot, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, preExecute, pruneBackup, pruneBackup, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ATTRIBUTE_NAME

public static final String ATTRIBUTE_NAME
the default name of the attribute with the evaluation value.

See Also:
Constant Field Values

m_Evaluator

protected AbstractInstanceEvaluator m_Evaluator
the evaluator to use.


m_InstancesActor

protected GlobalActorReference m_InstancesActor
the global actor to get the Instances from in case of AbstractDatasetInstanceEvaluator.


m_Header

protected weka.core.Instances m_Header
the new header.


m_AttributeName

protected String m_AttributeName
the attribute name of the evaluation object.


m_GlobalSource

protected GlobalSource m_GlobalSource
the global actor to use.


m_Filter

protected weka.filters.unsupervised.attribute.Add m_Filter
the filter that is used for generating the new data format.

Constructor Detail

WekaInstanceEvaluator

public WekaInstanceEvaluator()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class 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 OptionHandler
Overrides:
defineOptions in class AbstractActor

reset

protected void reset()
Resets the actor.

Overrides:
reset in class AbstractTransformer

getQuickInfo

public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.

Specified by:
getQuickInfo in interface QuickInfoSupporter
Overrides:
getQuickInfo in class AbstractActor
Returns:
null if no info available, otherwise short string

setEvaluator

public void setEvaluator(AbstractInstanceEvaluator value)
Sets the evaluator to use.

Parameters:
value - the evaluator

getEvaluator

public AbstractInstanceEvaluator getEvaluator()
Returns the evaluator to use.

Returns:
the evaluator

evaluatorTipText

public String evaluatorTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setInstancesActor

public void setInstancesActor(GlobalActorReference value)
Sets the global actor from which to retrieve Instances in case of AbstractDatasetInstanceEvaluator-derived evaluators.

Parameters:
value - the name of the actor

getInstancesActor

public GlobalActorReference getInstancesActor()
Returns the global actor from which to retrieve Instances in case of AbstractDatasetInstanceEvaluator-derived evaluators.

Returns:
the name of the actor

instancesActorTipText

public String instancesActorTipText()
Returns the tip text for this property.

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.

Returns:
weka.core.Instance.class

generates

public Class[] generates()
Returns the class of objects that it generates.

Returns:
weka.core.Instance.class

setUp

public String setUp()
Initializes the item for flow execution.

Overrides:
setUp in class AbstractActor
Returns:
null if everything is fine, otherwise error message

determineAttributeName

protected String determineAttributeName(weka.core.Instances data)
Determines the name of the evaluation attribute.

Parameters:
data - the original input data
Returns:
the generated name
See Also:
m_AttributeName

setUpEvaluator

protected String setUpEvaluator()
Initializes the evaluator.

Returns:
null if everything is fine, otherwise error message
See Also:
m_Evaluator

generateHeader

protected String generateHeader(weka.core.Instance inst)
Generates the new header for the data.

Parameters:
inst - the instance to get the original data format from
Returns:
null if everything is fine, otherwise error message
See Also:
m_Header, m_Filter

doExecute

protected String doExecute()
Executes the flow item.

Specified by:
doExecute in class AbstractActor
Returns:
null if everything is fine, otherwise error message

wrapUp

public void wrapUp()
Cleans up after the execution has finished.

Overrides:
wrapUp in class AbstractTransformer


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.