Class represents clustering algorithm K-Medians. More...
Public Member Functions | |
def | __init__ (self, data, initial_centers, tolerance=0.001, ccore=True, kwargs) |
Constructor of clustering algorithm K-Medians. More... | |
def | process (self) |
Performs cluster analysis in line with rules of K-Medians algorithm. More... | |
def | get_clusters (self) |
Returns list of allocated clusters, each cluster contains indexes of objects in list of data. More... | |
def | get_medians (self) |
Returns list of centers of allocated clusters. More... | |
def | get_cluster_encoding (self) |
Returns clustering result representation type that indicate how clusters are encoded. More... | |
Class represents clustering algorithm K-Medians.
The algorithm is less sensitive to outliers than K-Means. Medians are calculated instead of centroids.
Example:
Definition at line 40 of file kmedians.py.
def pyclustering.cluster.kmedians.kmedians.__init__ | ( | self, | |
data, | |||
initial_centers, | |||
tolerance = 0.001 , |
|||
ccore = True , |
|||
kwargs | |||
) |
Constructor of clustering algorithm K-Medians.
[in] | data | (list): Input data that is presented as list of points (objects), each point should be represented by list or tuple. |
[in] | initial_centers | (list): Initial coordinates of medians of clusters that are represented by list: [center1, center2, ...]. |
[in] | tolerance | (double): Stop condition: if maximum value of change of centers of clusters is less than tolerance than algorithm will stop processing |
[in] | ccore | (bool): Defines should be CCORE library (C++ pyclustering library) used instead of Python code or not. |
[in] | **kwargs | Arbitrary keyword arguments (available arguments: 'metric', 'itermax'). |
Keyword Args:
Definition at line 74 of file kmedians.py.
def pyclustering.cluster.kmedians.kmedians.get_cluster_encoding | ( | self | ) |
Returns clustering result representation type that indicate how clusters are encoded.
Definition at line 166 of file kmedians.py.
def pyclustering.cluster.kmedians.kmedians.get_clusters | ( | self | ) |
Returns list of allocated clusters, each cluster contains indexes of objects in list of data.
Definition at line 142 of file kmedians.py.
Referenced by pyclustering.samples.answer_reader.get_cluster_lengths(), and pyclustering.cluster.optics.optics.process().
def pyclustering.cluster.kmedians.kmedians.get_medians | ( | self | ) |
Returns list of centers of allocated clusters.
Definition at line 154 of file kmedians.py.
def pyclustering.cluster.kmedians.kmedians.process | ( | self | ) |
Performs cluster analysis in line with rules of K-Medians algorithm.
Definition at line 104 of file kmedians.py.