Created
April 28, 2020 14:58
-
-
Save dantegd/7330b63446d2584be5993143bac341aa to your computer and use it in GitHub Desktop.
Usage of cuML's context manager `using_output_type`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cuml | |
import cupy as cp | |
ary = [[1.0, 4.0, 4.0], [2.0, 2.0, 2.0], [5.0, 1.0, 1.0]] | |
ary = cp.asarray(ary) | |
with cuml.using_output_type('cudf'): | |
dbscan = cuml.DBSCAN(eps=1.0, min_samples=1) | |
dbscan.fit(ary) | |
print(type(dbscan_float.labels_)) | |
# <class 'cudf.core.Series'> | |
kmeans = cuml.KMeans(n_clusters=2) | |
kmeans.fit(ary) | |
print(type(kmeans.labels_)) | |
# <class 'cupy.core.core.ndarray'> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment