pyclustering.cluster.mbsas.mbsas Class Reference

Class represents MBSAS (Modified Basic Sequential Algorithmic Scheme). More...

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

Public Member Functions

def __init__ (self, data, maximum_clusters, threshold, ccore=True, kwargs)
 Creates MBSAS algorithm. More...
 
def process (self)
 Performs cluster analysis in line with MBSAS 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 MBSAS (Modified Basic Sequential Algorithmic Scheme).

Interface of MBSAS algorithm is the same as for BSAS. This algorithm performs clustering in two steps. The first - is determination of amount of clusters. The second - is assignment of points that were not marked as a cluster representatives to clusters.

Code example of MBSAS usage:

from pyclustering.cluster.bsas import bsas_visualizer
from pyclustering.cluster.mbsas import mbsas
from pyclustering.utils import read_sample
from pyclustering.samples.definitions import SIMPLE_SAMPLES
# Read data sample from 'Simple02.data'.
sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE2)
# Prepare algorithm's parameters.
max_clusters = 3
threshold = 1.0
# Create instance of MBSAS algorithm.
mbsas_instance = mbsas(sample, max_clusters, threshold)
mbsas_instance.process()
# Get clustering results.
clusters = mbsas_instance.get_clusters()
representatives = mbsas_instance.get_representatives()
# Display results.
bsas_visualizer.show_clusters(sample, clusters, representatives)
See also
pyclustering.cluster.bsas, pyclustering.cluster.ttsas

Definition at line 34 of file mbsas.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.cluster.mbsas.mbsas.__init__ (   self,
  data,
  maximum_clusters,
  threshold,
  ccore = True,
  kwargs 
)

Creates MBSAS 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]maximum_clustersMaximum allowable number of clusters that can be allocated during processing.
[in]thresholdThreshold of dissimilarity (maximum distance) between points.
[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 71 of file mbsas.py.

Member Function Documentation

◆ process()

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

Performs cluster analysis in line with MBSAS algorithm.

Returns
(mbsas) Returns itself (MBSAS instance).
See also
get_clusters()
get_representatives()

Definition at line 88 of file mbsas.py.


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