pyclustering.cluster.rock.rock Class Reference

Class represents clustering algorithm ROCK. More...

Public Member Functions

def __init__ (self, data, eps, number_clusters, threshold=0.5, ccore=True)
 Constructor of clustering algorithm ROCK. More...
 
def process (self)
 Performs cluster analysis in line with rules of ROCK algorithm. More...
 
def get_clusters (self)
 Returns list of allocated clusters, each cluster contains indexes of objects in list of data. More...
 
def get_cluster_encoding (self)
 Returns clustering result representation type that indicate how clusters are encoded. More...
 

Detailed Description

Class represents clustering algorithm ROCK.

Example:

from pyclustering.cluster import cluster_visualizer
from pyclustering.cluster.rock import rock
from pyclustering.samples.definitions import FCPS_SAMPLES
from pyclustering.utils import read_sample
# Read sample for clustering from file.
sample = read_sample(FCPS_SAMPLES.SAMPLE_HEPTA)
# Create instance of ROCK algorithm for cluster analysis. Seven clusters should be allocated.
rock_instance = rock(sample, 1.0, 7)
# Run cluster analysis.
rock_instance.process()
# Obtain results of clustering.
clusters = rock_instance.get_clusters()
# Visualize clustering results.
visualizer = cluster_visualizer()
visualizer.append_clusters(clusters, sample)
visualizer.show()

Definition at line 37 of file rock.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.cluster.rock.rock.__init__ (   self,
  data,
  eps,
  number_clusters,
  threshold = 0.5,
  ccore = True 
)

Constructor of clustering algorithm ROCK.

Parameters
[in]data(list): Input data - list of points where each point is represented by list of coordinates.
[in]eps(double): Connectivity radius (similarity threshold), points are neighbors if distance between them is less than connectivity radius.
[in]number_clusters(uint): Defines number of clusters that should be allocated from the input data set.
[in]threshold(double): Value that defines degree of normalization that influences on choice of clusters for merging during processing.
[in]ccore(bool): Defines should be CCORE (C++ pyclustering library) used instead of Python code or not.

Definition at line 68 of file rock.py.

Member Function Documentation

◆ get_cluster_encoding()

def pyclustering.cluster.rock.rock.get_cluster_encoding (   self)

Returns clustering result representation type that indicate how clusters are encoded.

Returns
(type_encoding) Clustering result representation.
See also
get_clusters()

Definition at line 139 of file rock.py.

◆ get_clusters()

def pyclustering.cluster.rock.rock.get_clusters (   self)

Returns list of allocated clusters, each cluster contains indexes of objects in list of data.

Returns
(list) List of allocated clusters, each cluster contains indexes of objects in list of data.
See also
process()

Definition at line 126 of file rock.py.

Referenced by pyclustering.samples.answer_reader.get_cluster_lengths().

◆ process()

def pyclustering.cluster.rock.rock.process (   self)

Performs cluster analysis in line with rules of ROCK algorithm.

Remarks
Results of clustering can be obtained using corresponding get methods.
See also
get_clusters()

Definition at line 97 of file rock.py.


The documentation for this class was generated from the following file: