mescla.prep.missing.largest_complete_block¶
- mescla.prep.missing.largest_complete_block(table, min_species=2)[source]¶
Find the complete sub-matrix retaining the most data.
Greedily drops the species that buys the most, stopping when dropping another would retain less data overall. The objective is
complete_samples x species_kept, not the sample count alone: a block of 58 samples with 2 species is worse than 51 samples with 5, and optimising sample count alone walks straight into the former.Not guaranteed optimal – the exact problem is combinatorial – but it is fast and, in practice, hard to beat by hand.
- Parameters:
- Returns:
ChemTable – A complete block: no missing values.
- Return type:
Examples
>>> block = largest_complete_block(ragged) >>> block.shape (51, 5)