gov.sandia.cognition.learning.data
Class DefaultWeightedTargetEstimatePair<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>
              extended by gov.sandia.cognition.learning.data.DefaultWeightedTargetEstimatePair<TargetType,EstimateType>
Type Parameters:
TargetType - The type of the target (ground truth).
EstimateType - The type of the estimate. Typically this is the same as TargetType, but it does not have to be.
All Implemented Interfaces:
TargetEstimatePair<TargetType,EstimateType>, WeightedTargetEstimatePair<TargetType,EstimateType>, CloneableSerializable, Pair<TargetType,EstimateType>, Weighted, Serializable, Cloneable

public class DefaultWeightedTargetEstimatePair<TargetType,EstimateType>
extends DefaultTargetEstimatePair<TargetType,EstimateType>
implements WeightedTargetEstimatePair<TargetType,EstimateType>

Extends TargetEstimatePair with an additional weight field.

Since:
3.0
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
static double DEFAULT_WEIGHT
          The default weight is 1.0.
protected  double weight
          The weight.
 
Fields inherited from class gov.sandia.cognition.learning.data.DefaultTargetEstimatePair
estimate, target
 
Constructor Summary
DefaultWeightedTargetEstimatePair()
          Creates a new WeightedTargetEstimatePair with nulls for the target and estimate and 1.0 for the weight.
DefaultWeightedTargetEstimatePair(DefaultWeightedTargetEstimatePair<? extends TargetType,? extends EstimateType> other)
          Creates a new WeightedTargetEstimatePair as a shallow copy of the given other object.
DefaultWeightedTargetEstimatePair(TargetType target, EstimateType estimate, double weight)
          Creates a new WeightedTargetEstimatePair with the given target, estimate, and weight.
 
Method Summary
static
<TargetType,EstimateType>
DefaultWeightedTargetEstimatePair<TargetType,EstimateType>
create()
          Convenience method for creating a new DefaultWeightedTargetEstimatePair.
static
<TargetType,EstimateType>
DefaultWeightedTargetEstimatePair<TargetType,EstimateType>
create(TargetType target, EstimateType estimate)
          Convenience method for creating a new DefaultWeightedTargetEstimatePair.
static
<TargetType,EstimateType>
DefaultWeightedTargetEstimatePair<TargetType,EstimateType>
create(TargetType target, EstimateType estimate, double weight)
          Convenience method for creating a new DefaultWeightedTargetEstimatePair.
 double getWeight()
          Gets the weight of the object.
 void setWeight(double weight)
          Sets the weight.
 
Methods inherited from class gov.sandia.cognition.learning.data.DefaultTargetEstimatePair
clone, getEstimate, getTarget, mergeCollections, setEstimate, setTarget
 
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
 
Methods inherited from interface gov.sandia.cognition.learning.data.TargetEstimatePair
getEstimate, getTarget
 
Methods inherited from interface gov.sandia.cognition.util.Pair
getFirst, getSecond
 

Field Detail

DEFAULT_WEIGHT

public static final double DEFAULT_WEIGHT
The default weight is 1.0.

See Also:
Constant Field Values

weight

protected double weight
The weight.

Constructor Detail

DefaultWeightedTargetEstimatePair

public DefaultWeightedTargetEstimatePair()
Creates a new WeightedTargetEstimatePair with nulls for the target and estimate and 1.0 for the weight.


DefaultWeightedTargetEstimatePair

public DefaultWeightedTargetEstimatePair(TargetType target,
                                         EstimateType estimate,
                                         double weight)
Creates a new WeightedTargetEstimatePair with the given target, estimate, and weight.

Parameters:
target - The target.
estimate - The estimate.
weight - The eight.

DefaultWeightedTargetEstimatePair

public DefaultWeightedTargetEstimatePair(DefaultWeightedTargetEstimatePair<? extends TargetType,? extends EstimateType> other)
Creates a new WeightedTargetEstimatePair as a shallow copy of the given other object.

Parameters:
other - The other object to get the target, estimate, and weight from.
Method Detail

getWeight

public double getWeight()
Description copied from interface: Weighted
Gets the weight of the object.

Specified by:
getWeight in interface Weighted
Returns:
The weight.

setWeight

public void setWeight(double weight)
Sets the weight.

Parameters:
weight - The weight for the pair.

create

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

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

create

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

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 with a default weight of 1.0.

create

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

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.
weight - The weight for the pair.
Returns:
A new target-estimate pair with the given weight.