rapidsai / cuml

cuML - RAPIDS Machine Learning Library
https://docs.rapids.ai/api/cuml/stable/
Apache License 2.0
4.17k stars 528 forks source link

How can i use AgglomerativeClustering? #3843

Open zahs123 opened 3 years ago

zahs123 commented 3 years ago

I have downloaded rapids19 to i can use AgglomerativeClustering. Traditionally i would pass a distance matrix and a dendogram would be computed. It is not clear to me though how i can use this function in cuml to 1) get distance matrix 2)produce dendogram ... can somebody please post how i can do this using cuml?

Nanthini10 commented 3 years ago

I'm not sure what you mean by that - is there something you tried that didn't work?

If you're just looking for example usage, the API is similar to the sklearn.cluster.AgglomerativeClustering refer to cuml.AgglomerativeClustering

Here's a simple example:

from cuml.cluster import AgglomerativeClustering
from cuml.datasets import make_blobs

X, y = make_blobs(random_state=42)
cuml_agg = AgglomerativeClustering()
cuml_agg.fit(X)
clustering.labels_
cjnolet commented 3 years ago

how i can use this function in cuml to 1) get distance matrix 2)produce dendogram

@zahs123, cuML's AgglomerativeClustering does not accept a distance matrix directly, but it could. Is this a feature you are interested in using? If so, we can convert this issue into a feature request.

zahs123 commented 3 years ago

sorry for late reply! the sklearn one is able to take a distance matric, this is a feature i would be interested in. Also, usually with hierarchal clustering you take the distance matrix and pass it through a dendogram function as you do with sklearn, from this you infer the number of clusters required then pass it through a aggclustering function. e..g in sklearn it is: dendrogram = sch.dendrogram(sch.linkage(X, method = "ward")) , where X is the dataset.

I am not sure how i can use the rapids hierarchal clusteirng if i cannot plot dendgogram

github-actions[bot] commented 2 years ago

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.