Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kmedoids using Pycluster with various distance functions

I am using python 2.6 for windows. I am working on OpenCv core module. I search around about the kmedoids function defined in Pycluster, but did not get the accurate answer.

I have installed Pycluster 1.50 in windows7. Can somebody explain how to use Eucledian diatnce, L1 and L2 distance, hellinger distance and Chi-square distance using kmedoids?

Through searching I know so far.

import Pycluster
from Pycluster import distancematrix, kmedoids

The kmedoid function takes four arguments (as mentioned below), among them one is a distance. But I am unable to understand how to specify different distance measures in kmedoids function

clusterid, error, nfound = kmedoids (distance, nclusters=2, npass=1, initialid=None)

Any help regarding the matter would be highly encouraged

like image 868
Saad Avatar asked Nov 04 '22 00:11

Saad


1 Answers

As Shambool points out, the documentation gives you the answer. You don't pass a distance function directly, you pass a pairwise distance matrix. So compute that first, with whatever distance metric you want and then pass it along to kmedoids

like image 107
mwv Avatar answered Nov 09 '22 13:11

mwv