fused_butina#

nvmolkit.clustering.fused_butina(
x: AsyncGpuResult | Tensor | ndarray,
cutoff: float,
metric: Literal['tanimoto', 'cosine', 'aap'] | TanimotoMetric | CosineMetric | AAPMetric = 'tanimoto',
stream: Stream | None = None,
*,
output: Literal[OutputMode.DEVICE] = OutputMode.DEVICE,
) → ClusterDeviceResult#
nvmolkit.clustering.fused_butina(
x: AsyncGpuResult | Tensor | ndarray,
cutoff: float,
metric: Literal['tanimoto', 'cosine', 'aap'] | TanimotoMetric | CosineMetric | AAPMetric = 'tanimoto',
stream: Stream | None = None,
*,
output: Literal[OutputMode.RDKIT],
) → tuple[tuple[int, ...], ...]

Perform Butina clustering on fingerprints, computing distances as needed.

Equivalent to butina() on the matrix of 1 - similarity values, without forming the N x N matrix.

Parameters:
  • x – Packed int32 or uint32 fingerprints of shape (N, num_words). Can be an AsyncGpuResult, torch.Tensor, or numpy.ndarray. CPU tensors and NumPy arrays are copied to CUDA.

  • cutoff – Inclusive neighbor distance in [0, 1].

  • metric – Similarity metric. AAPMetric is not yet supported.

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

  • output – Result representation.

Returns:

A ClusterDeviceResult for OutputMode.DEVICE, or the centroid-first cluster tuples returned by RDKit’s Butina.ClusterData for OutputMode.RDKIT.