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.

See Also:
  • Constructor Details

    • TverskyParameters

      protected TverskyParameters(TverskyParameters.Builder builder)
      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 coefficient
      coeffTarget - Target side coefficient
  • Method Details

    • isSymmetric

      public boolean isSymmetric()
      Description copied from interface: MetricMetadata
      Symmetry.
      Specified by:
      isSymmetric in interface MetricMetadata
      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 interface MetricMetadata
      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 interface MetricMetadata
      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 interface MetricMetadata
      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 interface MetricMetadata
      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 interface BinaryVectorComparator
      Parameters:
      bitCount - Length of binary vectors in bits
      targetOnly - Number of bit positions where only target contains set bits
      queryOnly - Number of bit positions where only query contains set bits
      common - 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 interface BinaryVectorComparator
      Parameters:
      bitCount - Length of binary vectors in bits
      targetOnly - Number of bit positions where only target contains set bits
      queryOnly - Number of bit positions where only query contains set bits
      common - 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 interface BinaryVectorComparator
      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 interface BinaryVectorComparator
      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

      public String toString()
      Overrides:
      toString in class Object
    • getUnguardedDissimilarityCalculator

      public com.chemaxon.descriptors.common.unguarded.UnguardedDissimilarityCalculator<long[]> getUnguardedDissimilarityCalculator(int bitCount)
      Description copied from interface: BinaryVectorComparator
      Get a suitable dissimilarity calculator for unguarded packed long[] representations. For internal use only.
      Specified by:
      getUnguardedDissimilarityCalculator in interface BinaryVectorComparator
      Parameters:
      bitCount - Bit count of the fingerprints; always is a multiply of 64
      Returns:
      Unguarded calculator
    • of

      public static TverskyParameters of(double coeffQuery, double coeffTarget)
      Convenience factory function.
      Parameters:
      coeffQuery - Query side penalty coefficient
      coeffTarget - Target side penalty coefficient
      Returns:
      representation of given parameters