fuzzyclust.coclustering.make_block_matrix#

fuzzyclust.coclustering.make_block_matrix(n_blocks=3, n_objects_per_block=40, n_items_per_block=20, in_rate=3.0, out_rate=0.3, n_noise_items=0, shuffle=True, random_state=None)[source]#

A block-structured object–item count matrix with known co-clusters.

Objects and items are grouped into n_blocks co-clusters; an entry is a Poisson count with mean in_rate when object and item belong to the same block and out_rate otherwise (a document–term matrix with topics and their vocabularies). n_noise_items extra items cooccur with every block at the background rate. Rows and columns are shuffled by default so that the block structure is hidden from the eye and has to be recovered.

Parameters:
n_blocksint, default=3
n_objects_per_blockint or sequence of int, default=40
n_items_per_blockint or sequence of int, default=20
in_ratefloat, default=3.0

Poisson mean inside the blocks.

out_ratefloat, default=0.3

Poisson mean outside the blocks.

n_noise_itemsint, default=0

Items without a block (label -1).

shufflebool, default=True
random_stateint, RandomState instance or None
Returns:
Rndarray of shape (n_objects, n_items)

Count matrix.

row_labelsndarray of shape (n_objects,)

Block of every object.

col_labelsndarray of shape (n_items,)

Block of every item (-1 for noise items).

Examples

>>> from fuzzyclust.coclustering import make_block_matrix
>>> R, rows, cols = make_block_matrix(n_blocks=2, n_objects_per_block=10, n_items_per_block=5,
...                                   random_state=0)
>>> R.shape, int(rows.max()), int(cols.max())
((20, 10), 1, 1)

Examples using fuzzyclust.coclustering.make_block_matrix#

Fuzzy co-clustering of a document–term matrix

Fuzzy co-clustering of a document--term matrix