TargetType
- The type of the target (ground-truth).EstimateType
- The type of the estimate (prediction).public class DefaultTargetEstimatePair<TargetType,EstimateType> extends AbstractTargetEstimatePair<TargetType,EstimateType>
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.Modifier and Type | Field and Description |
---|---|
protected EstimateType |
estimate
Estimate (prediction) of the target value.
|
protected TargetType |
target
Target (ground-truth) value.
|
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
DefaultTargetEstimatePair<TargetType,EstimateType> |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
static <TargetType,EstimateType> |
create()
Convenience method for creating a new
DefaultTargetEstimatePair . |
static <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> |
mergeCollections(java.util.Collection<? extends TargetType> targets,
java.util.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.
|
getFirst, getSecond, toString
protected TargetType target
protected EstimateType estimate
public DefaultTargetEstimatePair()
TargetEstimatePair
, with null target
and estimate values.public DefaultTargetEstimatePair(TargetType target, EstimateType estimate)
TargetEstimatePair
with the given
target and estimate values.target
- Target (ground-truth) value.estimate
- Estimate (prediction) of the target value.public DefaultTargetEstimatePair(Pair<? extends TargetType,? extends EstimateType> other)
other
- TargetEstimatePair to shallow copy.public static <TargetType,EstimateType> java.util.ArrayList<DefaultTargetEstimatePair<TargetType,EstimateType>> mergeCollections(java.util.Collection<? extends TargetType> targets, java.util.Collection<? extends EstimateType> estimates)
TargetType
- The target type.EstimateType
- The estimate type.targets
- Collection of targets, must be same size as estimatesestimates
- Collection of estimates, must be same size as targetspublic DefaultTargetEstimatePair<TargetType,EstimateType> clone()
AbstractCloneableSerializable
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.clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public TargetType getTarget()
public void setTarget(TargetType target)
target
- The target (ground-truth) value.public EstimateType getEstimate()
public void setEstimate(EstimateType estimate)
estimate
- The target (predicted) value.public static <TargetType,EstimateType> DefaultTargetEstimatePair<TargetType,EstimateType> create()
DefaultTargetEstimatePair
.TargetType
- The target (ground-truth) type.EstimateType
- The estimate (prediction) type. Usually the same as TargetType.public static <TargetType,EstimateType> DefaultTargetEstimatePair<TargetType,EstimateType> create(TargetType target, EstimateType estimate)
DefaultTargetEstimatePair
.TargetType
- The target (ground-truth) type.EstimateType
- The estimate (prediction) type. Usually the same as TargetType.target
- The target (ground-truth) value.estimate
- The estimate (prediction) value.