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

Transform function #91

Open hajarhomayouni opened 6 years ago

hajarhomayouni commented 6 years ago

Does K-prototypes implement the transform function of k-means, which returns a distance matrix?

nicodv commented 6 years ago

Can you be more specific, @hajarhomayouni ?

hajarhomayouni commented 6 years ago

Sklearn K-means has a fit_transform function that transforms X to a cluster-distance space.
Is there a same function for k-prototypes?

nicodv commented 6 years ago

No, there's no transform method currently. KPrototypes would have to return both a dissimilarity matrix and a distance matrix then. Wouldn't be too hard to implement, I think.

What's your use case?

hajarhomayouni commented 6 years ago

I am trying to find local outliers in each cluster. So, I needed to calculate the distance between each data point to the corresponding cluster center. The transform function would give me the entire matrix, but now I need to calculate dissimilarity for each data point, which is not hard to implement.

Thanks.