gov.sandia.cognition.learning.function.categorization
Class EvaluatorToCategorizerAdapter<InputType,CategoryType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.categorization.AbstractCategorizer<InputType,CategoryType>
          extended by gov.sandia.cognition.learning.function.categorization.EvaluatorToCategorizerAdapter<InputType,CategoryType>
Type Parameters:
InputType - The type of the input to categorize.
CategoryType - The type of the output categories.
All Implemented Interfaces:
Evaluator<InputType,CategoryType>, Categorizer<InputType,CategoryType>, CloneableSerializable, Serializable, Cloneable

public class EvaluatorToCategorizerAdapter<InputType,CategoryType>
extends AbstractCategorizer<InputType,CategoryType>

The EvaluatorToCategorizerAdapter class implements an adapter from a general Evaluator to be a Categorizer. This is done by just having a reference to the evaluator plus a field to store the list of possible output categories.

Since:
2.0
Author:
Justin Basilico
See Also:
Serialized Form

Nested Class Summary
static class EvaluatorToCategorizerAdapter.Learner<InputType,CategoryType>
          The EvaluatorToCategorizerAdapter.Learner class implements a simple supervised learner for a EvaluatorToCategorizerAdapter.
 
Field Summary
 
Fields inherited from class gov.sandia.cognition.learning.function.categorization.AbstractCategorizer
categories
 
Constructor Summary
EvaluatorToCategorizerAdapter()
          Creates a new EvaluatorToCategorizerAdapter.
EvaluatorToCategorizerAdapter(Evaluator<? super InputType,? extends CategoryType> evaluator, Set<CategoryType> categories)
          Creates a new EvaluatorToCategorizerAdapter.
 
Method Summary
 CategoryType evaluate(InputType input)
          Evaluates the function on the given input and returns the output.
 Evaluator<? super InputType,? extends CategoryType> getEvaluator()
          Gets the evaluator that is to be adapted to be a categorizer.
 void setCategories(Set<CategoryType> categories)
          Sets the Set of possible categories, which are the output values.
 void setEvaluator(Evaluator<? super InputType,? extends CategoryType> evaluator)
          Sets the evaluator that is to be adapted to be a categorizer.
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractCategorizer
clone, getCategories
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EvaluatorToCategorizerAdapter

public EvaluatorToCategorizerAdapter()
Creates a new EvaluatorToCategorizerAdapter.


EvaluatorToCategorizerAdapter

public EvaluatorToCategorizerAdapter(Evaluator<? super InputType,? extends CategoryType> evaluator,
                                     Set<CategoryType> categories)
Creates a new EvaluatorToCategorizerAdapter.

Parameters:
evaluator - The evaluator to turn into a categorizer.
categories - The list of possible output categories.
Method Detail

evaluate

public CategoryType evaluate(InputType input)
Description copied from interface: Evaluator
Evaluates the function on the given input and returns the output.

Parameters:
input - The input to evaluate.
Returns:
The output produced by evaluating the input.

getEvaluator

public Evaluator<? super InputType,? extends CategoryType> getEvaluator()
Gets the evaluator that is to be adapted to be a categorizer.

Returns:
The evaluator to adapt.

setEvaluator

public void setEvaluator(Evaluator<? super InputType,? extends CategoryType> evaluator)
Sets the evaluator that is to be adapted to be a categorizer.

Parameters:
evaluator - The evaluator to adapt.

setCategories

public void setCategories(Set<CategoryType> categories)
Description copied from class: AbstractCategorizer
Sets the Set of possible categories, which are the output values.

Overrides:
setCategories in class AbstractCategorizer<InputType,CategoryType>
Parameters:
categories - The list of possible output categories.