Feature Representation for Microbial ML

One-Sentence Definition

Feature representation is how raw microbial data (reads, genomes, images, spectra, abundances) are turned into numeric inputs that algorithms can learn from — often the step that decides success more than the choice of model.

Simple Explanation

The algorithm only sees numbers. Your job is to turn a bacterium into a sensible table (or tensor) without leaking the answer or encoding the wrong biology.

Detailed Scientific Explanation

RepresentationBuilt fromStrengthsWeaknesses
k-mer counts / presenceReads or assembliesNo annotation needed; captures novel sequenceLarge, sparse; strain similarity leakage
Gene / allele matrixPangenome Analysis, Roary/Panaroo, DIGSInterpretable; ties to mechanismsAnnotation gaps; accessory gene noise
AMR determinant vectorAMR Gene DatabasesDirect clinical meaningMisses unknown mechanisms; database lag
SNP / variant matrixCore genome alignmentFine outbreak/AMR mutation signalReference bias; recombination
Unitigs / DBG featuresAssembly graphsCompact sequence variationHarder to interpret
LM embeddingsDNA and Genome Language Models, Protein Language ModelsTransfer learning; soft homologyOpaque; compute cost
Image tensorsPixels / patchesEnd-to-end with CNNsStain/instrument shift
Spectral vectorsMALDI/FTIR peaksFast IDCalibration drift across machines
Microbiome matricesASV counts → CLR / rarefactionCommunity ecologyCompositionality; batch effects

Encoding tips

  • Binary presence/absence often beats raw counts for accessory genes
  • For microbiome, respect compositionality (Microbiome Statistics) — CLR or similar before Euclidean models
  • Normalize or batch-correct within training folds only (no leakage)
  • Keep a mapping from feature → biological object for explainability (SHAP on gene names)

Mechanism

Features define the hypothesis space: a linear model on blaKPC presence can rediscover a known mechanism; a raw k-mer model may predict correctly via lineage hitchhiking (Population Structure Confounding in Microbial ML).

Clinical Importance

  • Interpretable features (known AMR genes) are easier to defend in lab meetings than black-box embeddings
  • Feature drift (new plasmid, new stain kit) breaks models silently

Research Importance

Diagnostic Relevance

AMR Relevance

Active Recall Questions

  1. Why might a perfect k-mer AMR model still be biologically misleading?
  2. When is a curated AMR gene vector preferable to whole-genome embeddings?
  3. What goes wrong if you batch-correct using the full dataset before splitting?

Connections