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.

CCORE option can be used to use the pyclustering core - C/C++ shared library for processing that significantly increases performance.

Example:

# Read sample for clustering from some file
sample = read_sample(path_to_sample);
# Create instance of ROCK algorithm for cluster analysis
# Five clusters should be allocated
rock_instance = rock(sample, 1.0, 5);
# Run cluster analysis
rock_instance.process();
# Obtain results of clustering
clusters = rock_instance.get_clusters();

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 60 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 131 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 118 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 89 of file rock.py.


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