public class NormalizedL1RelevanceComparator extends ComparisonBasedSkipExtendedComparator<double[],double[]>
Constructor and Description |
---|
NormalizedL1RelevanceComparator(double[] deleteComparison,
double[] insertComparison) |
NormalizedL1RelevanceComparator(double[] deleteComparison,
double[] insertComparison,
double[] skipDeleteComparison,
double[] skipInsertComparison) |
NormalizedL1RelevanceComparator(int dimensions) |
NormalizedL1RelevanceComparator(int dimensions,
double comparisonValue) |
Modifier and Type | Method and Description |
---|---|
double |
actualCompare(double[] a,
double[] 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)
|
Gradient |
computeComparisonGradient(double[] x,
double[] y)
Computes the gradient of the comparator function w.r.t.
|
static double |
distance(double[] a,
double[] b,
double[] w)
Returns the relevance-weighted L1 distance between the vectors a and b, given that
they have the same length.
|
double[] |
getComparisonParameters()
Return the current value of all parameters of this comparator.
|
int |
getNumberOfComparisonParameters()
Implementing classes should return the number of (derivative-relevant) parameters used for
the compare-function.
|
static double |
norm(double[] v,
double[] w)
Calculates the relevance-weighted L1 norm of the given input vector.
|
void |
setComparisonParameters(double[] params)
Sets the current value of all parameters of this comparator.
|
void |
setRelevanceWeights(double[] relevanceWeights)
The vector of relevance weights for each dimension.
|
compare, computeGradient, equals, hashCode
getNumberOfParameters, getParameters, hasCoherentReplacementCost, setParameters, supports
public NormalizedL1RelevanceComparator(int dimensions)
public NormalizedL1RelevanceComparator(int dimensions, double comparisonValue)
public NormalizedL1RelevanceComparator(double[] deleteComparison, double[] insertComparison)
public NormalizedL1RelevanceComparator(double[] deleteComparison, double[] insertComparison, double[] skipDeleteComparison, double[] skipInsertComparison)
public void setRelevanceWeights(@NonNull double[] relevanceWeights)
relevanceWeights
- The vector of relevance weights for each dimension.public double actualCompare(@NonNull double[] a, @NonNull double[] b)
SkipExtendedComparator
actualCompare
in class SkipExtendedComparator<double[],double[]>
a
- the left input.b
- the right input.public static double norm(@NonNull double[] v, @NonNull double[] w)
v
- a vector.w
- relevance weights for each dimension of vector v.public static double distance(@NonNull double[] a, @NonNull double[] b, @NonNull double[] w)
a
- a double vector.b
- a double vector.w
- relevance weights for each dimension of vectors.public Gradient computeComparisonGradient(@NonNull double[] x, @NonNull double[] y)
SkipExtendedComparator
computeComparisonGradient
in class SkipExtendedComparator<double[],double[]>
x
- the left input.y
- the right input.public int getNumberOfComparisonParameters()
SkipExtendedComparator
getNumberOfComparisonParameters
in class SkipExtendedComparator<double[],double[]>
public double[] getComparisonParameters()
SkipExtendedComparator
getComparisonParameters
in class SkipExtendedComparator<double[],double[]>
public void setComparisonParameters(double[] params)
SkipExtendedComparator
setComparisonParameters
in class SkipExtendedComparator<double[],double[]>
params
- the new value of all parameters of this comparator.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/