dise#
- nvmolkit.clustering.dise(
- distance_matrix: AsyncGpuResult | Tensor | ndarray,
- cutoff: float,
- *,
- assignment: Literal['first', 'nearest'] = 'nearest',
- stream: Stream | None = None,
- output: OutputMode = OutputMode.DEVICE,
Cluster a distance matrix by directed sphere exclusion (DISE).
Centroids are the leaders selected by
leader(). Withassignment="first", each item joins the first centroid that excluded it; with"nearest", each non-centroid joins its nearest centroid, with ties going to the earlier centroid. Clusters are ordered by descending size, then by centroid selection order.Distances are compared in float32, so a distance within float32 rounding of the cutoff can be classified differently than in double precision, and distances within float32 rounding of each other tie in
"nearest"assignment.- Parameters:
distance_matrix – Square float32 or float64 matrix of shape
(N, N). Element[i, j]is the distance from itemito itemj. Values are converted to float32 for comparisons. Values that overflow float32 during conversion become infinity.cutoff – Inclusive exclusion distance, rounded to float32. Must be between zero and the largest finite float32 value.
assignment –
"first"or"nearest".stream – CUDA stream to use. If None, uses the current stream.
output – Result representation.
- Returns:
A
ClusterDeviceResultforOutputMode.DEVICE, or centroid-first tuples of input indices forOutputMode.RDKIT.