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_blocksco-clusters; an entry is a Poisson count with meanin_ratewhen object and item belong to the same block andout_rateotherwise (a document–term matrix with topics and their vocabularies).n_noise_itemsextra 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_blocks
int, default=3 - n_objects_per_block
intor sequenceofint, default=40 - n_items_per_block
intor sequenceofint, default=20 - in_rate
float, default=3.0 Poisson mean inside the blocks.
- out_rate
float, default=0.3 Poisson mean outside the blocks.
- n_noise_items
int, default=0 Items without a block (label
-1).- shufflebool, default=True
- random_state
int,RandomStateinstanceorNone
- n_blocks
- Returns:
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)