What is machine learning?
Machine learning builds a model that learns patterns from labelled examples, meaning samples where the outcome is already known, and uses those patterns to predict the outcome for new samples. This is supervised learning, where every training sample carries a known target. It differs from unsupervised methods such as clustering, which group samples by similarity without any predefined outcome. On Cosmos-Hub 2.0, the inputs for each sample are its microbial features (the relative abundance of taxa or functions) together with any covariates (additional sample information such as sex, treatment, disease status, or BMI). The outcome the model learns to predict is the target variable. The two modules differ in the type of target they predict:- ML Regression predicts a continuous value, such as a metabolite concentration, an inflammation marker, or a clinical score.
- ML Classification predicts a category, such as patient versus healthy control, responder versus non-responder, or one of several body sites.
Why is it useful?
- Predict a trait or class from the microbiome. Build reusable models that estimate the target for unseen samples from their microbial features, for example whether a stool sample comes from a patient or a control, as commonly done in host-phenotype classification studies.
- Find candidate feature to follow up. Feature importance produces a data-driven shortlist of the taxa or functions that most drive accurate prediction, a common route to biomarker discovery.
- Capture effects that linear models miss. Flexible algorithms such as random forests or gradient boosting can model nonlinear relationships, for example a taxon that matters only above a threshold, or only in combination with another.
How does it work?
1
Assemble the input
Each sample’s microbial features in your Cohort’s Data Table, your Target Variable that you want to predict, and covariates are assembled into the input Data Table.
2
Train the model
The chosen algorithm learns the patterns that relate the features to the Target Variable on part of the data.
3
Evaluate with cross-validation
Performance is checked on held-out samples using K-fold cross-validation, providing an estimate of how well the model generalizes to new data.
4
Read predictions and feature importance
Results are summarized as accuracy diagnostics plus a ranked list of the features that most influenced the predictions.