pyclustering  0.10.1
pyclustring is a Python, C++ data mining library.
pyclustering.cluster.rock.rock Class Reference

The 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

The 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 22 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 53 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 127 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 114 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.

Returns
(rock) Returns itself (ROCK instance).
See also
get_clusters()

Definition at line 84 of file rock.py.


The documentation for this class was generated from the following file:
pyclustering.cluster.rock
Cluster analysis algorithm: ROCK.
Definition: rock.py:1
pyclustering.cluster
pyclustering module for cluster analysis.
Definition: __init__.py:1
pyclustering.utils
Utils that are used by modules of pyclustering.
Definition: __init__.py:1
pyclustering.utils.read_sample
def read_sample(filename)
Returns data sample from simple text file.
Definition: __init__.py:30