@Beta @PublicAPI public class TverskyParameters extends Object implements MetricMetadata, BinaryVectorComparator, Serializable
Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
Modifier and Type | Class and Description |
---|---|
static class |
TverskyParameters.Builder
Builder for parameter object.
|
BinaryVectorComparator.Util
Modifier | Constructor and Description |
---|---|
|
TverskyParameters()
Instantiate with default values.
|
|
TverskyParameters(double coeffQuery,
double coeffTarget)
Instantiate with weights.
|
protected |
TverskyParameters(TverskyParameters.Builder builder)
Instantiate with builder's actual state.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateBinaryVectorDissimilarity(int bitCount,
int targetOnly,
int queryOnly,
int common)
Calculate represented dissimilarity score from binary vector parameters.
|
double |
calculateBinaryVectorSimilarity(int bitCount,
int targetOnly,
int queryOnly,
int common)
Calculate represented similarity score from binary vector parameters.
|
double |
getCoeffQuery()
Query side coefficient.
|
double |
getCoeffTarget()
Target side coefficient.
|
double |
getLowerBoundForBinaryVectors(int bitCount)
Possible lowest value of similarity/dissimilarity scores.
|
UnguardedDissimilarityCalculator<long[]> |
getUnguardedDissimilarityCalculator(int bitCount)
Get a suitable dissimilarity calculator for unguarded packed
long[] representations. |
double |
getUpperBoundForBinaryVectors(int bitCount)
Possible highest value of similarity/dissimilarity scores.
|
boolean |
isDissimilarityZeroIFFEquals()
Zero dissimilarity and identity.
|
boolean |
isMetricSpace()
Metric space.
|
boolean |
isNonNegative()
Non negativeness of the dissimilarity values.
|
boolean |
isSymmetric()
Symmetry.
|
boolean |
isTriangeInequalityHolds()
Triangle inequality.
|
static TverskyParameters |
of(double coeffQuery,
double coeffTarget)
Convenience factory function.
|
String |
toString() |
protected TverskyParameters(TverskyParameters.Builder builder)
builder
- State to representpublic TverskyParameters()
public TverskyParameters(double coeffQuery, double coeffTarget)
coeffQuery
- Query side coefficientcoeffTarget
- Target side coefficientpublic boolean isSymmetric()
MetricMetadata
isSymmetric
in interface MetricMetadata
d(x,y) = d(y,x)
public boolean isNonNegative()
MetricMetadata
isNonNegative
in interface MetricMetadata
d(x,y) >= 0
public boolean isDissimilarityZeroIFFEquals()
MetricMetadata
isDissimilarityZeroIFFEquals
in interface MetricMetadata
public boolean isTriangeInequalityHolds()
MetricMetadata
isTriangeInequalityHolds
in interface MetricMetadata
d(x,z) <= d(x,y) + d( y,z)
public boolean isMetricSpace()
MetricMetadata
isMetricSpace
in interface MetricMetadata
public double calculateBinaryVectorDissimilarity(int bitCount, int targetOnly, int queryOnly, int common)
BinaryVectorComparator
calculateBinaryVectorDissimilarity
in interface BinaryVectorComparator
bitCount
- Length of binary vectors in bitstargetOnly
- Number of bit positions where only target contains set bitsqueryOnly
- Number of bit positions where only query contains set bitscommon
- Number of bit positions where both query and target contains set bitspublic double calculateBinaryVectorSimilarity(int bitCount, int targetOnly, int queryOnly, int common)
BinaryVectorComparator
calculateBinaryVectorSimilarity
in interface BinaryVectorComparator
bitCount
- Length of binary vectors in bitstargetOnly
- Number of bit positions where only target contains set bitsqueryOnly
- Number of bit positions where only query contains set bitscommon
- Number of bit positions where both query and target contains set bitspublic double getLowerBoundForBinaryVectors(int bitCount)
BinaryVectorComparator
getLowerBoundForBinaryVectors
in interface BinaryVectorComparator
bitCount
- Length of binary vectors in bitspublic double getUpperBoundForBinaryVectors(int bitCount)
BinaryVectorComparator
getUpperBoundForBinaryVectors
in interface BinaryVectorComparator
bitCount
- Length of binary vectors in bitspublic double getCoeffQuery()
public double getCoeffTarget()
public UnguardedDissimilarityCalculator<long[]> getUnguardedDissimilarityCalculator(int bitCount)
BinaryVectorComparator
long[]
representations.getUnguardedDissimilarityCalculator
in interface BinaryVectorComparator
bitCount
- Bit count of the fingerprints; always is a multiply of 64public static TverskyParameters of(double coeffQuery, double coeffTarget)
coeffQuery
- Query side penalty coefficientcoeffTarget
- Target side penalty coefficient