diff --git a/python/pylibraft/pylibraft/cluster/kmeans.pyx b/python/pylibraft/pylibraft/cluster/kmeans.pyx index 04a76a96b6..6521da1a12 100644 --- a/python/pylibraft/pylibraft/cluster/kmeans.pyx +++ b/python/pylibraft/pylibraft/cluster/kmeans.pyx @@ -203,11 +203,24 @@ def compute_new_centroids(X, @auto_sync_handle @auto_convert_output def init_plus_plus(X, n_clusters=None, seed=None, handle=None, centroids=None): - if n_clusters is not None and centroids is not None: - msg = ("Parameters 'n_clusters' and 'centroids' are exclusive. Only " + - "pass one at a time.") - raise RuntimeError(msg) + """ + Compute initial centroids using the "kmeans++" algorithm. + + Parameters + ---------- + + X : Input CUDA array interface compliant matrix shape (m, k) + n_clusters : Number of clusters to select + seed : Controls the random sampling of centroids + centroids : Optional writable CUDA array interface compliant matrix shape + (n_clusters, k). Use instead of passing `n_clusters`. + {handle_docstring} + + Examples + -------- + >>> import cupy as cp + """ cdef device_resources *h = handle.getHandle() X_cai = cai_wrapper(X)