gov.sandia.cognition.learning.function.distance
Class DivergencesEvaluator.Learner<DataType,InputType,ValueType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.algorithm.AbstractBatchLearnerContainer<BatchLearner<? super DataType,? extends Collection<ValueType>>>
          extended by gov.sandia.cognition.learning.function.distance.DivergencesEvaluator.Learner<DataType,InputType,ValueType>
Type Parameters:
DataType - The data type for learning. Passed to the wrapped learner.
InputType - The input type for the evaluator.
ValueType - The value type that is the output of learning and is used as the values in the learned evaluator.
All Implemented Interfaces:
BatchLearner<DataType,DivergencesEvaluator<InputType,ValueType>>, BatchLearnerContainer<BatchLearner<? super DataType,? extends Collection<ValueType>>>, DivergenceFunctionContainer<ValueType,InputType>, VectorFactoryContainer, CloneableSerializable, Serializable, Cloneable
Enclosing class:
DivergencesEvaluator<InputType,ValueType>

public static class DivergencesEvaluator.Learner<DataType,InputType,ValueType>
extends AbstractBatchLearnerContainer<BatchLearner<? super DataType,? extends Collection<ValueType>>>
implements BatchLearner<DataType,DivergencesEvaluator<InputType,ValueType>>, DivergenceFunctionContainer<ValueType,InputType>, VectorFactoryContainer

A learner adapter for the DivergencesEvaluator. It calls a base learner and then wraps learned collection of values in an evaluator that uses the given divergence function.

See Also:
Serialized Form

Field Summary
protected  DivergenceFunction<? super ValueType,? super InputType> divergenceFunction
          The divergence function to apply between the data and the input.
protected  VectorFactory<?> vectorFactory
          The vector factory to use.
 
Fields inherited from class gov.sandia.cognition.learning.algorithm.AbstractBatchLearnerContainer
learner
 
Constructor Summary
DivergencesEvaluator.Learner()
          Creates a new DivergenceFunction.Learner with null base learner and divergence functions.
DivergencesEvaluator.Learner(BatchLearner<DataType,? extends Collection<ValueType>> learner, DivergenceFunction<? super ValueType,? super InputType> divergenceFunction)
          Creates a new DivergenceFunction.Learner with the given properties.
DivergencesEvaluator.Learner(BatchLearner<DataType,? extends Collection<ValueType>> learner, DivergenceFunction<? super ValueType,? super InputType> divergenceFunction, VectorFactory<?> vectorFactory)
          Creates a new DivergenceFunction.Learner with the given properties.
 
Method Summary
 DivergencesEvaluator.Learner<DataType,InputType,ValueType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
static
<DataType,InputType,ValueType>
DivergencesEvaluator.Learner<DataType,InputType,ValueType>
create(BatchLearner<DataType,? extends Collection<ValueType>> learner, DivergenceFunction<? super ValueType,? super InputType> divergenceFunction)
          Convenience method for creating a DivergencesEvaluator.Learner.
 DivergenceFunction<? super ValueType,? super InputType> getDivergenceFunction()
          Gets the divergence function used by this object.
 VectorFactory<? extends Vector> getVectorFactory()
          Gets the vector factory the object to use to create new vectors.
 DivergencesEvaluator<InputType,ValueType> learn(DataType data)
          The learn method creates an object of ResultType using data of type DataType, using some form of "learning" algorithm.
 void setDivergenceFunction(DivergenceFunction<? super ValueType,? super InputType> divergenceFunction)
          Sets the divergence function to use from the values to the inputs.
 void setVectorFactory(VectorFactory<?> vectorFactory)
          Sets the vector factory to use.
 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractBatchLearnerContainer
getLearner, setLearner
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

divergenceFunction

protected DivergenceFunction<? super ValueType,? super InputType> divergenceFunction
The divergence function to apply between the data and the input.


vectorFactory

protected VectorFactory<?> vectorFactory
The vector factory to use.

Constructor Detail

DivergencesEvaluator.Learner

public DivergencesEvaluator.Learner()
Creates a new DivergenceFunction.Learner with null base learner and divergence functions.


DivergencesEvaluator.Learner

public DivergencesEvaluator.Learner(BatchLearner<DataType,? extends Collection<ValueType>> learner,
                                    DivergenceFunction<? super ValueType,? super InputType> divergenceFunction)
Creates a new DivergenceFunction.Learner with the given properties.

Parameters:
learner - The base learner to use.
divergenceFunction - The divergence function to use.

DivergencesEvaluator.Learner

public DivergencesEvaluator.Learner(BatchLearner<DataType,? extends Collection<ValueType>> learner,
                                    DivergenceFunction<? super ValueType,? super InputType> divergenceFunction,
                                    VectorFactory<?> vectorFactory)
Creates a new DivergenceFunction.Learner with the given properties.

Parameters:
learner - The base learner to use.
divergenceFunction - The divergence function to use.
vectorFactory - The vector factory to use.
Method Detail

clone

public DivergencesEvaluator.Learner<DataType,InputType,ValueType> 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 AbstractBatchLearnerContainer<BatchLearner<? super DataType,? extends Collection<ValueType>>>
Returns:
A clone of this object.

learn

public DivergencesEvaluator<InputType,ValueType> learn(DataType data)
Description copied from interface: BatchLearner
The learn method creates an object of ResultType using data of type DataType, using some form of "learning" algorithm.

Specified by:
learn in interface BatchLearner<DataType,DivergencesEvaluator<InputType,ValueType>>
Parameters:
data - The data that the learning algorithm will use to create an object of ResultType.
Returns:
The object that is created based on the given data using the learning algorithm.

getDivergenceFunction

public DivergenceFunction<? super ValueType,? super InputType> getDivergenceFunction()
Description copied from interface: DivergenceFunctionContainer
Gets the divergence function used by this object.

Specified by:
getDivergenceFunction in interface DivergenceFunctionContainer<ValueType,InputType>
Returns:
The divergence function.

setDivergenceFunction

public void setDivergenceFunction(DivergenceFunction<? super ValueType,? super InputType> divergenceFunction)
Sets the divergence function to use from the values to the inputs.

Parameters:
divergenceFunction - The divergence function to use.

getVectorFactory

public VectorFactory<? extends Vector> getVectorFactory()
Description copied from interface: VectorFactoryContainer
Gets the vector factory the object to use to create new vectors.

Specified by:
getVectorFactory in interface VectorFactoryContainer
Returns:
The vector factory.

setVectorFactory

public void setVectorFactory(VectorFactory<?> vectorFactory)
Sets the vector factory to use.

Parameters:
vectorFactory - The vector factory to use.

create

public static <DataType,InputType,ValueType> DivergencesEvaluator.Learner<DataType,InputType,ValueType> create(BatchLearner<DataType,? extends Collection<ValueType>> learner,
                                                                                                               DivergenceFunction<? super ValueType,? super InputType> divergenceFunction)
Convenience method for creating a DivergencesEvaluator.Learner.

Type Parameters:
DataType - The data type for learning. Passed to the wrapped learner.
InputType - The input type for the evaluator.
ValueType - The value type that is the output of learning and is used as the values in the learned evaluator.
Parameters:
learner - The base learner to use.
divergenceFunction - The divergence function to use.
Returns:
A new learner.