viper.comparison.distances
Class Distances.HelperMeasureDistance

java.lang.Object
  extended byviper.comparison.distances.Distances.HelperDistance
      extended byviper.comparison.distances.Distances.HelperMeasureDistance
All Implemented Interfaces:
Distance, MeasureDistance
Enclosing class:
Distances

public static class Distances.HelperMeasureDistance
extends viper.comparison.distances.Distances.HelperDistance
implements MeasureDistance

Converts one of the value distance function objects into a MeasureDistance.


Field Summary
protected  Distances.QuickValueDistance dist
           
 
Fields inherited from interface viper.comparison.distances.Distance
BALANCED, CAND_V_TARGS, OVERALL_MEAN, OVERALL_SUM, TARG_V_CANDS
 
Constructor Summary
Distances.HelperMeasureDistance(Distances.QuickValueDistance d, java.lang.String name, int type, java.lang.String explanation, boolean isDistance)
          Constructs a new measure distance from the given function object and parameters.
Distances.HelperMeasureDistance(Distances.SmartValueDistance d, java.lang.String name, int type, java.lang.String explanation, boolean isDistance)
          Constructs a new measure distance from the given function object and parameters.
Distances.HelperMeasureDistance(Distances.ValueDistance d, java.lang.String name, int type, java.lang.String explanation, boolean isDistance)
          Constructs a new measure distance from the given function object and parameters.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.Number getDistance(Measurable.Difference D)
          Gets the distance using cached distance data.
 java.lang.Number getDistance(Measurable alpha, Measurable beta, CanonicalFileDescriptor cfd)
          Compute the distance.
 java.lang.Number getDistance(Measurable alpha, Measurable beta, Measurable blackout, Measurable ignore, CanonicalFileDescriptor cfd)
          Compute the distance.
 java.lang.String getExplanation()
          An explanatory message, like "Pixels matched", or "Localized Object Count Recall".
 int getType()
          Get what type of metric this is, per the list of static int types.
 int hashCode()
           
 boolean isDistance()
          Determines if this is a distance or a similarity quotient.
 java.lang.String toString()
          Get the EPF name of the metric.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface viper.comparison.distances.Distance
getDistance, getExplanation, getType, isDistance, toString
 

Field Detail

dist

protected Distances.QuickValueDistance dist
Constructor Detail

Distances.HelperMeasureDistance

public Distances.HelperMeasureDistance(Distances.ValueDistance d,
                                       java.lang.String name,
                                       int type,
                                       java.lang.String explanation,
                                       boolean isDistance)
Constructs a new measure distance from the given function object and parameters.

Parameters:
d - the distance functor
name - the name of the distance metric
type - the category of distance, e.g. Distance.BALANCED
explanation - a long explanation of the distance, for helper documentation and verbose output
isDistance - determines if the distance is really a distance or if it is a score (bigger is better)

Distances.HelperMeasureDistance

public Distances.HelperMeasureDistance(Distances.SmartValueDistance d,
                                       java.lang.String name,
                                       int type,
                                       java.lang.String explanation,
                                       boolean isDistance)
Constructs a new measure distance from the given function object and parameters.

Parameters:
d - the distance functor
name - the name of the distance metric
type - the category of distance, e.g. Distance.BALANCED
explanation - a long explanation of the distance, for helper documentation and verbose output
isDistance - determines if the distance is really a distance or if it is a score (bigger is better)

Distances.HelperMeasureDistance

public Distances.HelperMeasureDistance(Distances.QuickValueDistance d,
                                       java.lang.String name,
                                       int type,
                                       java.lang.String explanation,
                                       boolean isDistance)
Constructs a new measure distance from the given function object and parameters.

Parameters:
d - the distance functor
name - the name of the distance metric
type - the category of distance, e.g. Distance.BALANCED
explanation - a long explanation of the distance, for helper documentation and verbose output
isDistance - determines if the distance is really a distance or if it is a score (bigger is better)
Method Detail

getDistance

public java.lang.Number getDistance(Measurable alpha,
                                    Measurable beta,
                                    CanonicalFileDescriptor cfd)
Description copied from interface: MeasureDistance
Compute the distance. Only defined for static attributes and the like (read: FrameSpan).

Specified by:
getDistance in interface MeasureDistance
Parameters:
alpha - the alpha value
beta - the beta value
cfd - the file descriptor that alpha and beta are defined within
Returns:
the distance between alpha and beta

getDistance

public java.lang.Number getDistance(Measurable alpha,
                                    Measurable beta,
                                    Measurable blackout,
                                    Measurable ignore,
                                    CanonicalFileDescriptor cfd)
                             throws IgnoredValueException
Description copied from interface: MeasureDistance
Compute the distance. Only defined for static attributes and the like (read: FrameSpan). This one includes blackout and ignore parameters - blackouts apply to regions that are losses, and ignore are for regions that are don't-care. For example, "scene" data may be marked as don't-care, or frames that don't meat a certain metric are qualified as blackout.

Specified by:
getDistance in interface MeasureDistance
Parameters:
alpha - the first value
beta - the second value
blackout - the bad region
ignore - the region to ignore
cfd - the file on which the measurables are defined
Returns:
the distance between alpha and beta, given the constraints
Throws:
IgnoredValueException - when the ignored region is such that it prevents evaluation of the distance.

getType

public int getType()
Description copied from interface: Distance
Get what type of metric this is, per the list of static int types.

Specified by:
getType in interface Distance
Returns:
one of BALANCED, CAND_V_TARGS, etc.

getExplanation

public java.lang.String getExplanation()
Description copied from interface: Distance
An explanatory message, like "Pixels matched", or "Localized Object Count Recall".

Specified by:
getExplanation in interface Distance
Returns:
this distance's explanatory message

toString

public java.lang.String toString()
Description copied from interface: Distance
Get the EPF name of the metric.

Specified by:
toString in interface Distance

getDistance

public java.lang.Number getDistance(Measurable.Difference D)
Description copied from interface: Distance
Gets the distance using cached distance data. Has two major benefits: possible consolidation of IgnoredValueExceptions and savings on recomputing, for example, the area of polygons. Calling getDistance (alpha, beta, blackout, ignore) should have the same effect as getDistance (alpha.getDifference (beta, blackout, ignore))

Specified by:
getDistance in interface Distance
Parameters:
D - the distance of the difference
Returns:
the distance

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object o)

isDistance

public boolean isDistance()
Description copied from interface: Distance
Determines if this is a distance or a similarity quotient. Similarity quotients are better the larger they are, but distances should be minimized.

Specified by:
isDistance in interface Distance
Returns:
true when 0 indicates a perfect match, and distance varies proportionally to difference