pyclustering.cluster.somsc.somsc Class Reference

Class represents simple clustering algorithm based on self-organized feature map. More...

Public Member Functions

def __init__ (self, data, amount_clusters, epouch=100, ccore=True)
 Creates SOM-SC (Self Organized Map for Simple Clustering) algorithm for clustering analysis. More...
 
def process (self)
 Performs cluster analysis by competition between neurons of SOM. More...
 
def predict (self, points)
 Calculates the closest cluster to each point. 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 simple clustering algorithm based on self-organized feature map.

This algorithm uses amount of clusters that should be allocated as a size of SOM map. Captured objects by neurons are clusters. Algorithm is able to process data with Gaussian distribution that has spherical forms.

Example:

from pyclustering.cluster import cluster_visualizer
from pyclustering.cluster.somsc import somsc
from pyclustering.samples.definitions import FCPS_SAMPLES
from pyclustering.utils import read_sample
# Load list of points for cluster analysis
sample = read_sample(FCPS_SAMPLES.SAMPLE_TWO_DIAMONDS)
# Create instance of SOM-SC algorithm to allocated two clusters
somsc_instance = somsc(sample, 2)
# Run cluster analysis and obtain results
somsc_instance.process()
clusters = somsc_instance.get_clusters()
# Visualize clustering results.
visualizer = cluster_visualizer()
visualizer.append_clusters(clusters, sample)
visualizer.show()

Definition at line 37 of file somsc.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.cluster.somsc.somsc.__init__ (   self,
  data,
  amount_clusters,
  epouch = 100,
  ccore = True 
)

Creates SOM-SC (Self Organized Map for Simple Clustering) algorithm for clustering analysis.

Parameters
[in]data(list): List of points that are used for processing.
[in]amount_clusters(uint): Amount of clusters that should be allocated.
[in]epouch(uint): Number of epochs for training of SOM.
[in]ccore(bool): If it is True then CCORE implementation will be used for clustering analysis.

Definition at line 68 of file somsc.py.

Member Function Documentation

◆ get_cluster_encoding()

def pyclustering.cluster.somsc.somsc.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 134 of file somsc.py.

◆ get_clusters()

def pyclustering.cluster.somsc.somsc.get_clusters (   self)

Returns list of allocated clusters, each cluster contains indexes of objects in list of data.

See also
process()

Definition at line 123 of file somsc.py.

Referenced by pyclustering.samples.answer_reader.get_cluster_lengths().

◆ predict()

def pyclustering.cluster.somsc.somsc.predict (   self,
  points 
)

Calculates the closest cluster to each point.

Parameters
[in]points(array_like): Points for which closest clusters are calculated.
Returns
(list) List of closest clusters for each point. Each cluster is denoted by index. Return empty collection if 'process()' method was not called.

Definition at line 104 of file somsc.py.

◆ process()

def pyclustering.cluster.somsc.somsc.process (   self)

Performs cluster analysis by competition between neurons of SOM.

Returns
(somsc) Returns itself (SOM Simple Clustering instance).
See also
get_clusters()

Definition at line 89 of file somsc.py.


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