pyclustering.nnet.syncpr.syncpr Class Reference

Model of phase oscillatory network for pattern recognition that is based on the Kuramoto model. More...

+ Inheritance diagram for pyclustering.nnet.syncpr.syncpr:
+ Collaboration diagram for pyclustering.nnet.syncpr.syncpr:

Public Member Functions

def __init__ (self, num_osc, increase_strength1, increase_strength2, ccore=True)
 Constructor of oscillatory network for pattern recognition based on Kuramoto model. More...
 
def __del__ (self)
 Default destructor of syncpr.
 
def __len__ (self)
 Returns size of the network.
 
def train (self, samples)
 Trains syncpr network using Hebbian rule for adjusting strength of connections between oscillators during training. More...
 
def simulate (self, steps, time, pattern, solution=solve_type.RK4, collect_dynamic=True)
 Performs static simulation of syncpr oscillatory network. More...
 
def simulate_dynamic (self, pattern, order=0.998, solution=solve_type.RK4, 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, pattern, solution=solve_type.FAST, collect_dynamic=False)
 Performs static simulation of syncpr oscillatory network. More...
 
def memory_order (self, pattern)
 Calculates function of the memorized pattern. 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 __del__ (self)
 Destructor of oscillatory network is based on Kuramoto model.
 
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 pyclustering.nnet.network
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 has_connection (self, i, j)
 Returns True if there is connection between i and j oscillators and False - if connection doesn't exist. More...
 
def set_connection (self, i, j)
 Couples two specified oscillators in the network with dynamic connections. More...
 
def get_neighbors (self, index)
 Finds neighbors of the oscillator with specified index. More...
 

Detailed Description

Model of phase oscillatory network for pattern recognition that is based on the Kuramoto model.

The model uses second-order and third-order modes of the Fourier components.

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

Example:

# Network size should be equal to size of pattern for learning.
net = syncpr(size_network, 0.3, 0.3);
# Train network using list of patterns (input images).
net.train(image_samples);
# Recognize image using 10 steps during 10 seconds of simulation.
sync_output_dynamic = net.simulate(10, 10, pattern, solve_type.RK4, True);
# Display output dynamic.
syncpr_visualizer.show_output_dynamic(sync_output_dynamic);
# Display evolution of recognition of the pattern.
syncpr_visualizer.show_pattern(sync_output_dynamic, image_height, image_width);

Definition at line 212 of file syncpr.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.nnet.syncpr.syncpr.__init__ (   self,
  num_osc,
  increase_strength1,
  increase_strength2,
  ccore = True 
)

Constructor of oscillatory network for pattern recognition based on Kuramoto model.

Parameters
[in]num_osc(uint): Number of oscillators in the network.
[in]increase_strength1(double): Parameter for increasing strength of the second term of the Fourier component.
[in]increase_strength2(double): Parameter for increasing strength of the third term of the Fourier component.
[in]ccore(bool): If True simulation is performed by CCORE library (C++ implementation of pyclustering).

Definition at line 240 of file syncpr.py.

Member Function Documentation

◆ memory_order()

def pyclustering.nnet.syncpr.syncpr.memory_order (   self,
  pattern 
)

Calculates function of the memorized pattern.

Throws exception if length of pattern is not equal to size of the network or if it consists feature with value that are not equal to [-1; 1].

Parameters
[in]pattern(list): Pattern for recognition represented by list of features that are equal to [-1; 1].
Returns
(double) Order of memory for the specified pattern.

Definition at line 452 of file syncpr.py.

◆ simulate()

def pyclustering.nnet.syncpr.syncpr.simulate (   self,
  steps,
  time,
  pattern,
  solution = solve_type.RK4,
  collect_dynamic = True 
)

Performs static simulation of syncpr oscillatory network.

In other words network performs pattern recognition during simulation.

Parameters
[in]steps(uint): Number steps of simulations during simulation.
[in]time(double): Time of simulation.
[in]pattern(list): Pattern for recognition represented by list of features that are equal to [-1; 1].
[in]solution(solve_type): Type of solver that should be used for simulation.
[in]collect_dynamic(bool): If True - returns whole dynamic of oscillatory network, otherwise returns only last values of dynamics.
Returns
(list) Dynamic of oscillatory network. If argument 'collect_dynamic' = True, than return dynamic for the whole simulation time, otherwise returns only last values (last step of simulation) of dynamic.
See also
simulate_dynamic()
simulate_static()

Definition at line 317 of file syncpr.py.

◆ simulate_dynamic()

def pyclustering.nnet.syncpr.syncpr.simulate_dynamic (   self,
  pattern,
  order = 0.998,
  solution = solve_type.RK4,
  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.

In other words network performs pattern recognition during simulation. Stop condition is defined by input argument 'order' that represents memory order, but process of simulation can be stopped if convergance rate is low whose threshold is defined by the argument 'threshold_changes'.

Parameters
[in]pattern(list): Pattern for recognition represented by list of features that are equal to [-1; 1].
[in]order(double): Order of process synchronization, distributed 0..1.
[in]solution(solve_type): Type of solution.
[in]collect_dynamic(bool): If True - returns whole dynamic of oscillatory network, otherwise returns only last values of dynamics.
[in]step(double): Time step of one iteration of simulation.
[in]int_step(double): Integration step, should be less than step.
[in]threshold_changes(double): Additional stop condition that helps prevent infinite simulation, defines limit of changes of oscillators between current and previous steps.
Returns
(list) Dynamic of oscillatory network. If argument 'collect_dynamic' = True, than return dynamic for the whole simulation time, otherwise returns only last values (last step of simulation) of dynamic.
See also
simulate()
simulate_static()

Definition at line 339 of file syncpr.py.

◆ simulate_static()

def pyclustering.nnet.syncpr.syncpr.simulate_static (   self,
  steps,
  time,
  pattern,
  solution = solve_type.FAST,
  collect_dynamic = False 
)

Performs static simulation of syncpr oscillatory network.

In other words network performs pattern recognition during simulation.

Parameters
[in]steps(uint): Number steps of simulations during simulation.
[in]time(double): Time of simulation.
[in]pattern(list): Pattern for recognition represented by list of features that are equal to [-1; 1].
[in]solution(solve_type): Type of solution.
[in]collect_dynamic(bool): If True - returns whole dynamic of oscillatory network, otherwise returns only last values of dynamics.
Returns
(list) Dynamic of oscillatory network. If argument 'collect_dynamic' = True, than return dynamic for the whole simulation time, otherwise returns only last values (last step of simulation) of dynamic.
See also
simulate()
simulate_dynamic()

Definition at line 418 of file syncpr.py.

◆ train()

def pyclustering.nnet.syncpr.syncpr.train (   self,
  samples 
)

Trains syncpr network using Hebbian rule for adjusting strength of connections between oscillators during training.

Parameters
[in]samples(list): list of patterns where each pattern is represented by list of features that are equal to [-1; 1].

Definition at line 285 of file syncpr.py.


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