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

Class represents clustering algorithm SyncNet. More...

+ Inheritance diagram for pyclustering.cluster.syncnet.syncnet:
+ Collaboration diagram for pyclustering.cluster.syncnet.syncnet:

Public Member Functions

def __init__ (self, sample, radius, conn_repr=conn_represent.MATRIX, initial_phases=initial_type.RANDOM_GAUSSIAN, enable_conn_weight=False, ccore=True)
 Contructor of the oscillatory network SYNC for cluster analysis. More...
def __del__ (self)
 Destructor of oscillatory network is based on Kuramoto model.
def process (self, order=0.998, solution=solve_type.FAST, collect_dynamic=True)
 Peforms cluster analysis using simulation of the oscillatory network. More...
def show_network (self)
 Shows connections in the network. More...
- Public Member Functions inherited from pyclustering.nnet.sync.sync_network
def __init__ (self, num_osc, weight=1, frequency=0, type_conn=conn_type.ALL_TO_ALL, representation=conn_represent.MATRIX, initial_phases=initial_type.RANDOM_GAUSSIAN, ccore=True)
 Constructor of oscillatory network is based on Kuramoto model. More...
def sync_order (self)
 Calculates current level of global synchorization (order parameter) in the network. More...
def sync_local_order (self)
 Calculates current level of local (partial) synchronization in the network. More...
def simulate (self, steps, time, solution=solve_type.FAST, collect_dynamic=True)
 Performs static simulation of Sync oscillatory network. More...
def simulate_dynamic (self, order=0.998, solution=solve_type.FAST, collect_dynamic=False, step=0.1, int_step=0.01, threshold_changes=0.0000001)
 Performs dynamic simulation of the network until stop condition is not reached. More...
def simulate_static (self, steps, time, solution=solve_type.FAST, collect_dynamic=False)
 Performs static simulation of oscillatory network. More...
def get_neighbors (self, index)
 Finds neighbors of the oscillator with specified index. More...
def has_connection (self, i, j)
 Returns True if there is connection between i and j oscillators and False - if connection doesn't exist. More...
- Public Member Functions inherited from
def height (self)
 Height of the network grid (that is defined by amout of oscillators in each column), this value is zero in case of non-grid structure. More...
def width (self)
 Width of the network grid, this value is zero in case of non-grid structure. More...
def structure (self)
 Type of network structure that is used for connecting oscillators.
def __init__ (self, num_osc, type_conn=conn_type.ALL_TO_ALL, conn_repr=conn_represent.MATRIX, height=None, width=None)
 Constructor of the network. More...
def __len__ (self)
 Returns size of the network that is defined by amount of oscillators.
def set_connection (self, i, j)
 Couples two specified oscillators in the network with dynamic connections. More...

Detailed Description

Class represents clustering algorithm SyncNet.

SyncNet is bio-inspired algorithm that is based on oscillatory network that uses modified Kuramoto model. Each attribute of a data object is considered as a phase oscillator.


from pyclustering.cluster import cluster_visualizer
from pyclustering.cluster.syncnet import syncnet, solve_type
from pyclustering.samples.definitions import SIMPLE_SAMPLES
from pyclustering.utils import read_sample
# Read sample for clustering from some file.
sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE3)
# Create oscillatory network with connectivity radius 1.0.
network = syncnet(sample, 1.0)
# Run cluster analysis and collect output dynamic of the oscillatory network.
# Network simulation is performed by Runge Kutta 4.
analyser = network.process(0.998, solve_type.RK4)
# Show oscillatory network.
# Obtain clustering results.
clusters = analyser.allocate_clusters()
# Visualize clustering results.
visualizer = cluster_visualizer()
visualizer.append_clusters(clusters, sample)

Definition at line 146 of file

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.cluster.syncnet.syncnet.__init__ (   self,
  conn_repr = conn_represent.MATRIX,
  initial_phases = initial_type.RANDOM_GAUSSIAN,
  enable_conn_weight = False,
  ccore = True 

Contructor of the oscillatory network SYNC for cluster analysis.

[in]sample(list): Input data that is presented as list of points (objects), each point should be represented by list or tuple.
[in]radius(double): Connectivity radius between points, points should be connected if distance between them less then the radius.
[in]conn_repr(conn_represent): Internal representation of connection in the network: matrix or list. Ignored in case of usage of CCORE library.
[in]initial_phases(initial_type): Type of initialization of initial phases of oscillators (random, uniformly distributed, etc.).
[in]enable_conn_weight(bool): If True - enable mode when strength between oscillators depends on distance between two oscillators. If False - all connection between oscillators have the same strength that equals to 1 (True).
[in]ccore(bool): Defines should be CCORE C++ library used instead of Python code or not.

Reimplemented in pyclustering.cluster.hsyncnet.hsyncnet.

Definition at line 183 of file

Member Function Documentation

◆ process()

def pyclustering.cluster.syncnet.syncnet.process (   self,
  order = 0.998,
  solution = solve_type.FAST,
  collect_dynamic = True 

Peforms cluster analysis using simulation of the oscillatory network.

[in]order(double): Order of synchronization that is used as indication for stopping processing.
[in]solution(solve_type): Specified type of solving diff. equation.
[in]collect_dynamic(bool): Specified requirement to collect whole dynamic of the network.
(syncnet_analyser) Returns analyser of results of clustering.

Reimplemented in pyclustering.cluster.hsyncnet.hsyncnet.

Definition at line 286 of file

◆ show_network()

def pyclustering.cluster.syncnet.syncnet.show_network (   self)

Shows connections in the network.

It supports only 2-d and 3-d representation.

Definition at line 336 of file

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