public class L1NormComparator extends Object implements SkipComparator<VectorialValue>
Constructor and Description |
---|
L1NormComparator()
This uses the hyperbolic normalizer as default.
|
L1NormComparator(Normalizer normalizer) |
Modifier and Type | Method and Description |
---|---|
double |
compare(VectorialValue a,
VectorialValue b)
This has to return a distance between a and b with the following
restrictions:
The return value has to lie between 0 and 1.
1 means maximum dissimilarity between a and b.
0 means maximum similarity between a and b (especially it should be
true that a = b implies a zero distance).
distance(a,b) should be equal or at least close to
distance(b,a)
Please note that this has to be well-defined, even if an input is null.
|
double |
delete(VectorialValue a)
This should be called during an alignment to retrieve the costs for a
deletion of value a from the first sequence.
|
double |
distance(double[] a,
double c)
Returns the L1-distance between the vector a and the unit vector
multiplied with the scalar c.
|
double |
distance(double[] a,
double[] b)
Returns the L1-distance between the vectors a and b, given that they have
the same length.
|
boolean |
equals(Object obj) |
double |
getGapComparison()
Please refer to the corresponding setter method for more information.
|
Normalizer |
getNormalizer()
Please refer to the corresponding setter method for more information.
|
double |
getSkipComparison()
Please refer to the corresponding setter method for more information.
|
ValueType |
getType() |
int |
hashCode() |
double |
insert(VectorialValue b)
This should be called during an alignment to retrieve the costs for an
insertion of value b into the first sequence.
|
void |
setGapComparison(double gapComparison)
If we insert or delete vectors we have no other vector to calculate an
L1-norm.
|
void |
setNormalizer(Normalizer normalizer)
The L1-norm per default is bound by 0 but has no upper bound.
|
void |
setSkipComparison(double skipComparison)
If we skip vectors we have no other vector to calculate an L1-norm.
|
double |
skipDelete(VectorialValue a)
This should be called during an alignment to retrieve the costs for a
skip deletion of value a from the first sequence.
|
double |
skipInsert(VectorialValue b)
This should be called during an alignment to retrieve the costs for a
skip insertion of value b into the first sequence.
|
public L1NormComparator()
public L1NormComparator(Normalizer normalizer)
public void setNormalizer(Normalizer normalizer)
normalizer
- a Normalizer.public Normalizer getNormalizer()
public void setGapComparison(double gapComparison)
gapComparison
- the constant value that is used as reference for
DELETION/INSERTION.public double getGapComparison()
public void setSkipComparison(double skipComparison)
skipComparison
- the constant value that is used as reference for
SKIPDELETION/SKIPINSERTION.public double getSkipComparison()
public double skipDelete(VectorialValue a)
skipDelete
in interface SkipComparator<VectorialValue>
a
- a value.public double skipInsert(VectorialValue b)
skipInsert
in interface SkipComparator<VectorialValue>
b
- a value.public double delete(VectorialValue a)
delete
in interface GapComparator<VectorialValue>
a
- a value.public double insert(VectorialValue b)
insert
in interface GapComparator<VectorialValue>
b
- a value.public double compare(VectorialValue a, VectorialValue b)
compare
in interface Comparator<VectorialValue>
a
- the left input.b
- the right input.public double distance(double[] a, double[] b)
a
- a double vector.b
- a double vector.public double distance(double[] a, double c)
a
- a double vector.c
- a double scalar.public ValueType getType()
getType
in interface Comparator<VectorialValue>
Copyright © 2014. All rights reserved.