tidymodels / embed

Extra recipes for predictor embeddings
https://embed.tidymodels.org
Other
142 stars 18 forks source link

FR: For each of the UMAP clusters, information/ID on values (from which columns) assigned to which UMAP clusters would be nice #130

Closed exsell-jc closed 1 year ago

exsell-jc commented 2 years ago

Scenario: when using step_umap() (I guess other methods like step_knn() can apply), they are assigned to different clusters.

It would be really nice to know the following: 1) Which values from which columns are assigned to that/each cluster 2) Affinity of columns (e.g. majority of the columns' values) belonging to a particular cluster

For my particular case, 2) is more interesting to me; 1) is more details.

To clarify, consider the following scenario:

Essentially, the last bullet point is what I would like the new feature to be.

Thank you for reading

juliasilge commented 2 years ago

The UMAP algorithm doesn't really have the concept of a cluster the way you are talking about here. You can read more here in the Python docs; notice what color is being mapped to (the label, not any output from UMAP). You need to cluster on top of the UMAP results, like with HDBSCAN in that example.

If you would like to get out cluster assignments from k-means, take a look at this article (you'll want to augment() your original data points).

exsell-jc commented 2 years ago

The UMAP algorithm doesn't really have the concept of a cluster the way you are talking about here. You can read more here in the Python docs; notice what color is being mapped to (the label, not any output from UMAP). You need to cluster on top of the UMAP results, like with HDBSCAN in that example.

If you would like to get out cluster assignments from k-means, take a look at this article (you'll want to augment() your original data points).

Thanks, really nice to know about augment().

Do you happen to know an alternative that's not distance based like KNN? With more sample size, KNN would not really work.

juliasilge commented 2 years ago

Have you taken a look at something like mclust? Or this Stack Overflow answer outlines some nice options.

topepo commented 2 years ago

UMAP is sort of distance based, just on a complex manifold.

I think that the main problem is defining the membership function. With classical clustering methods, we would look at the distance to each class centroid. For UMAP the notions of distance and centroid are not well defined.

EmilHvitfeldt commented 1 year ago

It also might be worth it to look at https://tidyclust.tidymodels.org/, which is our package for dealing with clustering problem.

I'm going to close this issue for now. If you have any further problem/questions/praise feel free to open another issue!

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.