joshlk / k-means-constrained

K-Means clustering - constrained with minimum and maximum cluster size. Documentation: https://joshlk.github.io/k-means-constrained
https://github.com/joshlk/k-means-constrained
BSD 3-Clause "New" or "Revised" License
192 stars 43 forks source link

Possible to specify custom distance matrix? #17

Open amks1 opened 2 years ago

amks1 commented 2 years ago

Is it possible with this implementation to cluster using a custom distance matrix?

joshlk commented 2 years ago

No it does not. But if you want to hack your own solution you can try changing this line: https://github.com/joshlk/k-means-constrained/blob/eda40741431286a71bff72c59077287d1376fd31/k_means_constrained/k_means_constrained_.py#L402

amks1 commented 2 years ago

Thanks. Sorry if this is a dumb question, but are the cluster centers chosen from the set of input points?

bibblybobblyben commented 11 months ago

Hi - thanks for your work building this package. I have also come across the question of trying to implement a custom distance metric in the clustering so have opened a PR to address it. Happy to be corrected if this is not a desirable change in the main package.