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

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.MeanSquaredErrorCostFunction
All Implemented Interfaces:
Evaluator<Evaluator<? super Vector,? extends Vector>,Double>, CostFunction<Evaluator<? super Vector,? extends Vector>,Collection<? extends InputOutputPair<? extends Vector,Vector>>>, DifferentiableCostFunction, 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

@CodeReview(reviewer="Justin Basilico",
            date="2006-10-04",
            changesNeeded=false,
            comments="Minor documentaMtion changes.")
public class MeanSquaredErrorCostFunction
extends AbstractSupervisedCostFunction<Vector,Vector>
implements DifferentiableCostFunction

The MeanSquaredErrorCostFunction implements a cost function for functions that take as input a vector and return a vector.

Since:
1.0
Author:
Justin Basilico, Kevin R. Dixon
See Also:
Serialized Form

Constructor Summary
MeanSquaredErrorCostFunction()
          Creates a new instance of MeanSquaredErrorCostFunction with no initial dataset.
MeanSquaredErrorCostFunction(Collection<? extends InputOutputPair<? extends Vector,Vector>> dataset)
          Creates a new instance of MeanSquaredErrorCostFunction
 
Method Summary
 MeanSquaredErrorCostFunction clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 Vector computeParameterGradient(GradientDescendable function)
          Differentiates function with respect to its parameters.
 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.AbstractSupervisedCostFunction
evaluate, 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
evaluate, 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

MeanSquaredErrorCostFunction

public MeanSquaredErrorCostFunction()
Creates a new instance of MeanSquaredErrorCostFunction with no initial dataset.


MeanSquaredErrorCostFunction

public MeanSquaredErrorCostFunction(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 MeanSquaredErrorCostFunction 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.

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.

computeParameterGradient

public Vector computeParameterGradient(GradientDescendable function)
Description copied from interface: DifferentiableCostFunction
Differentiates function with respect to its parameters.

Specified by:
computeParameterGradient in interface DifferentiableCostFunction
Parameters:
function - The object to differentiate.
Returns:
Derivatives of the object with respect to the cost function.