Initialization

The coclust.initialization module provides functions to initialize clustering or co-clustering algorithms.

coclust.initialization.random_init(n_clusters, n_cols, random_state=None)[source]

Create a random column cluster assignment matrix.

Each row contains 1 in the column corresponding to the cluster where the processed data matrix column belongs, 0 elsewhere.

Parameters:
  • n_clusters (int) – Number of clusters
  • n_cols (int) – Number of columns of the data matrix (i.e. number of rows of the matrix returned by this function)
  • random_state (int or numpy.RandomState, optional) – The generator used to initialize the cluster labels. Defaults to the global numpy random number generator.
Returns:

Matrix of shape (n_cols, n_clusters)

Return type:

matrix

coclust.initialization.random_init_clustering(n_clusters, n_rows, random_state=None)[source]

Create a random row cluster assignment matrix.

Each row contains 1 in the column corresponding to the cluster where the processed data matrix row belongs, 0 elsewhere.

Parameters:
  • n_clusters (int) – Number of clusters
  • n_rows (int) – Number of rows of the data matrix (i.e. also the number of rows of the matrix returned by this function)
  • random_state (int or numpy.RandomState, optional) – The generator used to initialize the cluster labels. Defaults to the global numpy random number generator.
Returns:

Matrix of shape (n_rows, n_clusters)

Return type:

matrix