freediscovery.cluster.ClusterLabels

class freediscovery.cluster.ClusterLabels(vect, model, pars, lsi=None, cluster_indices=None)[source]

Calculate the cluster labels.

This is an internal class that is called by Clustering

Parameters:
  • vect (VectorizerMixin object) – a scikit-learn’s text vectorizer
  • model (ClusterMixin object) – the cluster object
  • pars (dict) – clustering algorithms parameters
  • lsi_components (TruncatedSVD object or None) – LSA object if it was used for clustering
  • cluster_indices (list, default=None) – if not None, ignore clustering given by the clustering model and compute terms for the cluster provided by the given indices
__init__(vect, model, pars, lsi=None, cluster_indices=None)[source]

Methods

__init__(vect, model, pars[, lsi, ...])
predict([method, n_top_words]) Compute the cluster labels
predict(method=u'centroid-frequency', n_top_words=6)[source]

Compute the cluster labels

Parameters:
  • method (str, optional, default='centroid-frequency') – the method used to compute the centroid labels Must be one of ‘centroid-frequency’,
  • n_top_words (int, default=10) – keep only most relevant n_top_words words
Returns:

cluster_labels

Return type:

array [n_samples]