pyclustering.cluster.ttsas.ttsas Class Reference

Class represents TTSAS (Two-Threshold Sequential Algorithmic Scheme). More...

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

Public Member Functions

def __init__ (self, data, threshold1, threshold2, ccore=True, kwargs)
 Creates TTSAS algorithm. More...
 
def process (self)
 Performs cluster analysis in line with rules of BSAS algorithm. More...
 
- Public Member Functions inherited from pyclustering.cluster.bsas.bsas
def __init__ (self, data, maximum_clusters, threshold, ccore=True, kwargs)
 Creates classical BSAS algorithm. More...
 
def process (self)
 Performs cluster analysis in line with rules of BSAS algorithm. More...
 
def get_clusters (self)
 Returns list of allocated clusters, each cluster contains indexes of objects in list of data. More...
 
def get_representatives (self)
 Returns list of representatives of allocated clusters. More...
 
def get_cluster_encoding (self)
 Returns clustering result representation type that indicate how clusters are encoded. More...
 

Detailed Description

Class represents TTSAS (Two-Threshold Sequential Algorithmic Scheme).

Clustering results of BSAS and MBSAS are strongly dependent on the order in which the points in data. TTSAS helps to overcome this shortcoming by using two threshold parameters. The first - if the distance to the nearest cluster is less than the first threshold then point is assigned to the cluster. The second - if distance to the nearest cluster is greater than the second threshold then new cluster is allocated.

Code example of TTSAS usage:

from pyclustering.cluster.bsas import bsas_visualizer
from pyclustering.cluster.ttsas import ttsas
from pyclustering.samples.definitions import SIMPLE_SAMPLES
from pyclustering.utils import read_sample
# Read data sample from 'Simple03.data'.
sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE3)
# Prepare algorithm's parameters.
threshold1 = 1.0
threshold2 = 2.0
# Create instance of TTSAS algorithm.
ttsas_instance = ttsas(sample, threshold1, threshold2)
ttsas_instance.process()
# Get clustering results.
clusters = ttsas_instance.get_clusters()
representatives = ttsas_instance.get_representatives()
# Display results using BSAS visualizer.
bsas_visualizer.show_clusters(sample, clusters, representatives)
See also
pyclustering.cluster.bsas, pyclustering.cluster.mbsas

Definition at line 34 of file ttsas.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.cluster.ttsas.ttsas.__init__ (   self,
  data,
  threshold1,
  threshold2,
  ccore = True,
  kwargs 
)

Creates TTSAS algorithm.

Parameters
[in]data(list): Input data that is presented as list of points (objects), each point should be represented by list or tuple.
[in]threshold1Dissimilarity level (distance) between point and its closest cluster, if the distance is less than 'threshold1' value then point is assigned to the cluster.
[in]threshold2Dissimilarity level (distance) between point and its closest cluster, if the distance is greater than 'threshold2' value then point is considered as a new cluster.
[in]ccore(bool): If True than DLL CCORE (C++ solution) will be used for solving.
[in]**kwargsArbitrary keyword arguments (available arguments: 'metric').

Keyword Args:

  • metric (distance_metric): Metric that is used for distance calculation between two points.

Definition at line 73 of file ttsas.py.

Member Function Documentation

◆ process()

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

Performs cluster analysis in line with rules of BSAS algorithm.

Remarks
Results of clustering can be obtained using corresponding get methods.
See also
get_clusters()
get_representatives()

Definition at line 97 of file ttsas.py.


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