crossTanimotoSimilarity#

nvmolkit.similarity.crossTanimotoSimilarity(
fingerprint_group_one: AsyncGpuResult | Tensor | ndarray,
fingerprint_group_two: AsyncGpuResult | Tensor | ndarray | None = None,
stream: Stream | None = None,
) AsyncGpuResult#

Returns the Tanimoto similarity within a set of fingerprints or between two sets of fingerprints.

Expects fingerprints generated by nvMolKit, a torch tensor, or a numpy array, with the leading dimension corresponding to the number of fingerprints, and the second dimension representing the packed fingerprint bitfield. CPU tensors and NumPy arrays are copied to CUDA.

The special case of fingerprint_group_1 as a 1 x n_bits tensor is equivalent to RDKit’s BulkTanimotoSimilarity.

Parameters:
  • fingerprint_group_one – A torch Tensor, numpy.ndarray, or AsyncGpuResult computed from nvMolKit fingerprints

  • fingerprint_group_two – A torch Tensor, numpy.ndarray, or AsyncGpuResult computed from nvMolKit fingerprints, or None for all-to-all similarity within fingerprint_group_one.

  • stream – CUDA stream to use. If None, uses the current stream.

Returns:

An n x m matrix of Tanimoto similarities, with index [i, j] corresponding to the similarity between fingerprint i in fingerprint_group_one and fingerprint j in fingerprint_group_two. If fingerprint_group_two is None, computes all-to-all similarity within fingerprint_group_one.