Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Usage of cuML's context manager `using_output_type`
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