0

I am using Python 2.7 and need to create k means plot for some data.

The data is not trivial and I need to calculate the distance between the data samples with some custom distance function that I have (this is complex genetic data) and then run k means on it.

I have managed to do this with h.clustering in scipy, when calculating the distance function in advance and then passing it instead of the data.

I found how to run the k-means with sklearn, but I can not find how to use my own distance function.

I don't have any preference for sklearn, other packages are welcome too.

Martin Thoma
  • 124,992
  • 159
  • 614
  • 958
thebeancounter
  • 4,261
  • 8
  • 61
  • 109
  • 1
    This should answer your question: http://stackoverflow.com/questions/5529625/is-it-possible-to-specify-your-own-distance-function-using-scikit-learn-k-means – Zaccharie Ramzi Feb 15 '17 at 12:32
  • Possible duplicate of [Is it possible to specify your own distance function using scikit-learn K-Means Clustering?](http://stackoverflow.com/questions/5529625/is-it-possible-to-specify-your-own-distance-function-using-scikit-learn-k-means) – Vivek Kumar Feb 16 '17 at 05:54

0 Answers0