fused_maxmin#
- nvmolkit.pickers.fused_maxmin(
- x,
- pick_size: int,
- *,
- metric: Literal['tanimoto', 'cosine', 'aap'] | TanimotoMetric | CosineMetric | AAPMetric = 'tanimoto',
- first_picks: Sequence[int] = (),
- seed: int = -1,
- threshold: float | None = None,
- stream: Stream | None = None,
- output: OutputMode = OutputMode.DEVICE,
Select a diverse subset by greedy MaxMin, computing distances as needed.
Equivalent to
maxmin()on the matrix of1 - similarityvalues, with memory that scales asO(N). Distances are computed in float32, so results can differ slightly from RDKit’s double-precision results.- Parameters:
x – Packed int32 or uint32 fingerprints of shape
(N, num_words)for Tanimoto and cosine, or a sequence of RDKit molecules for AAP.pick_size – Number of items to select, from 1 through
N. Allfirst_picksare retained even if they exceed this limit.metric – Similarity metric.
first_picks – Unique indices that start the selection, in order. If empty, the first pick is drawn at random.
seed – Seed for the random first pick. Negative values use system entropy.
threshold – Stop before adding a candidate whose nearest-pick distance is at most this value. Distances and the threshold are compared in float32. Must be in
[0, 1], or None for no threshold.stream – CUDA stream to use. If None, uses the current stream.
output – Result representation.
- Returns:
(indices, last_distance).indicesis anAsyncGpuResultof int32 indices forOutputMode.DEVICE, or a tuple of indices forOutputMode.RDKIT.last_distanceis the nearest-pick distance of the last item added, or-1if none was added afterfirst_picks.