cratepy.clustering.clusteringphase.ClusterAnalysis

class ClusterAnalysis[source]

Bases: object

Interface to perform a cluster analysis.

available_clust_alg

Available clustering algorithms (item, str) and associated identifiers (key, str).

Type:

dict

get_fitted_estimator(self, data_matrix, clust_alg_id, n_clusters):

Get cluster labels and clustering fitted estimator.

Constructor.

List of Public Methods

get_fitted_estimator

Get cluster labels and clustering fitted estimator.

Attributes

available_clustering_alg

Methods

__init__()[source]

Constructor.

get_fitted_estimator(data_matrix, clust_alg_id, n_clusters)[source]

Get cluster labels and clustering fitted estimator.

Parameters:
  • data_matrix (numpy.ndarray (2d)) – Data matrix containing the required data to perform the cluster analysis (numpy.ndarray of shape (n_items, n_features)).

  • clust_alg_id (str) – Clustering algorithm identifier.

  • n_clusters (int) – The number of clusters to find.

Returns:

  • cluster_labels (numpy.ndarray (1d)) – Cluster label (int) assigned to each dataset item.

  • clust_alg (function) – Clustering fitted estimator.

  • is_n_clusters_satisfied (bool) – True if the number of clusters obtained from the cluster analysis matches the prescribed number of clusters, False otherwise.