gov.sandia.cognition.learning.function.cost
Class AbstractSupervisedCostFunction<InputType,TargetType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.performance.AbstractSupervisedPerformanceEvaluator<InputType,TargetType,TargetType,Double>
          extended by gov.sandia.cognition.learning.function.cost.AbstractSupervisedCostFunction<InputType,TargetType>
Type Parameters:
InputType - Input type of the dataset and Evaluator
TargetType - Output type (labels) of the dataset and Evaluator
All Implemented Interfaces:
Evaluator<Evaluator<? super InputType,? extends TargetType>,Double>, CostFunction<Evaluator<? super InputType,? extends TargetType>,Collection<? extends InputOutputPair<? extends InputType,TargetType>>>, SupervisedCostFunction<InputType,TargetType>, PerformanceEvaluator<Evaluator<? super InputType,? extends TargetType>,Collection<? extends InputOutputPair<InputType,TargetType>>,Double>, SupervisedPerformanceEvaluator<InputType,TargetType,TargetType,Double>, CloneableSerializable, Summarizer<TargetEstimatePair<? extends TargetType,? extends TargetType>,Double>, Serializable, Cloneable
Direct Known Subclasses:
AbstractParallelizableCostFunction, MeanL1CostFunction, MeanSquaredErrorCostFunction, MeanZeroOneErrorEvaluator, ParallelizedCostFunctionContainer

public abstract class AbstractSupervisedCostFunction<InputType,TargetType>
extends AbstractSupervisedPerformanceEvaluator<InputType,TargetType,TargetType,Double>
implements SupervisedCostFunction<InputType,TargetType>

Partial implementation of SupervisedCostFunction

Since:
2.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Constructor Summary
AbstractSupervisedCostFunction()
          Creates a new instance of AbstractSupervisedCostFunction
AbstractSupervisedCostFunction(Collection<? extends InputOutputPair<? extends InputType,TargetType>> costParameters)
          Creates a new instance of AbstractSupervisedCostFunction
 
Method Summary
 AbstractSupervisedCostFunction<InputType,TargetType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 Double evaluate(Evaluator<? super InputType,? extends TargetType> evaluator)
          Computes the cost of the given target.
abstract  Double evaluatePerformance(Collection<? extends TargetEstimatePair<? extends TargetType,? extends TargetType>> data)
          Evaluates the performance accuracy of the given estimates against the given targets.
 Collection<? extends InputOutputPair<? extends InputType,TargetType>> getCostParameters()
          Gets the parameters of the cost function.
 void setCostParameters(Collection<? extends InputOutputPair<? extends InputType,TargetType>> costParameters)
          Sets the parameters of the cost function used to evaluate the cost of a target.
 Double summarize(Collection<? extends TargetEstimatePair<? extends TargetType,? extends TargetType>> data)
          Creates a summary of the given collection of data.
 
Methods inherited from class gov.sandia.cognition.learning.performance.AbstractSupervisedPerformanceEvaluator
evaluatePerformance
 
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.performance.PerformanceEvaluator
evaluatePerformance
 

Constructor Detail

AbstractSupervisedCostFunction

public AbstractSupervisedCostFunction()
Creates a new instance of AbstractSupervisedCostFunction


AbstractSupervisedCostFunction

public AbstractSupervisedCostFunction(Collection<? extends InputOutputPair<? extends InputType,TargetType>> costParameters)
Creates a new instance of AbstractSupervisedCostFunction

Parameters:
costParameters - Labeled dataset to use to evaluate the cost against
Method Detail

clone

public AbstractSupervisedCostFunction<InputType,TargetType> 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 CostFunction<Evaluator<? super InputType,? extends TargetType>,Collection<? extends InputOutputPair<? extends InputType,TargetType>>>
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

evaluatePerformance

public abstract Double evaluatePerformance(Collection<? extends TargetEstimatePair<? extends TargetType,? extends TargetType>> data)
Description copied from interface: SupervisedPerformanceEvaluator
Evaluates the performance accuracy of the given estimates against the given targets.

Specified by:
evaluatePerformance in interface SupervisedPerformanceEvaluator<InputType,TargetType,TargetType,Double>
Specified by:
evaluatePerformance in class AbstractSupervisedPerformanceEvaluator<InputType,TargetType,TargetType,Double>
Parameters:
data - The target-estimate pairs to use to evaluate performance.
Returns:
The performance evaluation result.

evaluate

public Double evaluate(Evaluator<? super InputType,? extends TargetType> evaluator)
Description copied from interface: CostFunction
Computes the cost of the given target.

Specified by:
evaluate in interface Evaluator<Evaluator<? super InputType,? extends TargetType>,Double>
Specified by:
evaluate in interface CostFunction<Evaluator<? super InputType,? extends TargetType>,Collection<? extends InputOutputPair<? extends InputType,TargetType>>>
Parameters:
evaluator - The object to evaluate.
Returns:
The cost of the given object.

getCostParameters

public Collection<? extends InputOutputPair<? extends InputType,TargetType>> getCostParameters()
Description copied from interface: CostFunction
Gets the parameters of the cost function.

Specified by:
getCostParameters in interface CostFunction<Evaluator<? super InputType,? extends TargetType>,Collection<? extends InputOutputPair<? extends InputType,TargetType>>>
Returns:
The current parameters of the cost function.

setCostParameters

public void setCostParameters(Collection<? extends InputOutputPair<? extends InputType,TargetType>> costParameters)
Description copied from interface: CostFunction
Sets the parameters of the cost function used to evaluate the cost of a target.

Specified by:
setCostParameters in interface CostFunction<Evaluator<? super InputType,? extends TargetType>,Collection<? extends InputOutputPair<? extends InputType,TargetType>>>
Parameters:
costParameters - The parameters of the cost function.

summarize

public Double summarize(Collection<? extends TargetEstimatePair<? extends TargetType,? extends TargetType>> data)
Description copied from interface: Summarizer
Creates a summary of the given collection of data.

Specified by:
summarize in interface Summarizer<TargetEstimatePair<? extends TargetType,? extends TargetType>,Double>
Overrides:
summarize in class AbstractSupervisedPerformanceEvaluator<InputType,TargetType,TargetType,Double>
Parameters:
data - The collection of data to summarize.
Returns:
The summary of the data.