scikit-learn-contrib / scikit-learn-extra

scikit-learn contrib estimators
https://scikit-learn-extra.readthedocs.io
BSD 3-Clause "New" or "Revised" License
187 stars 42 forks source link

Centers not returned when precomputed distances #115

Closed Mastomaki closed 3 years ago

Mastomaki commented 3 years ago

Hello!

I'm wondering why the clustercenters for KMedoids are not returned when metric=precomputed? One could still select the member whose average distance to other members of the cluster is minimum?

Edit: in this case the meaning of clustercenters should be the index of the medoid, not a data point.

TimotheeMathieu commented 3 years ago

Hello, when metric=precomputed, we don't have access to the coordinates of the points in space, we only have access to the distance matrix (it is the meaning of precomputed). Hence we can't give the cluster_centers_ which represent the coordinates of the medoids in space. However, KMedoids still gives medoid_indices_ which can be used to recover which points are medoids.

Mastomaki commented 3 years ago

Yes, I had the indices in my mind exactly. medoid_indices_ was what I was looking for. Thanks a lot!