public class ReplacementComparator extends Object implements SkipComparator<SymbolicValue>, SparseDerivableComparator<SymbolicValue,double[][]>
Constructor and Description |
---|
ReplacementComparator() |
ReplacementComparator(ReplacementCosts costMatrix) |
Modifier and Type | Method and Description |
---|---|
double |
calculateLocalDerivative(int paramIdx,
SymbolicValue a,
SymbolicValue b,
OperationType type)
This is called by an AlignmentDerivativeAlgorithm and should calculate
the local derivative for only one comparison of the values a and b.
|
SparseLocalDerivative |
calculateSparseLocalDerivative(SymbolicValue a,
SymbolicValue b,
OperationType type)
This method shall return a sparse representation of the derivative for
all parameters that have non-zero derivatives in this step of the
alignment.
|
double |
compare(SymbolicValue a,
SymbolicValue 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(SymbolicValue a)
This should be called during an alignment to retrieve the costs for a
deletion of value a from the first sequence.
|
boolean |
equals(Object obj) |
ReplacementCosts |
getCostMatrix()
Returns the ReplacementCosts object that defines the explicit cost matrix
for replacements between the symbols in the given alphabet.
|
int |
getNumberOfParameters()
This shall return the number of parameters of this comparator.
|
Class<double[][]> |
getResultClass()
Returns the class of the intuitive format of the derivatives for all
parameters of this comparator.
|
ValueType |
getType() |
int |
hashCode() |
double |
insert(SymbolicValue b)
This should be called during an alignment to retrieve the costs for an
insertion of value b into the first sequence.
|
void |
setCostMatrix(ReplacementCosts costMatrix)
Sets the ReplacementCosts that shall be used within this Comparator.
|
double |
skipDelete(SymbolicValue 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(SymbolicValue b)
This should be called during an alignment to retrieve the costs for a
skip insertion of value b into the first sequence.
|
double[][] |
transformToResult(double[] derivatives)
This method is supposed to construct the derivative for this comparator
in an intuitive format given its vectorial form.
|
public ReplacementComparator()
public ReplacementComparator(ReplacementCosts costMatrix)
public void setCostMatrix(ReplacementCosts costMatrix)
costMatrix
- the ReplacementCosts that shall be used within this
Comparatorpublic ReplacementCosts getCostMatrix()
public double skipDelete(SymbolicValue a)
skipDelete
in interface SkipComparator<SymbolicValue>
a
- a value.public double skipInsert(SymbolicValue b)
skipInsert
in interface SkipComparator<SymbolicValue>
b
- a value.public double delete(SymbolicValue a)
delete
in interface GapComparator<SymbolicValue>
a
- a value.public double insert(SymbolicValue b)
insert
in interface GapComparator<SymbolicValue>
b
- a value.public double compare(SymbolicValue a, SymbolicValue b)
compare
in interface Comparator<SymbolicValue>
a
- the left input.b
- the right input.public ValueType getType()
getType
in interface Comparator<SymbolicValue>
public double calculateLocalDerivative(int paramIdx, SymbolicValue a, SymbolicValue b, OperationType type)
calculateLocalDerivative
in interface DerivableComparator<SymbolicValue,double[][]>
paramIdx
- the index for this parameters.a
- the value that has been compared with b.b
- the value that has been compared with a.type
- the operation type that has actually been used in the
comparison.public SparseLocalDerivative calculateSparseLocalDerivative(SymbolicValue a, SymbolicValue b, OperationType type)
calculateSparseLocalDerivative
in interface SparseDerivableComparator<SymbolicValue,double[][]>
a
- the value that has been compared with b.b
- the value that has been compared with a.type
- the operation type that has actually been used in the
comparison.public Class<double[][]> getResultClass()
DerivableComparator
getResultClass
in interface DerivableComparator<SymbolicValue,double[][]>
public double[][] transformToResult(double[] derivatives)
DerivableComparator
transformToResult
in interface DerivableComparator<SymbolicValue,double[][]>
derivatives
- the derivatives for all parameters of this comparator
in its vectorial form.public int getNumberOfParameters()
DerivableComparator
getNumberOfParameters
in interface DerivableComparator<SymbolicValue,double[][]>
Copyright © 2014. All rights reserved.