A centroid is the arithmetic mean position of the points assigned to a cluster. For molecular fingerprints, it represents the cluster center used to find representative compounds.
Selecting compounds near a centroid
Convert each cluster's fingerprints into an array, compute the mean with NumPy, measure Euclidean distances using SciPy, and select the closest molecules. Clusters smaller than the requested sample size are retained in full.









