pyclustering.cluster.encoder.cluster_encoder Class Reference

Provides service to change clustering result representation. More...

Public Member Functions

def __init__ (self, encoding, clusters, data)
 Constructor of clustering result representor. More...
 
def get_encoding (self)
 Returns current cluster representation.
 
def get_clusters (self)
 Returns clusters representation.
 
def get_data (self)
 Returns data that corresponds to clusters.
 
def set_encoding (self, encoding)
 Change clusters encoding to specified type (index list, object list, labeling). More...
 

Detailed Description

Provides service to change clustering result representation.

Example:

# load list of points for cluster analysis
sample = read_sample(path);
# create instance of K-Means algorithm
kmeans_instance = kmeans(sample, [ [0.0, 0.1], [2.5, 2.6] ]);
# run cluster analysis and obtain results
kmeans_instance.process();
clusters = kmeans_instance.get_clusters();
# by default k-means returns representation CLUSTER_INDEX_LIST_SEPARATION
type_repr = kmeans_instance.get_cluster_encoding();
encoder = cluster_encoder(type_repr, clusters, sample);
# change representation from index list to label list
representor.set_encoding(type_encoding.CLUSTER_INDEX_LABELING);
# change representation from label to object list
representor.set_encoding(type_encoding.CLUSTER_OBJECT_LIST_SEPARATION);

Definition at line 46 of file encoder.py.

Constructor & Destructor Documentation

◆ __init__()

def pyclustering.cluster.encoder.cluster_encoder.__init__ (   self,
  encoding,
  clusters,
  data 
)

Constructor of clustering result representor.

Parameters
[in]encoding(type_encoding): Type of clusters representation (index list, object list or labels).
[in]clusters(list): Current clusters representation.
[in]data(list): Data that corresponds to clusters.

Definition at line 74 of file encoder.py.

Member Function Documentation

◆ set_encoding()

def pyclustering.cluster.encoder.cluster_encoder.set_encoding (   self,
  encoding 
)

Change clusters encoding to specified type (index list, object list, labeling).

Parameters
[in]encoding(type_encoding): New type of clusters representation.

Definition at line 114 of file encoder.py.


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