coclust.coclustering.CoclustSpecMod

class coclust.coclustering.CoclustSpecMod(n_clusters=2, max_iter=20, tol=1e-09, n_init=1, random_state=None)[source]

Co-clustering by spectral approximation of the modularity matrix.

Parameters:
  • n_clusters (int, optional, default: 2) – Number of co-clusters to form
  • max_iter (int, optional, default: 20) – Maximum number of iterations
  • n_init (int, optional, default: 10) – Number of time the k-means algorithm will be run with different centroid seeds. The final results will be the best output of n_init consecutive runs in terms of inertia.
  • random_state (integer or numpy.RandomState, optional) – The generator used to initialize the centers. If an integer is given, it fixes the seed. Defaults to the global numpy random number generator.
  • tol (float, default: 1e-9) – Relative tolerance with regards to criterion to declare convergence
row_labels_

array-like, shape (n_rows,) – Bicluster label of each row

column_labels_

array-like, shape (n_cols,) – Bicluster label of each column

References

  • Labiod L., Nadif M., ICONIP‘11 Proceedings of the 18th international conference on Neural Information Processing - Volume Part II Pages 700-708
fit(X, y=None)[source]

Perform co-clustering by spectral approximation of the modularity matrix

Parameters:X (numpy array or scipy sparse matrix, shape=(n_samples, n_features)) – Matrix to be analyzed
get_indices(i)

Give the row and column indices of the i’th co-cluster.

Parameters:i (integer) – Index of the co-cluster
Returns:(row indices, column indices)
Return type:(list, list)
get_params(deep=True)

Get parameters for this estimator.

Parameters:deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns:params – Parameter names mapped to their values.
Return type:mapping of string to any
get_shape(i)

Give the shape of the i’th co-cluster.

Parameters:i (integer) – Index of the co-cluster
Returns:(number of rows, number of columns)
Return type:(int, int)
get_submatrix(m, i)

Give the submatrix corresponding to co-cluster i.

Parameters:
  • m (X : numpy array or scipy sparse matrix) – Matrix from which the block has to be extracted
  • i (integer) – index of the co-cluster
Returns:

Submatrix corresponding to co-cluster i

Return type:

numpy array or scipy sparse matrix

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:
Return type:self