3
votes
$\begingroup$

How do I implement k-medoid clustering algorithms like PAM and CLARA in python 2.7? I am currently using Anaconda, and working with ipython 2.7. I have tried scipy.clusters but they don't seem to have the above algorithms. Please help

$\endgroup$
4
  • $\begingroup$ This seems to be more a computing question rather than a statistics one and therefore would be better suited for Stack Overflow $\endgroup$
    – Andy
    Commented May 27, 2014 at 12:25
  • $\begingroup$ I wouldn't agree. Asking for a data analytic algorithm and/or theory is in tune with our site. Particular programming questions should go to SO. $\endgroup$
    – ttnphns
    Commented May 27, 2014 at 13:03
  • 3
    $\begingroup$ This is actually not a reasonable question at all. Obviously, PAM isn't implemented yet, and the author is essentially looking for someone to do his work for him... $\endgroup$ Commented May 30, 2014 at 15:54
  • $\begingroup$ This algorithm has been included in a recent pull request. $\endgroup$ Commented Aug 1, 2015 at 17:44

3 Answers 3

4
votes
$\begingroup$

Start implementing!

We cannot answer a question like yours. You need to have a concrete question, not "where do I start".

If you don't really want to implement it yourself, you may need to choose a different tool, such as ELKI or R or Matlab that do already include PAM and maybe CLARA, too.

$\endgroup$
0
votes
$\begingroup$

pyclustering is your best bet:

https://github.com/annoviko/pyclustering

https://pypi.python.org/pypi/pyclustering/0.8.0

They've got PAM, and CLARANS (which may be the same as CLARA?).

Looks like the git repo has been around since February 2014.

$\endgroup$
-1
votes
$\begingroup$

Have you tried looking into Scikit learn? I have used been it quite a lot in ipython so can verify that it works well.

You can find all the documentation on their clustering algorithms here: http://scikit-learn.org/stable/modules/clustering.html#clustering

I don't exactly see something for k-medoid but maybe they have something there that can help.

Also, you can check out http://mlpy.sourceforge.net/. I have not used this package so cannot comment on how well it performs.

$\endgroup$
2
  • 2
    $\begingroup$ This seems to be not an answer to the OP's straightforward question. In none of the two links I could find any mentioning of k-medoid. $\endgroup$
    – ttnphns
    Commented May 27, 2014 at 13:42
  • $\begingroup$ I agree that these links don't directly answer the question (as I pointed out) but I wanted to make the OP aware of the commercially available software for clustering in python. There are many methods available there and maybe one can be used. $\endgroup$
    – mike1886
    Commented May 27, 2014 at 13:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.