annoviko/pyclustering

K-Medoids Example Script Not Working

Closed this issue · 1 comments

Hi,

I have just begun using pyclustering. Thanks a lot for making available this awesome package!

It seems like the example script provided for K-Medoids algorithm may not be updated.

When I tried running it (by copy-pasting it verbatim in a Jupyter Notebook), I got the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-a40a60218a92> in <module>
    107 
    108 
--> 109 cluster_sample1()
    110 cluster_sample2()
    111 cluster_sample3()

<ipython-input-2-a40a60218a92> in cluster_sample1()
     40 
     41 def cluster_sample1():
---> 42     template_clustering([2, 9], SIMPLE_SAMPLES.SAMPLE_SIMPLE1)
     43 
     44 def cluster_sample2():

<ipython-input-2-a40a60218a92> in template_clustering(start_medoids, path, tolerance, show, **kwargs)
     23 
     24     clusters = kmedoids_instance.get_clusters()
---> 25     print("Iterations:", kmedoids_instance.get_iterations())
     26     print([len(cluster) for cluster in clusters])
     27     print(clusters)

AttributeError: 'kmedoids' object has no attribute 'get_iterations'

I am able to use the kmediods model in my other use cases; so, not sure why the above example script gave an exception.

Closing this thread for now.