|
def | size (self) |
| Return size of self-organized map that is defined by total number of neurons. More...
|
|
def | weights (self) |
| Return weight of each neuron. More...
|
|
def | awards (self) |
| Return amount of captured objects by each neuron after training. More...
|
|
def | capture_objects (self) |
| Returns indexes of captured objects by each neuron. More...
|
|
def | __init__ (self, rows, cols, conn_type=type_conn.grid_eight, parameters=None, ccore=True) |
| Constructor of self-organized map. More...
|
|
def | __del__ (self) |
| Destructor of the self-organized feature map.
|
|
def | __len__ (self) |
| Returns size of the network that defines by amount of neuron in it. More...
|
|
def | __getstate__ (self) |
|
def | __setstate__ (self, som_state) |
|
def | train (self, data, epochs, autostop=False) |
| Trains self-organized feature map (SOM). More...
|
|
def | simulate (self, input_pattern) |
| Processes input pattern (no learining) and returns index of neuron-winner. More...
|
|
def | get_winner_number (self) |
| Calculates number of winner at the last step of learning process. More...
|
|
def | show_distance_matrix (self) |
| Shows gray visualization of U-matrix (distance matrix). More...
|
|
def | get_distance_matrix (self) |
| Calculates distance matrix (U-matrix). More...
|
|
def | show_density_matrix (self, surface_divider=20.0) |
| Show density matrix (P-matrix) using kernel density estimation. More...
|
|
def | get_density_matrix (self, surface_divider=20.0) |
| Calculates density matrix (P-Matrix). More...
|
|
def | show_winner_matrix (self) |
| Show winner matrix where each element corresponds to neuron and value represents amount of won objects from input dataspace at the last training iteration. More...
|
|
def | show_network (self, awards=False, belongs=False, coupling=True, dataset=True, marker_type='o') |
| Shows neurons in the dimension of data. More...
|
|
Represents self-organized feature map (SOM).
The self-organizing feature map (SOM) method is a powerful tool for the visualization of of high-dimensional data. It converts complex, nonlinear statistical relationships between high-dimensional data into simple geometric relationships on a low-dimensional display.
CCORE option can be used to use the pyclustering core - C/C++ shared library for processing that significantly increases performance.
Example:
import random
from pyclustering.samples.definitions import FCPS_SAMPLES
parameters = som_parameters()
rows = 10
cols = 10
structure = type_conn.grid_four;
network = som(rows, cols, structure, parameters)
network.train(sample, 100)
index_point = random.randint(0, len(sample) - 1)
point = sample[index_point]
point[0] += random.random() * 0.2
point[1] += random.random() * 0.2
index_winner = network.simulate(point)
index_similar_objects = network.capture_objects[index_winner]
print("Point '%s' is similar to objects with indexes '%s'." % (str(point), str(index_similar_objects)))
print("Coordinates of similar objects:")
for index in index_similar_objects: print("\tPoint:", sample[index])
network.show_distance_matrix()
network.show_density_matrix()
network.show_winner_matrix()
network.show_network()
There is a visualization of 'Target' sample that was done by the self-organized feature map:
Definition at line 115 of file som.py.
def pyclustering.nnet.som.som.capture_objects |
( |
|
self | ) |
|
Returns indexes of captured objects by each neuron.
For example, network with size 2x2 has been trained on 5 sample, we neuron #1 has won one object with index '1', neuron #2 - objects with indexes '0', '3', '4', neuron #3 - nothing, neuron #4 - object with index '2'. Thus, output is [ [1], [0, 3, 4], [], [2] ].
- Returns
- (list) Indexes of captured objects by each neuron.
Definition at line 227 of file som.py.