gov.sandia.cognition.framework.learning
Class EvaluatorBasedCognitiveModule<InputType,OutputType>

java.lang.Object
  extended by gov.sandia.cognition.framework.concurrent.AbstractConcurrentCognitiveModule
      extended by gov.sandia.cognition.framework.learning.EvaluatorBasedCognitiveModule<InputType,OutputType>
Type Parameters:
InputType - Input type of the embedded Evaluator
OutputType - Output type of the embedded Evaluator
All Implemented Interfaces:
CognitiveModule, ConcurrentCognitiveModule, Serializable
Direct Known Subclasses:
StatefulEvaluatorBasedCognitiveModule

public class EvaluatorBasedCognitiveModule<InputType,OutputType>
extends AbstractConcurrentCognitiveModule

The EvaluatorBasedCognitiveModule implements a CognitiveModule that wraps an Evaluator object.

Since:
2.0
Author:
Justin Basilico, Kevin R. Dixon, Zachary Benz
See Also:
Serialized Form

Field Summary
static String DEFAULT_NAME
          Default name given to modules of this type
protected  InputType input
          A place to temporarily store the input read in by a call to readState; this temporary store is blown away as soon as it used by evaluate, because we NEVER retain state interally across module update cycles
protected  OutputType output
          A place to temporarily store the output generated by a call to evaluate; this temporary store is blown away as soon as it used by evaluate, because we NEVER retain state interally across module update cycles
 
Constructor Summary
EvaluatorBasedCognitiveModule(CognitiveModel model, EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings, String name)
          Creates a new instance of EvaluatorBasedCognitiveModule.
 
Method Summary
 void evaluate()
          Perform evaluation of sampled and held input state information that was captured by a call to readState, and hold the resultant output changes to model and module state pending a call to writeState NOTE: input and output state is held temporarily for the sole purpose of supporting concurrency of module evaluation; state is NEVER retained locally across module update cycles
 Evaluator<? super InputType,? extends OutputType> getEvaluator()
          Gets the underlying evaluator that is being wrapped in this module.
 CogxelConverter<InputType> getInputConverter()
          Gets the input converter that is used to map from Cogxels to the InputType.
 String getName()
          Gets the human-readable name of module.
 CogxelConverter<OutputType> getOutputConverter()
          Gets the output converter that is used to map from the OutputType to Cogxels.
 EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> getSettings()
          Gets the settings for the module, which can be used to create another instantation of a module.
 CognitiveModuleState initializeState(CognitiveModelState modelState)
          This method initializes the state object for a CognitiveModel by adding any necessary information to the model state and returining the default state for the module.
 void readState(CognitiveModelState modelState, CognitiveModuleState previousModuleState)
          Read in and temporarily hold input state information required for performing module evaluation.
 void setName(String name)
          Sets the name of the module
protected  void setSettings(EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings)
          Sets the settings of the module.
 CognitiveModuleState writeState(CognitiveModelState modelState)
          Write out the model and module state changes resulting from a call to evaluate NOTE: output state was held temporarily for the sole purpose of supporting concurrency of module evaluation; state is NEVER retained locally across module update cycles
 
Methods inherited from class gov.sandia.cognition.framework.concurrent.AbstractConcurrentCognitiveModule
update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

input

protected InputType input
A place to temporarily store the input read in by a call to readState; this temporary store is blown away as soon as it used by evaluate, because we NEVER retain state interally across module update cycles


output

protected OutputType output
A place to temporarily store the output generated by a call to evaluate; this temporary store is blown away as soon as it used by evaluate, because we NEVER retain state interally across module update cycles


DEFAULT_NAME

public static final String DEFAULT_NAME
Default name given to modules of this type

See Also:
Constant Field Values
Constructor Detail

EvaluatorBasedCognitiveModule

public EvaluatorBasedCognitiveModule(CognitiveModel model,
                                     EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings,
                                     String name)
Creates a new instance of EvaluatorBasedCognitiveModule.

Parameters:
model - The model to create the module for.
settings - The settings of the module.
name - High-level name of this module
Method Detail

initializeState

public CognitiveModuleState initializeState(CognitiveModelState modelState)
This method initializes the state object for a CognitiveModel by adding any necessary information to the model state and returining the default state for the module.

Parameters:
modelState - The CognitiveModelState to initalize
Returns:
The initial state of the CognitiveModule

readState

public void readState(CognitiveModelState modelState,
                      CognitiveModuleState previousModuleState)
Read in and temporarily hold input state information required for performing module evaluation. NOTE: input state is held temporarily for the sole purpose of supporting concurrency of module evaluation; state is NEVER retained locally across module update cycles

Parameters:
modelState - The CognitiveModelState to evaluate with
previousModuleState - The previous CognitiveModuleState returned by this module
Since:
2.0

evaluate

public void evaluate()
Perform evaluation of sampled and held input state information that was captured by a call to readState, and hold the resultant output changes to model and module state pending a call to writeState NOTE: input and output state is held temporarily for the sole purpose of supporting concurrency of module evaluation; state is NEVER retained locally across module update cycles

Since:
2.0

writeState

public CognitiveModuleState writeState(CognitiveModelState modelState)
Write out the model and module state changes resulting from a call to evaluate NOTE: output state was held temporarily for the sole purpose of supporting concurrency of module evaluation; state is NEVER retained locally across module update cycles

Parameters:
modelState - The CognitiveModelState to update
Returns:
The updated CognitiveModuleState for this module
Since:
2.0

getName

public String getName()
Gets the human-readable name of module.

Returns:
The human-readable name of the module.

setName

public void setName(String name)
Sets the name of the module

Parameters:
name - Name to assign to the module

getSettings

public EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> getSettings()
Gets the settings for the module, which can be used to create another instantation of a module.

Returns:
The settings for the module

setSettings

protected void setSettings(EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings)
Sets the settings of the module.

Parameters:
settings - The module's settings.

getEvaluator

public Evaluator<? super InputType,? extends OutputType> getEvaluator()
Gets the underlying evaluator that is being wrapped in this module.

Returns:
The underlying evaluator that is being wrapped in this module.

getInputConverter

public CogxelConverter<InputType> getInputConverter()
Gets the input converter that is used to map from Cogxels to the InputType.

Returns:
The input converter.

getOutputConverter

public CogxelConverter<OutputType> getOutputConverter()
Gets the output converter that is used to map from the OutputType to Cogxels.

Returns:
The output converter.