crossTanimotoSimilarity#

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

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

Expects fingerprints generated by nvMolKit or as a torch tensor located on device 0, with the leading dimension corresponding to the number of fingerprints, and the second dimension representing the packed fingerprint bitfield.

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 or AsyncGpuResult computed from nvMolKit fingerprints

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

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.