gov.sandia.cognition.learning.function.cost
Class SumSquaredErrorCostFunction

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<Vector,Vector>
              extended by gov.sandia.cognition.learning.function.cost.AbstractParallelizableCostFunction
                  extended by gov.sandia.cognition.learning.function.cost.SumSquaredErrorCostFunction
All Implemented Interfaces:
Evaluator<Evaluator<? super Vector,? extends Vector>,Double>, CostFunction<Evaluator<? super Vector,? extends Vector>,Collection<? extends InputOutputPair<? extends Vector,Vector>>>, DifferentiableCostFunction, ParallelizableCostFunction, SupervisedCostFunction<Vector,Vector>, PerformanceEvaluator<Evaluator<? super Vector,? extends Vector>,Collection<? extends InputOutputPair<Vector,Vector>>,Double>, SupervisedPerformanceEvaluator<Vector,Vector,Vector,Double>, CloneableSerializable, Summarizer<TargetEstimatePair<? extends Vector,? extends Vector>,Double>, Serializable, Cloneable

public class SumSquaredErrorCostFunction
extends AbstractParallelizableCostFunction

This is the sum-squared error cost function

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

Nested Class Summary
static class SumSquaredErrorCostFunction.Cache
          Caches often-used values for the Cost Function
static class SumSquaredErrorCostFunction.GradientPartialSSE
          Partial result from the SSE gradient computation
 
Constructor Summary
SumSquaredErrorCostFunction()
          Creates a new instance of SumSquaredErrorCostFunction
SumSquaredErrorCostFunction(Collection<? extends InputOutputPair<? extends Vector,Vector>> dataset)
          Creates a new instance of MeanSquaredErrorCostFunction
 
Method Summary
 SumSquaredErrorCostFunction clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 Vector computeParameterGradientAmalgamate(Collection<Object> partialResults)
          Amalgamates the linear components of the cost gradient function into a single Vector.
 Object computeParameterGradientPartial(GradientDescendable function)
          Computes the partial (linear) component of the cost function gradient.
 Double evaluateAmalgamate(Collection<Object> partialResults)
          Amalgamates the linear components of the cost function into a single Double.
 Object evaluatePartial(Evaluator<? super Vector,? extends Vector> evaluator)
          Computes the partial (linear) component of the cost function.
 Double evaluatePerformance(Collection<? extends TargetEstimatePair<? extends Vector,? extends Vector>> data)
          Evaluates the performance accuracy of the given estimates against the given targets.
 
Methods inherited from class gov.sandia.cognition.learning.function.cost.AbstractParallelizableCostFunction
computeParameterGradient, evaluate
 
Methods inherited from class gov.sandia.cognition.learning.function.cost.AbstractSupervisedCostFunction
getCostParameters, setCostParameters, summarize
 
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.function.cost.CostFunction
getCostParameters, setCostParameters
 
Methods inherited from interface gov.sandia.cognition.util.Summarizer
summarize
 
Methods inherited from interface gov.sandia.cognition.learning.performance.PerformanceEvaluator
evaluatePerformance
 

Constructor Detail

SumSquaredErrorCostFunction

public SumSquaredErrorCostFunction()
Creates a new instance of SumSquaredErrorCostFunction


SumSquaredErrorCostFunction

public SumSquaredErrorCostFunction(Collection<? extends InputOutputPair<? extends Vector,Vector>> dataset)
Creates a new instance of MeanSquaredErrorCostFunction

Parameters:
dataset - The dataset of examples to use to compute the error.
Method Detail

clone

public SumSquaredErrorCostFunction 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 Vector,? extends Vector>,Collection<? extends InputOutputPair<? extends Vector,Vector>>>
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractSupervisedCostFunction<Vector,Vector>
Returns:
A clone of this object.

evaluatePartial

public Object evaluatePartial(Evaluator<? super Vector,? extends Vector> evaluator)
Description copied from interface: ParallelizableCostFunction
Computes the partial (linear) component of the cost function. This portion will be performed in parallel.

Parameters:
evaluator - Evaluator to compute the cost of
Returns:
Object that contains the linear component of the cost function

evaluateAmalgamate

public Double evaluateAmalgamate(Collection<Object> partialResults)
Description copied from interface: ParallelizableCostFunction
Amalgamates the linear components of the cost function into a single Double. This portion will be performed in sequence.

Parameters:
partialResults - Collection of partial (linear) results
Returns:
Cost function of the partial results

computeParameterGradientPartial

public Object computeParameterGradientPartial(GradientDescendable function)
Description copied from interface: ParallelizableCostFunction
Computes the partial (linear) component of the cost function gradient. This portion will be performed in parallel.

Parameters:
function - GradientDescendable to compute the gradient of
Returns:
Object that contains the linear component of the gradient

computeParameterGradientAmalgamate

public Vector computeParameterGradientAmalgamate(Collection<Object> partialResults)
Description copied from interface: ParallelizableCostFunction
Amalgamates the linear components of the cost gradient function into a single Vector. This portion will be performed in sequence.

Parameters:
partialResults - Collection of partial (linear) gradient components
Returns:
Vector describing the gradient

evaluatePerformance

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

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