gov.sandia.cognition.learning.data
Class DefaultTargetEstimatePair<TargetType,EstimateType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.data.AbstractTargetEstimatePair<TargetType,EstimateType>
          extended by gov.sandia.cognition.learning.data.DefaultTargetEstimatePair<TargetType,EstimateType>
Type Parameters:
TargetType - The type of the target (ground-truth).
EstimateType - The type of the estimate (prediction).
All Implemented Interfaces:
TargetEstimatePair<TargetType,EstimateType>, CloneableSerializable, Pair<TargetType,EstimateType>, Serializable, Cloneable
Direct Known Subclasses:
DefaultWeightedTargetEstimatePair

public class DefaultTargetEstimatePair<TargetType,EstimateType>
extends AbstractTargetEstimatePair<TargetType,EstimateType>

A default implementation of the TargetEstimatePair. This is useful when keeping track of both a target (ground-truth) and an estimate (prediction), for example when estimating the performance of a function.

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

Field Summary
protected  EstimateType estimate
          Estimate (prediction) of the target value.
protected  TargetType target
          Target (ground-truth) value.
 
Constructor Summary
DefaultTargetEstimatePair()
          Creates a new instance of TargetEstimatePair, with null target and estimate values.
DefaultTargetEstimatePair(Pair<? extends TargetType,? extends EstimateType> other)
          Creates a shallow copy of another target-estimate pair.
DefaultTargetEstimatePair(TargetType target, EstimateType estimate)
          Creates a new instance of TargetEstimatePair with the given target and estimate values.
 
Method Summary
 DefaultTargetEstimatePair<TargetType,EstimateType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
static
<TargetType,EstimateType>
DefaultTargetEstimatePair<TargetType,EstimateType>
create()
          Convenience method for creating a new DefaultTargetEstimatePair.
static
<TargetType,EstimateType>
DefaultTargetEstimatePair<TargetType,EstimateType>
create(TargetType target, EstimateType estimate)
          Convenience method for creating a new DefaultTargetEstimatePair.
 EstimateType getEstimate()
          Gets the estimate, which is the prediction or guess.
 TargetType getTarget()
          Gets the target, which is the ground-truth or actual value.
static
<TargetType,EstimateType>
ArrayList<DefaultTargetEstimatePair<TargetType,EstimateType>>
mergeCollections(Collection<? extends TargetType> targets, Collection<? extends EstimateType> estimates)
          Merges together two Collections into a single target-estimate pair Collection.
 void setEstimate(EstimateType estimate)
          Sets the estimate, which is the prediction or guess.
 void setTarget(TargetType target)
          Sets the target, which is the ground-truth or actual value.
 
Methods inherited from class gov.sandia.cognition.learning.data.AbstractTargetEstimatePair
getFirst, getSecond, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

target

protected TargetType target
Target (ground-truth) value.


estimate

protected EstimateType estimate
Estimate (prediction) of the target value.

Constructor Detail

DefaultTargetEstimatePair

public DefaultTargetEstimatePair()
Creates a new instance of TargetEstimatePair, with null target and estimate values.


DefaultTargetEstimatePair

public DefaultTargetEstimatePair(TargetType target,
                                 EstimateType estimate)
Creates a new instance of TargetEstimatePair with the given target and estimate values.

Parameters:
target - Target (ground-truth) value.
estimate - Estimate (prediction) of the target value.

DefaultTargetEstimatePair

public DefaultTargetEstimatePair(Pair<? extends TargetType,? extends EstimateType> other)
Creates a shallow copy of another target-estimate pair.

Parameters:
other - TargetEstimatePair to shallow copy.
Method Detail

mergeCollections

public static <TargetType,EstimateType> ArrayList<DefaultTargetEstimatePair<TargetType,EstimateType>> mergeCollections(Collection<? extends TargetType> targets,
                                                                                                                       Collection<? extends EstimateType> estimates)
Merges together two Collections into a single target-estimate pair Collection.

Type Parameters:
TargetType - The target type.
EstimateType - The estimate type.
Parameters:
targets - Collection of targets, must be same size as estimates
estimates - Collection of estimates, must be same size as targets
Returns:
A new ArrayList of TargetEstimatePairs, will be same size as both targets and estimates.

clone

public DefaultTargetEstimatePair<TargetType,EstimateType> 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.

getTarget

public TargetType getTarget()
Gets the target, which is the ground-truth or actual value.

Returns:
The target (ground-truth) value.

setTarget

public void setTarget(TargetType target)
Sets the target, which is the ground-truth or actual value.

Parameters:
target - The target (ground-truth) value.

getEstimate

public EstimateType getEstimate()
Gets the estimate, which is the prediction or guess.

Returns:
The target (predicted) value.

setEstimate

public void setEstimate(EstimateType estimate)
Sets the estimate, which is the prediction or guess.

Parameters:
estimate - The target (predicted) value.

create

public static <TargetType,EstimateType> DefaultTargetEstimatePair<TargetType,EstimateType> create()
Convenience method for creating a new DefaultTargetEstimatePair.

Type Parameters:
TargetType - The target (ground-truth) type.
EstimateType - The estimate (prediction) type. Usually the same as TargetType.
Returns:
A new, empty pair.

create

public static <TargetType,EstimateType> DefaultTargetEstimatePair<TargetType,EstimateType> create(TargetType target,
                                                                                                  EstimateType estimate)
Convenience method for creating a new DefaultTargetEstimatePair.

Type Parameters:
TargetType - The target (ground-truth) type.
EstimateType - The estimate (prediction) type. Usually the same as TargetType.
Parameters:
target - The target (ground-truth) value.
estimate - The estimate (prediction) value.
Returns:
A new target-estimate pair.