From c20f3736c4c4a62874cf178112af27b80fc179cb Mon Sep 17 00:00:00 2001 From: John Zedlewski <904524+JohnZed@users.noreply.github.com> Date: Mon, 5 Apr 2021 08:42:58 -0700 Subject: [PATCH 1/2] Add sparse docstring comments --- python/cuml/manifold/t_sne.pyx | 1 + python/cuml/manifold/umap.pyx | 1 + python/cuml/metrics/pairwise_distances.pyx | 5 +++-- python/cuml/neighbors/nearest_neighbors.pyx | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/python/cuml/manifold/t_sne.pyx b/python/cuml/manifold/t_sne.pyx index 75bbbdaaed..9a05ee9e26 100644 --- a/python/cuml/manifold/t_sne.pyx +++ b/python/cuml/manifold/t_sne.pyx @@ -369,6 +369,7 @@ class TSNE(Base, self.sparse_fit = False @generate_docstring(skip_parameters_heading=True, + X='dense_sparse', convert_dtype_cast='np.float32') def fit(self, X, convert_dtype=True, knn_graph=None) -> "TSNE": """ diff --git a/python/cuml/manifold/umap.pyx b/python/cuml/manifold/umap.pyx index 451109b052..2b2c7bec02 100644 --- a/python/cuml/manifold/umap.pyx +++ b/python/cuml/manifold/umap.pyx @@ -553,6 +553,7 @@ class UMAP(Base, return (None, None), (None, None) @generate_docstring(convert_dtype_cast='np.float32', + X='dense_sparse', skip_parameters_heading=True) def fit(self, X, y=None, convert_dtype=True, knn_graph=None) -> "UMAP": diff --git a/python/cuml/metrics/pairwise_distances.pyx b/python/cuml/metrics/pairwise_distances.pyx index 57c4dc9a90..f15f2ac91c 100644 --- a/python/cuml/metrics/pairwise_distances.pyx +++ b/python/cuml/metrics/pairwise_distances.pyx @@ -148,9 +148,10 @@ def pairwise_distances(X, Y=None, metric="euclidean", handle=None, Parameters ---------- - X : array-like (device or host) of shape (n_samples_x, n_features) + X : Dense or sparse matrix (device or host) of shape (n_samples_x, n_features) Acceptable formats: cuDF DataFrame, NumPy ndarray, Numba device - ndarray, cuda array interface compliant array like CuPy + ndarray, cuda array interface compliant array like CuPy, or + cupyx.scipy.sparse for sparse input Y : array-like (device or host) of shape (n_samples_y, n_features),\ optional diff --git a/python/cuml/neighbors/nearest_neighbors.pyx b/python/cuml/neighbors/nearest_neighbors.pyx index abe1e27ef0..31a2bd4fe1 100644 --- a/python/cuml/neighbors/nearest_neighbors.pyx +++ b/python/cuml/neighbors/nearest_neighbors.pyx @@ -319,7 +319,7 @@ class NearestNeighbors(Base, self.algo_params = algo_params self.knn_index = 0 - @generate_docstring() + @generate_docstring(X='dense_sparse') def fit(self, X, convert_dtype=True) -> "NearestNeighbors": """ Fit GPU index for performing nearest neighbor queries. From 7769cf3b363bbd726d03ffda898fbb002bfac33b Mon Sep 17 00:00:00 2001 From: John Zedlewski <904524+JohnZed@users.noreply.github.com> Date: Mon, 5 Apr 2021 10:01:54 -0700 Subject: [PATCH 2/2] Fix long line --- python/cuml/metrics/pairwise_distances.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/cuml/metrics/pairwise_distances.pyx b/python/cuml/metrics/pairwise_distances.pyx index f15f2ac91c..9ba7d5dce4 100644 --- a/python/cuml/metrics/pairwise_distances.pyx +++ b/python/cuml/metrics/pairwise_distances.pyx @@ -148,7 +148,8 @@ def pairwise_distances(X, Y=None, metric="euclidean", handle=None, Parameters ---------- - X : Dense or sparse matrix (device or host) of shape (n_samples_x, n_features) + X : Dense or sparse matrix (device or host) of shape + (n_samples_x, n_features) Acceptable formats: cuDF DataFrame, NumPy ndarray, Numba device ndarray, cuda array interface compliant array like CuPy, or cupyx.scipy.sparse for sparse input