Class represents clustering algorithm K-Medoids (another one title is PAM - Partitioning Around Medoids). More...
Public Member Functions | |
def | __init__ (self, data, initial_index_medoids, tolerance=0.001, ccore=True, kwargs) |
Constructor of clustering algorithm K-Medoids. More... | |
def | process (self) |
Performs cluster analysis in line with rules of K-Medoids algorithm. More... | |
def | get_clusters (self) |
Returns list of allocated clusters, each cluster contains indexes of objects in list of data. More... | |
def | get_medoids (self) |
Returns list of medoids of allocated clusters represented by indexes from the input data. More... | |
def | get_cluster_encoding (self) |
Returns clustering result representation type that indicate how clusters are encoded. More... | |
Class represents clustering algorithm K-Medoids (another one title is PAM - Partitioning Around Medoids).
The algorithm is less sensitive to outliers tham K-Means. The principle difference between K-Medoids and K-Medians is that K-Medoids uses existed points from input data space as medoids, but median in K-Medians can be unreal object (not from input data space).
CCORE option can be used to use core pyclustering - C/C++ shared library for processing that significantly increases performance.
Clustering example:
Metric for calculation distance between points can be specified by parameter additional 'metric':
Distance matrix can be used instead of sequence of points to increase performance and for that purpose parameter 'data_type' should be used:
Definition at line 41 of file kmedoids.py.
def pyclustering.cluster.kmedoids.kmedoids.__init__ | ( | self, | |
data, | |||
initial_index_medoids, | |||
tolerance = 0.001 , |
|||
ccore = True , |
|||
kwargs | |||
) |
Constructor of clustering algorithm K-Medoids.
[in] | data | (list): Input data that is presented as list of points (objects), each point should be represented by list or tuple. |
[in] | initial_index_medoids | (list): Indexes of intial medoids (indexes of points in input data). |
[in] | tolerance | (double): Stop condition: if maximum value of distance change of medoids of clusters is less than tolerance than algorithm will stop processing. |
[in] | ccore | (bool): If specified than CCORE library (C++ pyclustering library) is used for clustering instead of Python code. |
[in] | **kwargs | Arbitrary keyword arguments (available arguments: 'metric', 'data_type'). |
Keyword Args:
Definition at line 101 of file kmedoids.py.
def pyclustering.cluster.kmedoids.kmedoids.get_cluster_encoding | ( | self | ) |
Returns clustering result representation type that indicate how clusters are encoded.
Definition at line 187 of file kmedoids.py.
def pyclustering.cluster.kmedoids.kmedoids.get_clusters | ( | self | ) |
Returns list of allocated clusters, each cluster contains indexes of objects in list of data.
Definition at line 163 of file kmedoids.py.
Referenced by pyclustering.samples.answer_reader.get_cluster_lengths(), and pyclustering.cluster.optics.optics.process().
def pyclustering.cluster.kmedoids.kmedoids.get_medoids | ( | self | ) |
Returns list of medoids of allocated clusters represented by indexes from the input data.
Definition at line 175 of file kmedoids.py.
def pyclustering.cluster.kmedoids.kmedoids.process | ( | self | ) |
Performs cluster analysis in line with rules of K-Medoids algorithm.
Definition at line 130 of file kmedoids.py.