|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object viper.comparison.distances.Distances
Utility class containing a variety of different standard distance measures.
Nested Class Summary | |
static class |
Distances.DefaultDifference
A simple differnece object, which keeps track of some information about a computed difference. |
static class |
Distances.HelperAttrDistance
Converts one of the value distance function objects into a AttrDistance . |
static class |
Distances.HelperMeasureDistance
Converts one of the value distance function objects into a MeasureDistance . |
static interface |
Distances.QuickValueDistance
Sometimes, it is convenient to save on computations for values that are compared over-and-over; this distance functor allows cacheing operations when performing multiple comparisons between the same attributes. |
static interface |
Distances.SmartValueDistance
An extended distance function object that can deal with both don't-care values and blackout values. |
static interface |
Distances.ValueDistance
An interface for simplifying implementation of a distance metric; instead of implementing all of AttrDistance , you can just pass this to
Distances.HelperAttrDistance . |
Field Summary | |
static double |
alpha
The coefficient to use with closedDistanceRangeToInfinite(double, double)
and infiniteDistanceRangeToClosed(double, double) . |
static int |
MAXIMUM
The maximum value statistic. |
static int |
MEAN
The average statistic. |
static int |
MEDIAN
The median value statistic. |
static int |
MINIMUM
The minimum value statistic. |
Constructor Summary | |
Distances()
|
Method Summary | |
static boolean |
check(java.lang.String type)
Check to make sure that the specified attribute has been loaded into the virtual machine. |
static double |
closedDistanceRangeToInfinite(double distance,
double maximum)
Converts from the range zero to one to zero to the specified maximum. |
static int |
getDefaultStatistic()
Gets the default statistic to use when comparing descriptors at the 'statistic' level. |
static double |
getDefaultSTolerance()
Gets the default tolerance to apply to the statistic measure of a descriptor to count it as 'statisticked'. |
static Distance |
getDistanceFunctor(Measurable type,
java.lang.String metric)
Gets the distance functor for the given type. |
static Distance |
getDistanceFunctor(java.lang.String type,
java.lang.String metric)
Gets the distance functor for the given type. |
static AttrDistance |
getEqualityDistance()
Get an AttrDistance object that returns 0 when the attributes are equal (using .equals) or 1 when they are not. |
static Measurable.Difference |
helpGetDiff(Attribute alpha,
FrameSpan alphaSpan,
Attribute beta,
FrameSpan betaSpan,
Attribute blackout,
FrameSpan blackoutSpan,
Attribute ignore,
FrameSpan ignoreSpan,
int frame,
CanonicalFileDescriptor cfd,
Measurable.Difference old)
Computes the difference between two attributes using the given distance metric. |
static Measurable.Difference |
helpGetDiff(Measurable alpha,
Measurable beta,
Measurable blackout,
Measurable ignore,
CanonicalFileDescriptor cfd,
Measurable.Difference old)
Computes the difference between two attributes using the given distance metric. |
static double |
infiniteDistanceRangeToClosed(double distance,
double maximum)
Converts from a positive infinite range to the range from zero to maxiumum. |
static boolean |
isDistanceFor(Measurable type,
java.lang.String s)
Tests to see if the specified metric name is known for the given attribute data type. |
static boolean |
isDistanceFor(java.lang.String type,
java.lang.String s)
Tests to see if the specified metric name is known for the given attribute data type. |
static void |
putDistanceFunctorFor(java.lang.String type,
Distance d)
Adds a new distance functor for the given attribute data type. |
static void |
setDefaultStatistic(java.lang.String s)
Sets the default statistic to use when comparing descriptors at the 'statistic' level. |
static void |
setDefaultSTolerance(double t)
Set the default threshold for the level 3-statistic measure. |
static void |
useSameDistances(java.lang.String to,
java.lang.String from)
Copies all the distance functors from from attribute type
to to attribute type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static double alpha
closedDistanceRangeToInfinite(double, double)
and infiniteDistanceRangeToClosed(double, double)
.
public static final int MEAN
public static final int MINIMUM
public static final int MEDIAN
public static final int MAXIMUM
Constructor Detail |
public Distances()
Method Detail |
public static AttrDistance getEqualityDistance()
public static Measurable.Difference helpGetDiff(Attribute alpha, FrameSpan alphaSpan, Attribute beta, FrameSpan betaSpan, Attribute blackout, FrameSpan blackoutSpan, Attribute ignore, FrameSpan ignoreSpan, int frame, CanonicalFileDescriptor cfd, Measurable.Difference old) throws IgnoredValueException
alpha
- the target attributealphaSpan
- the target attribute's spanbeta
- the candidate attributebetaSpan
- the candidate attribute's framespanblackout
- the blackout datablackoutSpan
- when the blackout is definedignore
- the don't-care dataignoreSpan
- the don't-care framespanframe
- the frame to comparecfd
- information about the mediaold
- cached difference object
IgnoredValueException
- if the whole of the data on the frame was ignoredpublic static Measurable.Difference helpGetDiff(Measurable alpha, Measurable beta, Measurable blackout, Measurable ignore, CanonicalFileDescriptor cfd, Measurable.Difference old) throws IgnoredValueException
alpha
- the target attributebeta
- the candidate attributeblackout
- the blackout dataignore
- the don't-care datacfd
- information about the mediaold
- cached difference object
IgnoredValueException
- if the whole of the data on the frame was ignoredpublic static final void putDistanceFunctorFor(java.lang.String type, Distance d)
type
- the attribute data typed
- the distance functor to use on the data typepublic static final boolean isDistanceFor(Measurable type, java.lang.String s) throws UnknownDistanceException
type
- the attribute types
- the name of the distance metric to look for
s
is the name of a known metric
for the type
UnknownDistanceException
- if the type is unknown.
XXX: shouldn't this be the other way around?public static final boolean isDistanceFor(java.lang.String type, java.lang.String s) throws UnknownDistanceException
type
- the attribute types
- the name of the distance metric to look for
s
is the name of a known metric
for the type
UnknownDistanceException
- if the type is unknown.
XXX: shouldn't this be the other way around?public static final Distance getDistanceFunctor(Measurable type, java.lang.String metric) throws UnknownDistanceException
type
- the attribute data typemetric
- the metric name
UnknownDistanceException
- if the metric isn't foundpublic static final boolean check(java.lang.String type)
type
- the name of the attribute to check
true
if the attribute has been or can be loadedpublic static final Distance getDistanceFunctor(java.lang.String type, java.lang.String metric) throws UnknownDistanceException
type
- the attribute data typemetric
- the metric name
UnknownDistanceException
- if the metric isn't foundpublic static final void useSameDistances(java.lang.String to, java.lang.String from)
from
attribute type
to to
attribute type.
to
- the attribute type to get the copiesfrom
- the attribute type to receive the distance functor referencespublic static double closedDistanceRangeToInfinite(double distance, double maximum)
distance
- the distancemaximum
- the max
infiniteDistanceRangeToClosed(double, double)
public static double infiniteDistanceRangeToClosed(double distance, double maximum)
distance
- a (possibly very great) distancemaximum
- the new maximum value.
closedDistanceRangeToInfinite(double, double)
public static void setDefaultSTolerance(double t)
t
- sets the default tolerance levelpublic static double getDefaultSTolerance()
public static int getDefaultStatistic()
MEDIAN
, for examplepublic static void setDefaultStatistic(java.lang.String s) throws ImproperMetricException
s
- MEDIAN
, for example
ImproperMetricException
- not a known metric.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |