Package com.chemaxon.descriptors.metrics
Class TverskyParameters
java.lang.Object
com.chemaxon.descriptors.metrics.TverskyParameters
- All Implemented Interfaces:
BinaryVectorComparator
,MetricMetadata
,Serializable
@Beta
@PublicApi
public class TverskyParameters
extends Object
implements MetricMetadata, BinaryVectorComparator, Serializable
Parameters for Tversky index.
Please note that this class is marked with @Beta annotation, so it can be subject of incompatible changes or removal in later releases.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder for parameter object.Nested classes/interfaces inherited from interface com.chemaxon.descriptors.metrics.BinaryVectorComparator
BinaryVectorComparator.Util
-
Constructor Summary
ModifierConstructorDescriptionInstantiate with default values.TverskyParameters
(double coeffQuery, double coeffTarget) Instantiate with weights.protected
Instantiate with builder's actual state. -
Method Summary
Modifier and TypeMethodDescriptiondouble
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
Query side coefficient.double
Target side coefficient.double
getLowerBoundForBinaryVectors
(int bitCount) Possible lowest value of similarity/dissimilarity scores.com.chemaxon.descriptors.common.unguarded.UnguardedDissimilarityCalculator<long[]>
getUnguardedDissimilarityCalculator
(int bitCount) Get a suitable dissimilarity calculator for unguarded packedlong[]
representations.double
getUpperBoundForBinaryVectors
(int bitCount) Possible highest value of similarity/dissimilarity scores.boolean
Zero dissimilarity and identity.boolean
Metric space.boolean
Non negativeness of the dissimilarity values.boolean
Symmetry.boolean
Triangle inequality.static TverskyParameters
of
(double coeffQuery, double coeffTarget) Convenience factory function.toString()
-
Constructor Details
-
TverskyParameters
Instantiate with builder's actual state.- Parameters:
builder
- State to represent
-
TverskyParameters
public TverskyParameters()Instantiate with default values. -
TverskyParameters
public TverskyParameters(double coeffQuery, double coeffTarget) Instantiate with weights.- Parameters:
coeffQuery
- Query side coefficientcoeffTarget
- Target side coefficient
-
-
Method Details
-
isSymmetric
public boolean isSymmetric()Description copied from interface:MetricMetadata
Symmetry.- Specified by:
isSymmetric
in interfaceMetricMetadata
- Returns:
- true when
d(x,y) = d(y,x)
- See Also:
-
isNonNegative
public boolean isNonNegative()Description copied from interface:MetricMetadata
Non negativeness of the dissimilarity values.- Specified by:
isNonNegative
in interfaceMetricMetadata
- Returns:
- true when
d(x,y) >= 0
- See Also:
-
isDissimilarityZeroIFFEquals
public boolean isDissimilarityZeroIFFEquals()Description copied from interface:MetricMetadata
Zero dissimilarity and identity.- Specified by:
isDissimilarityZeroIFFEquals
in interfaceMetricMetadata
- Returns:
- true when dissimilarity is 0 for (and only for) identical descriptors
- See Also:
-
isTriangeInequalityHolds
public boolean isTriangeInequalityHolds()Description copied from interface:MetricMetadata
Triangle inequality.- Specified by:
isTriangeInequalityHolds
in interfaceMetricMetadata
- Returns:
- true when
d(x,z) <= d(x,y) + d( y,z)
- See Also:
-
isMetricSpace
public boolean isMetricSpace()Description copied from interface:MetricMetadata
Metric space.- Specified by:
isMetricSpace
in interfaceMetricMetadata
- Returns:
- If this comparator defines a metric space.
- See Also:
-
calculateBinaryVectorDissimilarity
public double calculateBinaryVectorDissimilarity(int bitCount, int targetOnly, int queryOnly, int common) Description copied from interface:BinaryVectorComparator
Calculate represented dissimilarity score from binary vector parameters.- Specified by:
calculateBinaryVectorDissimilarity
in interfaceBinaryVectorComparator
- Parameters:
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 bits- Returns:
- Dissimilarity score
-
calculateBinaryVectorSimilarity
public double calculateBinaryVectorSimilarity(int bitCount, int targetOnly, int queryOnly, int common) Description copied from interface:BinaryVectorComparator
Calculate represented similarity score from binary vector parameters.- Specified by:
calculateBinaryVectorSimilarity
in interfaceBinaryVectorComparator
- Parameters:
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 bits- Returns:
- Ssimilarity score
-
getLowerBoundForBinaryVectors
public double getLowerBoundForBinaryVectors(int bitCount) Description copied from interface:BinaryVectorComparator
Possible lowest value of similarity/dissimilarity scores.- Specified by:
getLowerBoundForBinaryVectors
in interfaceBinaryVectorComparator
- Parameters:
bitCount
- Length of binary vectors in bits- Returns:
- Possible lowest value of similarity/dissimilarity scores
-
getUpperBoundForBinaryVectors
public double getUpperBoundForBinaryVectors(int bitCount) Description copied from interface:BinaryVectorComparator
Possible highest value of similarity/dissimilarity scores.- Specified by:
getUpperBoundForBinaryVectors
in interfaceBinaryVectorComparator
- Parameters:
bitCount
- Length of binary vectors in bits- Returns:
- Possible highest value of similarity/dissimilarity scores
-
getCoeffQuery
public double getCoeffQuery()Query side coefficient.- Returns:
- Query coefficient
-
getCoeffTarget
public double getCoeffTarget()Target side coefficient.- Returns:
- Target coefficient
-
toString
-
getUnguardedDissimilarityCalculator
public com.chemaxon.descriptors.common.unguarded.UnguardedDissimilarityCalculator<long[]> getUnguardedDissimilarityCalculator(int bitCount) Description copied from interface:BinaryVectorComparator
Get a suitable dissimilarity calculator for unguarded packedlong[]
representations. For internal use only.- Specified by:
getUnguardedDissimilarityCalculator
in interfaceBinaryVectorComparator
- Parameters:
bitCount
- Bit count of the fingerprints; always is a multiply of 64- Returns:
- Unguarded calculator
-
of
Convenience factory function.- Parameters:
coeffQuery
- Query side penalty coefficientcoeffTarget
- Target side penalty coefficient- Returns:
- representation of given parameters
-