What is Machine Learning?
Machine Learning builds statistical models that learn ‘hidden’ patterns in training data. The input can be microbial taxonomic or functional profiles, or sample metadata (e.g. BMI, sex, age). The model learns from training examples for which the outcome of interest is already known (e.g. onset of a disease, sample source, levels of a circulating metabolite). Once a model is trained and validated, it can use the patterns it learned to predict the outcome for new samples, where the outcome is not available.Supervised, unsupervised and semi-supervised learningLearning from data whose outcome (i.e. the ‘label’) is known in advance is called Supervised Machine Learning.When the labels are unknown, the approach is called Unsupervised. The goal is to discover patterns that are inherent to the data, without a specific outcome of interest. For example, clustering gut microbiome profiles by beta-diversity and PCA led to the proposal of ‘enterotypes’: three groups of individuals whose gut communities are dominated by Bacteroides, Prevotella or Ruminococcus (Arumugam et al., Nature 2011).Semi-supervised approaches use a few labelled samples together with many unlabelled ones. For example, in a cohort where only some participants have a confirmed diagnosis, the profiles of the undiagnosed participants still help the model learn how samples group together.
Uses of Machine Learning
- 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.
Machine Learning on Cosmos-Hub 2.0
The analysis studio on Cosmos-Hub 2.0 hosts Analysis modules for ML Regression and ML Classification tasks. As other analyses modules, input data is defined by the Data Table and metadata defined by the cohort used in the currently opened Analysis Project. Depending on the type of ‘omics described by Data Table (taxonomic or functional composition, MBS) currently used by the AP, the input to ML modules consist in the (1) table describing microbial feature abundances for the cohort samples (e.g: table with the taxa relative abundances across the cohort) and (2) sample metadata, which shall include the outcome of interest (i.e: the metadata that describes what you want to predict) and any co-variate of interest for the current study (e.g: additional sample information such as sex, treatment, disease status, or BMI) 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.
1
Prepare the input
The Cohort Data Table of the current Analysis Project is pre-processed to make it suitable as input for the analysis module. Depending on the goals of the analysis and on the available metadata, the parameters specific to ML allow you to process the input Data Table further, by applying covariate correction or by removing the samples that have no label for the Target Variable.
2
ML model selection and hyperparameter optimization
Cosmos-Hub 2.0 supports different Machine Learning algorithms. Each algorithm has hyperparameters, settings that are not learned from the data and must be chosen in advance. The selected ML Algorithm is trained with several values of one of its hyperparameters. To avoid choosing a value that overfits the training data, each value is trained on subsets of the data and evaluated on the samples that were left out (K-fold cross-validation).
3
Evaluate the model
The best-performing model produces out-of-fold predictions, in which each sample is predicted by a model trained on the other folds. The performance metrics are calculated from these predictions.
4
Refit the model and rank the features
The best-performing model is refit on the full dataset. Feature importance and all diagnostic measures and plots are calculated from this optimised model.