Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
betatim committed Jan 31, 2023
1 parent 3a54c2e commit 95ea557
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions python/pylibraft/pylibraft/cluster/kmeans.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <device_resources*><size_t>handle.getHandle()

X_cai = cai_wrapper(X)
Expand Down

0 comments on commit 95ea557

Please sign in to comment.