gov.sandia.cognition.learning.function.categorization
Class ScalarFunctionToBinaryCategorizerAdapter<InputType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer<InputType>
          extended by gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantBinaryCategorizer<InputType>
              extended by gov.sandia.cognition.learning.function.categorization.AbstractThresholdBinaryCategorizer<InputType>
                  extended by gov.sandia.cognition.learning.function.categorization.ScalarFunctionToBinaryCategorizerAdapter<InputType>
Type Parameters:
InputType - Input to the discriminant function.
All Implemented Interfaces:
Evaluator<InputType,Boolean>, BinaryCategorizer<InputType>, Categorizer<InputType,Boolean>, DiscriminantBinaryCategorizer<InputType>, DiscriminantCategorizer<InputType,Boolean,Double>, ThresholdBinaryCategorizer<InputType>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
FisherLinearDiscriminantBinaryCategorizer

public class ScalarFunctionToBinaryCategorizerAdapter<InputType>
extends AbstractThresholdBinaryCategorizer<InputType>

Adapts a scalar function to be a categorizer using a threshold.

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

Field Summary
protected  Evaluator<? super InputType,Double> evaluator
          The scalar evaluator.
 
Fields inherited from class gov.sandia.cognition.learning.function.categorization.AbstractThresholdBinaryCategorizer
DEFAULT_THRESHOLD
 
Fields inherited from class gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer
BINARY_CATEGORIES
 
Constructor Summary
ScalarFunctionToBinaryCategorizerAdapter()
          Creates a new ScalarFunctionToBinaryCategorizerAdapter.
ScalarFunctionToBinaryCategorizerAdapter(Evaluator<? super InputType,Double> evaluator)
          Creates a new ScalarFunctionToBinaryCategorizerAdapter with the given evaluator and a default threshold of 0.0.
ScalarFunctionToBinaryCategorizerAdapter(Evaluator<? super InputType,Double> evaluator, double threshold)
          Creates a new ScalarFunctionToBinaryCategorizerAdapter with the given evaluator and threshold.
 
Method Summary
 ScalarFunctionToBinaryCategorizerAdapter<InputType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
protected  double evaluateWithoutThreshold(InputType input)
          Computes the discriminant.
 Evaluator<? super InputType,Double> getEvaluator()
          Gets the scalar function that the adapter wraps.
 void setEvaluator(Evaluator<? super InputType,Double> evaluator)
          Sets the scalar function that the adapter wraps.
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractThresholdBinaryCategorizer
evaluateAsDouble, getThreshold, setThreshold
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractDiscriminantBinaryCategorizer
evaluate, evaluateWithDiscriminant
 
Methods inherited from class gov.sandia.cognition.learning.function.categorization.AbstractBinaryCategorizer
getCategories
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.function.categorization.DiscriminantCategorizer
evaluateWithDiscriminant
 
Methods inherited from interface gov.sandia.cognition.learning.function.categorization.Categorizer
getCategories
 
Methods inherited from interface gov.sandia.cognition.evaluator.Evaluator
evaluate
 

Field Detail

evaluator

protected Evaluator<? super InputType,Double> evaluator
The scalar evaluator.

Constructor Detail

ScalarFunctionToBinaryCategorizerAdapter

public ScalarFunctionToBinaryCategorizerAdapter()
Creates a new ScalarFunctionToBinaryCategorizerAdapter.


ScalarFunctionToBinaryCategorizerAdapter

public ScalarFunctionToBinaryCategorizerAdapter(Evaluator<? super InputType,Double> evaluator)
Creates a new ScalarFunctionToBinaryCategorizerAdapter with the given evaluator and a default threshold of 0.0.

Parameters:
evaluator - The scalar function to adapt.

ScalarFunctionToBinaryCategorizerAdapter

public ScalarFunctionToBinaryCategorizerAdapter(Evaluator<? super InputType,Double> evaluator,
                                                double threshold)
Creates a new ScalarFunctionToBinaryCategorizerAdapter with the given evaluator and threshold.

Parameters:
evaluator - The scalar function to adapt.
threshold - The threshold to use.
Method Detail

clone

public ScalarFunctionToBinaryCategorizerAdapter<InputType> clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

evaluateWithoutThreshold

protected double evaluateWithoutThreshold(InputType input)
Description copied from class: AbstractThresholdBinaryCategorizer
Computes the discriminant. This maps the input space onto the real line, which will then be passed to the threshold.

Specified by:
evaluateWithoutThreshold in class AbstractThresholdBinaryCategorizer<InputType>
Parameters:
input - Input to map onto the real number line.
Returns:
Real-value equivalent of the input.

getEvaluator

public Evaluator<? super InputType,Double> getEvaluator()
Gets the scalar function that the adapter wraps.

Returns:
The scalar function.

setEvaluator

public void setEvaluator(Evaluator<? super InputType,Double> evaluator)
Sets the scalar function that the adapter wraps.

Parameters:
evaluator - The scalar function.