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 cupy as cp | |
import cuml | |
ary = cp.array([[1.0, 4.0, 4.0], [2.0, 2.0, 2.0], [5.0, 1.0, 1.0]]) | |
kmeams = cuml.KMeans(n_clusters=2, output_type='numpy') | |
kmeans.fit(ary) | |
print(type(kmeans.labels_)) | |
# <class 'numpy.ndarray'> |
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 cudf | |
df = cudf.DataFrame() | |
df[1] = [1.0, 2.0, 5.0] | |
df[2] = [4.0, 2.0. 1.0] | |
df[3] = [4.0, 2.0. 1.0] | |
kmeans = cuml.KMeans(n_clusters=2) | |
kmeans.fit(df) |
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_)) |
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 cupy as cp | |
import numpy as np | |
import cuml | |
cuml.set_global_output_type('numpy') | |
ary = cp.array([[1.0, 4.0, 4.0], [2.0, 2.0, 2.0], [5.0, 1.0, 1.0]]) | |
kmeans = cuml.KMeans(n_clusters=2) | |
kmeans.fit(ary) |
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 numpy as np | |
ary = np.array([[1.0, 4.0, 4.0], [2.0, 2.0, 2.0], [5.0, 1.0, 1.0]]) | |
kmeans = cuml.KMeans(n_clusters=2) | |
kmeans.fit(ary) | |
print(type(kmeans.labels_)) | |
# <class ‘numpy.ndarray’> |