X
- the node class for the left input.Y
- the node class for the right input.public class CooptimalMatrix<X,Y> extends Object implements DerivableAlignmentDistance<X,Y>
Modifier and Type | Class and Description |
---|---|
static class |
CooptimalMatrix.SparseMatrix
A sparse matrix class which maps from MatrixCoordinates to Doubles.
|
Constructor and Description |
---|
CooptimalMatrix(double[][] p_rep,
double[] p_del,
double[] p_ins,
List<X> left,
List<Y> right,
double distance,
double K)
Initializes a CooptimalMatrix with the given operation frequencies.
|
CooptimalMatrix(List<X> left,
List<Y> right,
double distance,
double K)
Initializes an empty CooptimalMatrix.
|
CooptimalMatrix(Map<? extends MatrixEngine.MatrixCoordinate,Double> p_rep,
double[] p_del,
double[] p_ins,
List<X> left,
List<Y> right,
double distance,
double K)
Initializes a CooptimalMatrix with the given operation frequencies.
|
Modifier and Type | Method and Description |
---|---|
double[] |
computeGradient(DerivableComparator<X,Y> comp)
This computes the gradient of this DerivableAlignmentDistance w.r.t. the parameters of the
given Comparator.
|
double |
editDistance(Comparator<X,Y> comparator)
Returns the edit distance corresponding to this CooptimalMatrix using the given comparator.
|
static double |
editDistance(Map<? extends MatrixEngine.MatrixCoordinate,Double> p_rep,
double[] p_del,
double[] p_ins,
double[][] rep,
double[] del,
double[] ins)
Returns the edit distance corresponding to the given frequency matrix P and the given costs
for replacement, deletion and insertion.
|
static double |
editDistance(Map<? extends MatrixEngine.MatrixCoordinate,Double> p_rep,
double[] p_del,
double[] p_ins,
Map<? extends MatrixEngine.MatrixCoordinate,Double> rep,
double[] del,
double[] ins)
Returns the edit distance corresponding to the given frequency matrix P and the given costs
for replacement, deletion and insertion.
|
static <X,Y> CooptimalMatrix<X,Y> |
fromAlignment(Alignment<X,Y> alignment)
Generates a CooptimalMatrix from a given alignment.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDistance, getLeft, getRight
public CooptimalMatrix(@NonNull Map<? extends MatrixEngine.MatrixCoordinate,Double> p_rep, @NonNull double[] p_del, @NonNull double[] p_ins, @NonNull List<X> left, @NonNull List<Y> right, double distance, double K)
p_rep
- a sparse m x n matrix where p_rep[i][j] is the fraction of co-optimal alignments
in which node xi is replaced with node yj.p_del
- a m x 1 vector where p_del[i] is the fraction of co-optimal alignments in which
node xi is deleted.p_ins
- a 1 x n vector where p_ins[j] is the fraction of co-optimal alignments in which
node yj is inserted.left
- the left input sequence.right
- the right input sequence.distance
- the edit distance between left and right.K
- the number of co-optimal alignments.public CooptimalMatrix(@NonNull double[][] p_rep, @NonNull double[] p_del, @NonNull double[] p_ins, @NonNull List<X> left, @NonNull List<Y> right, double distance, double K)
p_rep
- a dense m x n matrix where p_rep[i][j] is the fraction of co-optimal alignments
in which node xi is replaced with node yj.p_del
- a m x 1 vector where p_del[i] is the fraction of co-optimal alignments in which
node xi is deleted.p_ins
- a 1 x n vector where p_ins[j] is the fraction of co-optimal alignments in which
node yj is inserted.left
- the left input sequence.right
- the right input sequence.distance
- the edit distance between left and right.K
- the number of co-optimal alignments.public CooptimalMatrix(@NonNull List<X> left, @NonNull List<Y> right, double distance, double K)
left
- the left input sequence.right
- the right input sequence.distance
- the edit distance between left and right.K
- the number of co-optimal alignments.public double editDistance(@NonNull Comparator<X,Y> comparator)
comparator
- a Comparatorpublic static double editDistance(@NonNull Map<? extends MatrixEngine.MatrixCoordinate,Double> p_rep, @NonNull double[] p_del, @NonNull double[] p_ins, @NonNull Map<? extends MatrixEngine.MatrixCoordinate,Double> rep, @NonNull double[] del, @NonNull double[] ins)
p_rep
- a sparse m x n matrix where p_rep[i][j] is the fraction of co-optimal alignments
in which node xi is replaced with node yj.p_del
- a m x 1 vector where p_del[i] is the fraction of co-optimal alignments in which
node xi is deleted.p_ins
- a 1 x n vector where p_ins[j] is the fraction of co-optimal alignments in which
node yj is inserted.rep
- a sparse m x n matrix of replacement costs.del
- a m x 1 vector of deletion costs.ins
- a 1 x n vector of insertion costs.public static double editDistance(@NonNull Map<? extends MatrixEngine.MatrixCoordinate,Double> p_rep, @NonNull double[] p_del, @NonNull double[] p_ins, @NonNull double[][] rep, @NonNull double[] del, @NonNull double[] ins)
p_rep
- a sparse m x n matrix where p_rep[i][j] is the fraction of co-optimal alignments
in which node xi is replaced with node yj.p_del
- a m x 1 vector where p_del[i] is the fraction of co-optimal alignments in which
node xi is deleted.p_ins
- a 1 x n vector where p_ins[j] is the fraction of co-optimal alignments in which
node yj is inserted.rep
- a m x n matrix of replacement costs.del
- a m x 1 vector of deletion costs.ins
- a 1 x n vector of insertion costs.public double[] computeGradient(DerivableComparator<X,Y> comp)
DerivableAlignmentDistance
computeGradient
in interface DerivableAlignmentDistance<X,Y>
comp
- the DerivableComparator that was used in computing this distance.public static <X,Y> CooptimalMatrix<X,Y> fromAlignment(@NonNull Alignment<X,Y> alignment)
X
- the class of left-side nodes in the given alignment.Y
- the class of right-side nodes in the given alignment.alignment
- an Alignment.Copyright (C) 2016-2018 Benjamin Paaßen, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs . This documentation is licensed under the conditions of CC-BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/