nicodv / kmodes

Python implementations of the k-modes and k-prototypes clustering algorithms, for clustering categorical data
MIT License
1.24k stars 417 forks source link

Get the distance from the centroid for new samples #148

Closed floresseanpaolo closed 3 years ago

floresseanpaolo commented 4 years ago

Kprototype's predict method allows to get cluster for new data. Is there a way to get also the actual distance from the centroid for new data instead of the belonging cluster only? I have a use-case where I need to get the actual distance of the sample rather than the belonging cluster.

floresseanpaolo commented 4 years ago

For my use-case where I just need to compare the "likeness" of sample to the cluster, I think getting the tot_cost from the _labels_cost function will do the trick! Thanks!