-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add clustering #68
Add clustering #68
Conversation
|
||
|
||
def train_kmeans(features, n_clusters, path_to_kmeans, balanced=False, device='cpu'): | ||
kmeans = BalancedKMeans(n_clusters=n_clusters, device=device, balanced=balanced) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to note that on my local, n_clusters is not a parameter, but num_clusters is -- does this work for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad - I did some refactoring on Huu's codebase and changed its name, will update it ASAP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
additionally, since I'm not using KMeans, but kmeans -- cannot be instantiated without X, which needs to be a torch object or else it fails
if this worked for you, great -- will sync up with you to figure out why it didn't on my env
if not, then we'll need to figure out a way to use pytorch-kmeans in batches since instantiation isn't immediately possible -- open to suggestions here
|
||
from torch.utils.data import DataLoader, IterableDataset | ||
|
||
from kmeans_pytorch import KMeans as BalancedKMeans |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had issues with importing KMeans, turned up an error
but no issues importing kmeans -- did you experience this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you use the kmeans from pip or the one from https://github.com/kernelmachine/cbtm?
I've added some clustering experiments, be aware that to run the traditional clustering you need to install the kmeans from https://github.com/kernelmachine/cbtm