Interface DescriptorComparator<D extends Descriptor>

Type Parameters:
D - Type of compared descriptors
All Superinterfaces:
Guarded, Serializable
All Known Subinterfaces:
CfpComparator, EcfpComparator, MaccsComparator, PfComparator, ShapeComparator<T>
All Known Implementing Classes:
AbstractShapeComparator

@Beta @PublicApi public interface DescriptorComparator<D extends Descriptor> extends Serializable, Guarded
Common functionality for descriptor comparison.

Please note that descriptor comparison is done on the bare descriptor level.

Please note that this interface is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.

  • Method Details

    • compare

      ComparisonResult compare(D target, D query)
      Compare two descriptors.

      Please note that some implementation might return a result object containing additional data related to the compariosn results.

      Parameters:
      target - Target descriptor
      query - Query descriptor
      Returns:
      Comparison result wrapper
    • compare

      ComparisonResult compare(byte[] target, byte[] query)
      Compare two descriptors in serialized form.

      Please note that some implementation might return a result object containing additional data related to the compariosn results. This method's functionality is equivalent to comparing (with compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)) deserialized (by DescriptorSerializer.fromByteArray(byte[])) descriptors.

      Parameters:
      target - Target descriptor in its serialized form
      query - Query descriptor in its serialized form
      Returns:
      Comparison result wrapper
    • calculateSimilarity

      double calculateSimilarity(D target, D query)
      Compare two descriptors.

      Please note that this convenience method wraps ComparisonResult.getSimilarity() of comparison result constructed by compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)

      Parameters:
      target - Target descriptor
      query - Query descriptor
      Returns:
      Similarity result
    • calculateDissimilarity

      double calculateDissimilarity(D target, D query)
      Compare two descriptors.

      Please note that this convenience method wraps ComparisonResult.getDissimilarity() of comparison result constructed by compare(com.chemaxon.descriptors.common.Descriptor, com.chemaxon.descriptors.common.Descriptor)

      Parameters:
      target - Target descriptor
      query - Query descriptor
      Returns:
      Dissimilarity result
    • calculateSimilarity

      double calculateSimilarity(byte[] target, byte[] query)
      Compare two descriptors in serialized form.
      Parameters:
      target - Target descriptor in its serialized form
      query - Query descriptor in its serialized form
      Returns:
      Similarity result
    • calculateDissimilarity

      double calculateDissimilarity(byte[] target, byte[] query)
      Compare two descriptors in serialized form.
      Parameters:
      target - Target descriptor in its serialized form
      query - Query descriptor in its serialized form
      Returns:
      Dissimilarity result
    • getLowerBound

      Optional<Double> getLowerBound()
      Get lower bound for the similarity/dissimilarity values if such one can be determined.
      Returns:
      Lower bond if exists; otherwise absent
    • getUpperBound

      Optional<Double> getUpperBound()
      Get upper bound for the similarity/dissimilarity values if such one can be determined.
      Returns:
      Upper bond if exists; otherwise absent
    • getMetricMetadata

      MetricMetadata getMetricMetadata()
      Metadata about this metric.

      It is guaranteed that the actual instance returned can be used as a parameter of the appropriate comparator getter method of the associated DescriptorGenerator

      Returns:
      Metadata of the comparison
    • unguardedContext

      com.chemaxon.descriptors.common.unguarded.UnguardedContext<D,?> unguardedContext()
      Associated unguarded context. For internal use only.
      Returns:
      unguarded context