Hi Team, I was trying to use cosine similarity with KMeans. The code which I used to achieve is available here. https://gist.github.com/jaganadhg/b3f6af86ad99bf6e9bb7be21e5baa1b5 Is it the right way to achieve the same ? I know that cosine is not directly supported in sklearn KMeans. But after skimming through the code I was thinking that this will work ;-) -- ********************************** JAGANADH G http://jaganadhg.in *ILUGCBE* http://ilugcbe.org.in
In short, no, monkey patching cosine_similarity in place of euclidean_distances will not work. See for instance this StackOverflow post: http://stats.stackexchange.com/questions/81481/why-does-k-means-clustering-a... You could try out this Kernel KMeans implementation: https://github.com/scikit-learn/scikit-learn/pull/5483 On 3 June 2016 at 05:24, JAGANADH G <jaganadhg@gmail.com> wrote:
Hi Team, I was trying to use cosine similarity with KMeans. The code which I used to achieve is available here. https://gist.github.com/jaganadhg/b3f6af86ad99bf6e9bb7be21e5baa1b5
Is it the right way to achieve the same ? I know that cosine is not directly supported in sklearn KMeans. But after skimming through the code I was thinking that this will work ;-)
-- ********************************** JAGANADH G http://jaganadhg.in *ILUGCBE* http://ilugcbe.org.in
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
participants (2)
-
JAGANADH G -
Joel Nothman