Skip to main content
Gut Microbes logoLink to Gut Microbes
. 2026 Oct 5;18(1):2741488. doi: 10.1080/19490976.2026.2741488

LGTM: Gaussian process modulated neural topic modeling for longitudinal microbiome

Xiao Yuan a,b, Ádám Arany c, András Formanek c,d, Yves Moreau c, Harri Lähdesmäki b,*, Tommi Vatanen a,e,f,g,h,*
PMCID: PMC13644641  PMID: 42832513

Abstract

Longitudinal microbiome data are key to understanding the dynamics of microbial communities and their relationships with the host and environment. However, analysis of such data is challenging due to high dimensionality, compositionality, irregular sampling and temporal dependencies on external covariates. Existing analytical approaches typically address only subsets of these challenges, limiting their ability to yield biologically interpretable insights. We introduce LGTM, a probabilistic modeling framework that combines flexible non-linear longitudinal modeling with interpretable topic-based representations of the microbiome. LGTM simultaneously identifies microbial co-abundance patterns (“topics”) and models how their proportions change over time and in relation to host and environmental covariates. Using multiple longitudinal human gut microbiome datasets, we demonstrate that LGTM identifies diverse microbial topics whose major patterns are reproducible across runs, while achieving competitive performance in imputation and forecasting tasks. A key strength of the framework is its interpretability: LGTM yields microbial topics with biologically interpretable taxonomic compositions and directly quantifies associations between covariates and microbial dynamics. LGTM is available at https://github.com/yuanx749/lgtm.

Keywords: Metagenome, longitudinal study, Gaussian process, topic model, autoencoder

1. Introduction

Longitudinal gut microbiome studies provide a window into microbial ecology in vivo, enabling direct observation of community assembly, succession, and stability across host development or perturbations. 1-3 By repeatedly sampling the same individuals over time, these data offer a unique opportunity to characterize the dynamics and individualized ecological trajectories, and their associations with host and environmental covariates. 4-7 However, analyzing longitudinal microbiome data presents several challenges. First, they are high-dimensional, often comprising hundreds to thousands of microbial taxa. Second, relative abundances are compositional, meaning that they represent proportions constrained to sum to one. Third, longitudinal sampling is often sparse and irregular due to practical constraints common in gut microbiome studies, leading to missing data at various timepoints for many subjects. Fourth, microbial compositions exhibit complex temporal patterns that can vary across subjects and groups, influenced by factors like diet, disease state, medications or other host-associated perturbations. Together, these characteristics substantially complicate inference of meaningful ecological trajectories from longitudinal gut microbiome data using existing analytical approaches.

Existing approaches for analyzing longitudinal microbiome data include linear mixed-effects models (LMMs), generalized Lotka–Volterra (gLV) models, Gaussian processes (GPs) and neural network-based models. Beyond accurate modeling of temporal dynamics, longitudinal gut microbiome studies require interpretable representations that enable comparison of microbial trajectories across individuals and conditions. LMMs are widely used for association analysis 8 but analyze taxa independently and struggle to flexibly capture non-linear temporal patterns or inter-taxa dependencies. The gLV equations model interactions between taxa 9 , 10 but they are mechanistic and typically only applicable to simple model communities with a limited number of taxa. GPs offer a non-parametric approach for time-series modeling and have been applied to longitudinal gut microbiome data, 11 , 12 yet they do not capture interactions between taxa. Neural networks are particularly powerful at modeling high-dimensional data. Deep learning-based sequence models, including recurrent neural networks (RNNs) and transformers, have shown strong performance in imputing general time-series data. 13-15 While RNN-based models have been applied to microbiome data, 16 they require discretizing time into intervals and do not quantify uncertainty. Neural differential equation-based methods 17 have also been explored for microbiome analysis, 18 but external covariates beyond time were ignored and taxa selections were performed manually. Generative models, especially variational autoencoders (VAEs), are distinguished by their ability to learn low-dimensional representations and generate imputations with inherent uncertainty. 19 , 20 Conditional VAEs with GP priors are introduced to capture shared and individual temporal patterns while also handling auxiliary covariates. 21-23 Recently, an approach leveraging basis function approximation for GP priors has been proposed to overcome the scalability issue, 24 demonstrating state-of-the-art performance on imputation and forecasting tasks on general longitudinal data. Nevertheless, applying these models to gut microbiome data requires explicit treatment of compositionality; moreover, despite their expressiveness, most neural network-based approaches lack direct biological interpretability.

A complementary line of research for high-dimensional data analysis focuses on unsupervised dimensionality reduction. Topic modeling, originating from natural language processing, discovers latent topics from a collection of documents and infers the topics a document contains, where a topic is described as a group of related words. 25 Foundational methods include nonnegative matrix factorization (NMF) 26 and probabilistic graphical models built on latent Dirichlet allocation (LDA). 25 Classical LDA requires labor-intensive, model-specific derivations for parameter updates. In the deep learning paradigm, neural topic models are proposed for efficient and flexible inference. 27-29 Because of the interpretability and suitability for count data, topic models have been applied to biological sequencing data. While modern neural topic models are increasingly used in single-cell omics to learn complex gene signatures, 30 , 31 microbiome researchers have mainly relied on classical methods to reveal microbial subcommunities. 32 , 33 This line of work has discussed and advanced latent decomposition methods in microbiome data analysis, 34 spanning latent variable modeling, 35 longitudinal and perturbation analyses, 36 and topic alignment across resolutions. 37 Most topic-modeling approaches, however, are static. They model data at the sample level and do not account for temporal correlations between samples or the influence of covariates. This motivates a neural framework in which differentiable components can be composed with temporal and covariate modules under a unified end-to-end formulation.

To address these challenges, we present Longitudinal Gaussian process modulated neural Topic modeling for Microbiome data analysis (LGTM). By jointly learning latent factors and external covariates, our model yields interpretable representations of gut microbial dynamics, with latent factors characterized by key taxa and linked to host and environmental covariates. Using multiple longitudinal gut microbiome datasets, we demonstrate that LGTM achieves competitive predictive performance while identifying diverse microbial topics, corresponding to latent factors, that co-vary with external covariates in biologically meaningful patterns. Together, these results establish a framework for analyzing longitudinal gut microbiome data that supports biologically interpretable investigation of microbial ecological trajectories over time.

2. Methods

2.1. Problem formulation

We consider a longitudinal microbiome study comprising N samples collected from multiple subjects across time, each sample profiled for D microbial taxa (e.g., species). Let Y=[y1,…,yN]⊤∈R+N×D denote the relative abundance table. Here, each row y∈ΔD represents the microbial profile of a sample, and ΔD denotes a standard (D−1) -simplex, i.e., the space of nonnegative vectors summing to one. Additionally, each sample is associated with a set of metadata or covariates, collectively denoted as X=[x1,…,xN]⊤ , where x∈X=∏q=1QXq , and Xq is the domain of the q -th covariate. The covariates may be continuous (e.g., time) or categorical (e.g., subject ID).

Let L be the number of topics or latent dimensionality, where L≪D . Each topic is defined as a distribution over the D taxa, i.e., topic-taxon distribution β∈ΔD . The full set of topics forms the topic matrix B=[β1,…,βL]⊤∈R+L×D . Each sample’s microbial profile is modeled as a mixture of these topics. The topic proportions for all samples are denoted as Θ=[θ1,…,θN]⊤∈R+N×L , where θ∈ΔL is the sample-topic distribution and also the low-dimensional latent representation of a sample.

Intuitively, LGTM has three coupled parts. The encoder learns sample-level topic mixtures, the decoder learns which taxa characterize the shared topics, and the covariate module learns how the topic mixtures change with time and other metadata. The topics are shared across samples, and covariates affect how the shared topics are mixed in each sample. In the covariate module, each covariate or covariate-time interaction contributes a separate component to the topic proportions. This additive structure allows us to summarize which covariates are associated with variation in each topic. See Figure 1 for an overview of the model.

Figure 1.

Diagram of a data processing pipeline with encoder, decoder, and covariate module for microbiome profile reconstruction. A diagram presents a data processing pipeline. A large square matrix labeled Y with axes Samples and Taxa has an arrow pointing to a trapezoid labeled Encoder. An arrow from the Encoder points to a vertical rectangular matrix labeled Theta with axes Samples and Topics. This matrix is multiplied by a horizontal rectangular matrix labeled B with axes Topics and Taxa, which is enclosed in a rounded rectangle labeled Decoder. An arrow from the Decoder points to a large square matrix labeled Y hat with axes Samples and Taxa. Below this main flow, a rounded rectangle labeled Covariate module contains two small line graphs with axes and curves, separated by a plus sign. An arrow from a label X points to this module, and an arrow from the module points up to the Theta matrix. A dashed pathway shows a label X star with a dashed arrow pointing to the Covariate module. A dashed arrow from the module points to a small vertical rectangular matrix labeled Theta star with a small x above it. A dashed arrow from the Decoder and a dashed arrow from Theta star both point to a dashed large square matrix labeled Y tilde star.

Overview of LGTM. The observed microbiome profile Y is mapped by an encoder to topic proportions Θ in a simplex-valued latent space, and decoded by the topic-taxon matrix B to reconstruct Y^ . In parallel, a covariate module uses additive GP components via basis-function approximations to map covariates X (e.g., time, subject ID, and other metadata) to generate covariate-modulated topic proportions. During training, the encoder and GP-modulated topic proportions are aligned via a KL term, together with cross-entropy reconstruction and GP regularization, and all components are optimized end-to-end. LGTM can perform both topic discovery ( Y≈ΘB ) and prediction for new covariates using the learned decoder. The dashed pathway illustrates prediction for new covariates X∗ , where predicted topic proportions Θ∗ are combined with the shared topic-taxon matrix B to generate Y~∗ .

2.2. Gaussian process and kernel approximation

A GP regression model 38 defines a distribution over functions of the form f:X→ℝ , where X is an arbitrary domain. It assumes that function values at any finite set of inputs are jointly Gaussian. Such a process, denoted by f(x)∼GP(μ(x),K(x,x′)) , is defined by a mean function μ(x) (typically zero) and a covariance function K(x,x′) , which is any positive definite kernel. The kernel encodes prior knowledge about the function’s properties, such as smoothness or non-linearity.

A primary limitation of GPs is the time complexity that scales as O(N3) due to the need to invert the kernel matrix. To overcome this, we adopt basis function approaches 24 , 39 , 40 to approximate the kernels and the GPs. Stationary continuous kernels are covariance functions that depend only on the distance between two inputs, i.e., K(x,x′)=K(|x−x′|)=K(r) , where x is a univariate covariate. By Bochner’s theorem, any stationary continuous kernel can be represented as the Fourier transform of a positive measure: K(r)=12π∫−∞∞s(ω)eiωrdω , where s(ω) is the associated spectral density. It has been shown that such stationary kernels can be approximated as 39 :

K(x,x′)≈K~(x,x′)=∑m=1Ms(λm)ϕm(x)ϕm(x′),λm=(πm2J)2,ϕm(x)=1Jsin(πm(x+J)2J), (1)

where λm and ϕm(x) are the m -th eigenvalue and eigenfunction of the Laplace operator on a bounded interval [−J,J] . The Hilbert space approximation allows the GP to be represented in a linear parametric form using basis functions ϕ(x)=[ϕ1(x),…,ϕM(x)]⊤∈RM and corresponding weights a∈RM :

f(x)≈a⊤ϕ(x),a∼N(𝟎,S), (2)

where S=diag(s(λ1),…,s(λM)) . This achieves a time complexity of O(NM) linear in N .

We use the squared exponential (SE) kernel Kse(x,x′∣σ,ℓ) for continuous covariates, where σ and ℓ denote the amplitude and the length scale, respectively. We also model categorical covariates and their interactions with continuous covariates using basis functions. 40 See Appendix A for details.

2.3. Generative topic models

We now describe the probabilistic topic model that forms the core of LGTM. Drawing an analogy to natural language documents, each sample is treated as a “document” composed of sequencing reads, and the taxon to which a read maps corresponds to a “word” from a vocabulary of taxa. We assume that each sample can be represented as a mixture of microbial subcommunities, which are referred to as topics. We use “subcommunity” as an operational term for a co-abundance topic, i.e., a statistical association among taxa, not an ecological guild or functional group. Consider a collection of N samples with D taxa and L topics. Topic modeling can be viewed as a non-negative Bayesian matrix factorization. The relative abundance matrix Y∈R+N×D is factorized into two low-rank matrices, Θ∈R+N×L and B∈R+L×D , where each row of them lies on a simplex, θn∈ΔL and βl∈ΔD . We directly model relative abundance, which is the primary quantity of interest in many microbiome analyses, as raw read counts do not reflect the actual microbial load and need to be normalized to account for variations in sequencing depth. 41 , 42

Unlike standard LDAs, where the latent variable θ follows a Dirichlet 25 or a logistic-normal distribution, 27 we condition θ on covariates x . Specifically, we use GPs to modulate the latent space. GPs can be extended to multiple outputs and multiple additive components, 23 , 43 in the form f(r):X(r)→ℝL , where r∈{1,…,R} and R is the number of components. Each additive GP component depends on a single or a pair of covariates x(r)∈X(r)⊆X . The sum of these components is the cumulative effect of the covariates. The additive GP structure allows modeling shared and random effects and is interpretable similarly to LMMs.

Concretely, for our longitudinal data, we construct additive components as follows. One component uses an SE kernel on time to model shared temporal patterns, and one component uses a categorical kernel on subject ID to model individual effects. For each of the other categorical covariates, we add an interaction component using an interaction kernel that depends on time and a categorical covariate, to model group-specific temporal patterns.

Following Balık et al., 24 we apply the Hilbert space approximation to each component and each latent dimension separately. Take the SE kernel as an example, and let A(r)=[a1(r),…,aL(r)]⊤∈RL×M denote the linear parameters from Equation (2). Following Equations (1) and (2), the r -th component is approximated as:

al(r)∼N(𝟎,diag({sse(λm∣σ(r),ℓ(r))}m=1M))f(r)(x(r))≈A(r)ϕ(x(r)), (3)

where sse(⋅) is the spectral density of the SE kernel, and σ(r) and ℓ(r) have log-normal priors. This formulation extends directly to interaction kernels. For enhanced interpretability of the component latent functions, we depart from previous work 23 , 24 that sums the components. Instead, we apply a softmax transformation to constrain each component to the simplex, and then average them to obtain the topic proportions:

g(r)(x(r))=softmax(A(r)ϕ(x(r)))θ=g(x)=1R∑r=1Rg(r)(x(r)). (4)

For samples with missing covariates, we ignore components g(r)(x(r)) that have missing covariates and simply average over the components with observed covariates. Consequently, the overall covariate effect on topic proportions is decomposed into functions of individual covariates and their interactions. Finally, the decoder produces the relative abundance from the topic-taxon distribution matrix and the topic proportions: y~=B⊤θ .

2.4. Training and optimization

We adopt an autoencoding architecture as in past work on neural topic models. The encoder network maps each sample to latent topic proportions through a logistic-normal transformation (a Gaussian followed by a softmax). The encoder is parameterized by a multilayer perceptron (MLP) with one hidden layer. The decoder is a single linear layer. Each row of its weight matrix is a softmax-transformed vector of learnable parameters. To mitigate instability from random initialization, we apply nonnegative double singular value decomposition (NNDSVD) 44 on the training data and initialize decoder’s parameters based on its output.

During training, the model reconstructs the relative abundance via y^=B⊤θ(e) , where θ(e) is sampled from the encoder distribution q(θ|y) . In parallel, the covariate module generates GP-modulated topic proportions θ(g) , which are used for prediction via y~=B⊤θ(g) . Note that the topic proportions θ(e) and θ(g) can be interpreted as probability distributions over topics. The covariate module is parameterized by a collection of weights A={A(r)}r=1R that provide an approximation for the additive GP model in Equation (4). These weights are endowed with the prior given in Equation (3). All model parameters are jointly optimized by minimizing a loss composed of a reconstruction term and Kullback–Leibler (KL) regularization terms. The loss for one sample is defined as:

L=Eq(θ|y)[−y⊤log(y^)]+Eq(θ|y)Eq(A)[KL(θ(e)∥θ(g))]+KLGP. (5)

The first term is the cross-entropy between the observation y and its reconstruction y^ . Note that under a multinomial assumption, the log-likelihood reduces to cross-entropy up to a constant (Appendix F.2.1). The second term measures the KL divergence between the encoder output and the output from the covariate module across the L topics. It is computed as ∑l=1Lθl(e)log(θl(e)/θl(g)) , where expectations are approximated using Monte Carlo, and θl(e) and θl(g) are the l -th elements of θ(e) and θ(g) , respectively. This term closes the gap between the training and testing pipelines, similar to the idea of conditional VAEs. 20 Because the covariate module outputs the mean of softmax-transformed additive GPs and does not yield a closed-form density, this KL term provides a practical way to encourage consistency between the learned latent representation (i.e., encoder output) and the GP-modulated topic proportions without relying on an explicit evidence lower bound. The third term is the KL divergence regularizing the parameters of the approximate GPs: as derived by Balık et al., 24 it has a closed-form expression (Appendix B). A scaling coefficient is applied to balance its contribution with the other loss terms. The total loss is minimized via stochastic gradient descent with mini-batching. 45 This formulation allows LGTM to be trained in an end-to-end differentiable manner while incorporating covariates to modulate the latent space.

2.5. Hyperparameter selection and covariate importance

The number of topics, i.e., the latent dimension L , is an important hyperparameter of a topic model. Existing methods based on held-out likelihood 46 or topic dissimilarity 47 often do not exhibit a clear optimum and tend to favor large values of L . This contrasts with typical microbiome studies where a small L is preferred to maintain biological interpretability. 32 , 33 We therefore view L as controlling the resolution of the topic representation and encourage choosing it in accordance with the biological question and downstream interpretation. As a complementary practical heuristic, we use profile likelihood 48 to detect the “elbow” point in the curve of reconstruction loss versus L . We further assess topic robustness with respect to L using topic alignment across a range of latent dimensions. See Appendix C.1 and Appendix C.2 for details.

To quantify the contribution of covariates to the model, we use a variance-based sensitivity analysis. 49 , 50 Specifically, for each latent dimension, we compute the total Sobol’ index of each covariate for the corresponding dimension of the multi-output latent function g(x) (Equation (4)). A large value indicates that the covariate has a strong influence on the variance of that specific topic. Because Sobol’ indices are defined relative to the variance of each output, we further multiply each index by the variance of the corresponding latent dimension. This variance weighting places the indices on a common variance scale, such that values are directly comparable across both latent dimensions and covariates. In addition, we compute the aggregated Sobol’ index 51 to obtain an overall importance score per covariate, by averaging the topic-specific indices, weighted by the variance of each dimension’s output.

3. Experiments and results

3.1. Datasets

We evaluated our model and demonstrated its application on three publicly available microbiome datasets with various characteristics. Each dataset comprises P subjects sampled at up to T timepoints, as summarized in Table 1. The Dhaka dataset contains metagenomic data from a cohort of P=222 young children from Dhaka, Bangladesh. Taxonomic profiles were generated by MetaPhlAn2. 41 The DIABIMMUNE dataset contains 16S rRNA amplicon sequencing data from a study of young children in Finland, Estonia, and Russia, focusing on the early gut microbiome and its associations with autoimmune development and aberrations. The HMP2 dataset contains metagenomic data from the Integrative Human Microbiome Project, which focuses on the gut microbiome in inflammatory bowel disease (IBD). See Appendix D for more details.

Table 1.

Summary of longitudinal datasets. Each dataset includes P subjects sampled at up to T timepoints. #Taxa and #Covariates denote the number of taxa and metadata variables used in modeling. Missing rate is computed as 1−N/(P×T) , where N is the number of observed samples.

Dataset #Subjects #Timepoints #Taxa #Covariates Missing rate
Dhaka [52] 222 6 922 5 0.06
DIABIMMUNE [53] 271 37 105 7 0.70
HMP2 [54] 109 47 577 14 0.70

3.2. LGTM provides accurate imputation and forecasting of longitudinal microbial profiles

We conducted imputation and forecasting experiments to evaluate LGTM’s ability to perform temporal interpolation and future prediction. These supervised learning tasks involve predicting relative abundances at missing or future timepoints given observed data and covariates. We focused on the Dhaka and DIABIMMUNE datasets from young children for these tasks, as the microbiome in early life undergoes substantial changes and provides clear temporal signals for imputation and forecasting. We compared our model against several methods ranging between naive and advanced techniques, including the recently proposed deep generative basis function Gaussian process (DGBFGP). 24 Since both the observed y and the predicted y~ can be interpreted as probability vectors, we used cross-entropy as an evaluation metric, equivalent to the negative log-likelihood under a multinomial assumption. We reported the average test performance across multiple training-validation-test splits and multiple random seeds of the models. For imputation, we used sample-level splits (70/10/20); the training set includes samples from all subjects to model subject ID. For forecasting, we used subject-level splits (10% validation, 20% test); for validation/test subjects we input the first half of timepoints and evaluated on the second half. See Appendix E for more details.

Other studies 16 , 18 apply transformations to the data for training and evaluation, such as the centered log-ratio (CLR) transform, 55 which requires adding pseudocounts to handle unobserved taxa (i.e. zeros). 56 We found that models optimized for mean squared error (MSE) on log-transformed data performed poorly when their predictions were converted back to relative abundances (Appendix E.3). We therefore assessed predictive performance directly on the compositional data using likelihood, following the convention in topic modeling. This approach avoided potential biases introduced by log-transformation and aligned with the model’s probabilistic formulation. MSE for the compositional data was included in the results for reference.

Overall, our model outperformed the RNN-based BRITS and attention-based SAITS, which are widely used for time-series imputation, demonstrating the advantage of using GPs to capture covariate dependencies (Table 2). Compared to the state-of-the-art DGBFGP, our model provided a favorable trade-off by replacing the black-box MLP decoder with an interpretable topic model linear decoder. This design provides biological interpretability in the latent space, while incurring a minor decrease in predictive accuracy.

Table 2.

Imputation and forecasting performance on two children datasets (Dhaka and DIABIMMUNE). Impute denotes predicting missing timepoints, and Forecast denotes predicting future timepoints given early observations. Both tasks are trained with observed microbiome profiles, but at prediction time the model uses covariates only. NLL ( ↓ ) is the negative log-likelihood, and MSE ( ↓ ) is reported in 10−3 for reference. Results are averaged over multiple train/validation/test splits and random seeds. Results for the best and second-best methods are bolded and underlined, respectively.

  Dhaka
DIABIMMUNE
Impute
Forecast
Impute
Forecast
NLL MSE NLL MSE NLL MSE NLL MSE
Mean 3.34 0.215 3.90 0.190 2.92 1.32 2.89 0.90
Mean (subjectwise) 4.56 0.276 8.17 0.372 2.87 1.12 3.53 1.18
Linear interpolation 4.96 0.247 8.47 0.296 2.85 1.00 3.76 1.13
BRITS [13] 3.47 0.202 4.12 0.150 2.73 1.03 2.76 0.76
SAITS [15] 3.32 0.196 3.71 0.135 2.81 1.21 2.77 0.78
DGBFGP [24] 3.07 0.148 3.62 0.126 2.60 0.88 2.72 0.70
LGTM 3.11 0.150 3.68 0.135 2.69 1.01 2.75 0.73

3.3. LGTM discovers diverse and stable microbial topics

We next evaluated the quality of the topics discovered by the model using all three datasets. Our approach was compared with topic modeling methods that explicitly yield topic-taxon distributions, including classical approaches used in microbiome studies (NMF and LDA). We also included VAE-LDA, a neural topic model that does not incorporate covariates. Cross-validation was performed to assess the goodness of fit using likelihood. To assess topic quality, we measured diversity and stability. For diversity, we used the Jensen–Shannon (JS) divergence and Bray–Curtis dissimilarity to compute pairwise similarities between topics. We further defined the distance between two topic matrices as the minimized average JS distance 57 between matched topics, solving an assignment problem. 58 The pairwise topic matrix distance was then computed to quantify the stability of the model across runs with different random seeds. This task can be viewed as reconstruction, which is less challenging than prediction, since y is available during testing. See Appendix F for more details.

LGTM outperformed other models in topic diversity over a wide range of L (Figure 2). This indicates that there was consistently lower redundancy between topics discovered by LGTM compared to other models. The higher LGTM topic diversity is likely related to the simplex-level KL alignment between encoder-derived and GP-modulated topic proportions, which encourages diverse topics while maintaining reconstruction quality. In line with this, all the methods achieved a similar likelihood, indicating comparable reconstruction quality (Table 3).

Figure 2.

A three panel line graph compares LGTM, LDA, and NMF methods across Dhaka, DIABIMMUNE, and HMP2 profiles with error bars. The three panel line graph compares LGTM, LDA, and NMF methods across Dhaka, DIABIMMUNE, and HMP2 profiles. Each panel has a vertical axis from 0.0 to 1.0 and a horizontal axis from 2 to 20. Panel A, Dhaka, shows LGTM rising from 0.7 to a peak near 0.95, then decreasing to 0.85. LDA rises to 0.75, then decreases to 0.6. NMF rises to 0.75, then decreases to 0.5, before rising to 0.6. Panel B, DIABIMMUNE, shows LGTM decreasing from 0.9 to 0.8, then rising to 0.95, and decreasing to 0.9. LDA decreases from 0.75 to 0.6, then rises to 0.65. NMF decreases from 0.75 to 0.4, then rises to 0.7. Panel C, HMP2, shows LGTM decreasing from 0.95 to 0.85, then rising to 0.9, and decreasing to 0.85. LDA decreases from 0.65 to 0.5, then rises to 0.75, and decreases to 0.65. NMF decreases from 0.65 to 0.4, then rises to 0.6, and decreases to 0.35. All panels include error bars.

LGTM discovered diverse topics across a wide range of L . Topic diversity versus the number of topics on (a) Dhaka, (b) DIABIMMUNE and (c) HMP2 profiles. Diversity was measured as the minimum pairwise Jensen–Shannon divergence across topics. Points indicate mean across random seeds and error bars (vertical lines) indicate one standard deviation.

Table 3.

Topic discovery performance on three datasets. This task is reconstruction: topic proportions are inferred from observed microbiome profiles, and NLL ( ↓ ) is the cross-validated reconstruction negative log-likelihood. JSD ( ↑ ) is the minimum pairwise Jensen–Shannon divergence, and BCD ( ↑ ) is the minimum pairwise Bray–Curtis dissimilarity, both measuring topic diversity (higher is better). TD ( ↓ ) is the maximum pairwise topic matrix distance, measuring stability across runs (lower is better). nnd denotes the NNDSVD initialization. Results are averaged over multiple random seeds. Results for the best and second-best methods in diversity and stability are bolded and underlined, respectively.

  Dhaka
DIABIMMUNE
HMP2
  NLL JSD BCD TD NLL JSD BCD TD NLL JSD BCD TD
NMF [26] 2.74 0.747 0.843 0.028 2.46 0.758 0.846 0.021 3.03 0.478 0.610 0.028
NMF (w/o nnd) 2.74 0.761 0.850 0.166 2.47 0.621 0.722 0.384 3.03 0.515 0.641 0.529
LDA [25] 2.74 0.745 0.833 0.446 2.44 0.749 0.846 0.293 3.01 0.560 0.670 0.575
VAE-LDA [27] 2.77 0.764 0.846 0.489 2.45 0.666 0.797 0.344 3.06 0.648 0.777 0.614
LGTM (w/o nnd) 2.77 0.835 0.887 0.452 2.47 0.870 0.917 0.521 3.07 0.921 0.951 0.601
LGTM 2.74 0.840 0.877 0.124 2.45 0.796 0.871 0.142 3.03 0.854 0.904 0.081

Stochasticity stemming from model initialization is a critical challenge for topic models, potentially leading to different topic matrices across runs, making their interpretation somewhat arbitrary. It is known that NMF becomes nearly deterministic when initialized with NNDSVD to improve approximation. We adapted this technique to initialize the LGTM decoder and observed a substantial improvement in stability. This demonstrates that consistent initialization is a crucial step toward achieving reproducible results in deep generative topic models.

3.4. LGTM identifies interpretable microbial co-abundance patterns

Having shown quantitatively that our approach can effectively capture temporal dynamics while discovering diverse topics with improved stability across runs, we now qualitatively demonstrate the interpretability and utility of our model.

We first utilized metagenomes from young children in Dhaka, Bangladesh to model microbial succession and its associations with early feeding (Figure 3). LGTM learned sparse topics each characterized by a few distinct taxa. This sparsity is beneficial for interpretation, as it allows us to describe the data using a small number of key taxa that tend to either co-occur or have distinct abundance patterns. Unsurprisingly, child’s age accounted for the largest variation in topic proportions, indicating rapid gut microbiome development during the first two years of life. Breastfeeding had a relatively large influence on the composition of the microbiome, especially on the most prominent Topic 1, which was dominated by members of the genus Bifidobacterium.

Figure 3.

Four panel diagram shows a heatmap, bar graphs, line graphs, and strip plots analyzing longitudinal trends in young children. A four panel diagram analyzes longitudinal trends in young children. Panel A is a heatmap showing covariate importance for four topics. The vertical axis lists topics with proportions from 0.31 to 0. The horizontal axis lists covariates: age, subjectID, breastfeeding, within month from abx, and collection season. A color scale from 0 to 1.0 indicates importance. Age shows high importance for the second topic. Panel B displays four bar graphs of taxa abundance for each topic. The top graph shows s Bifidobacterium bifidum as most abundant. The second graph shows s Prevotella copri. The third graph shows Bifidobacterium infantis. The fourth graph shows s Escherichia coli. Panel C contains four line graphs of GP component values over age in months. The first graph for age shows a peak around 18 months. The second graph for age times breastfeeding shows exclusive breastfeeding increasing, no breastfeeding remaining low, and partial breastfeeding rising and then decreasing. The third graph for age times within month from abx shows false peaking around 8 months and true declining after an early plateau. The fourth graph for age times collection season shows different age-related trajectories for cool dry winter, pre-monsoon, and rainy monsoon. Panel D shows four strip plots of topic proportions over age in months.

LGTM captured longitudinal trends and topics associated with early feeding in young children from Dhaka, Bangladesh. (a) Heatmap of variance-weighted Sobol’ indices quantifying the contribution of each covariate (columns) to the variation of each topic’s proportion (rows, L=4 ). The bottom row shows the aggregated Sobol’ indices for each covariate across all topics. Topics are sorted by their mean proportion across all samples, indicated by the horizontal bars on the left. (b) Taxonomic composition of the learned topics. For each topic, the bar chart displays the top five most abundant taxa whose proportions exceed 0.01. (c) Latent functions for Topic 1. The learned latent function is decomposed into components. Each subplot shows the effect of a single covariate or an interaction term on the topic’s proportion over age in months. The subject effect is not shown, as it reflects individual differences rather than age-related variation. Shaded areas represent one standard deviation of uncertainty. The Sobol’ index (SI) is displayed above each subplot. For interaction components, the SI of the categorical variable is shown. (d) Strip plots of topic proportions over timepoints. Topic proportions are computed via the encoder. Each point represents a sample, colored according to the legends in the upper subplots. Lines connect the mean topic proportion at each timepoint for each category, illustrating the trends that are modeled by the latent functions in the subplots above.

By further visualizing the latent functions for Topic 1, we observed that breastfeeding status exhibited contrasting temporal interactions with Topic 1, whereas recent antibiotic courses and collection season showed milder effects (Figure 3c,d). These patterns were successfully captured by the corresponding components of the latent function. Topic 1 was more prevalent when the infants were introduced to solid foods, in line with previous findings that Bifidobacterium longum subsp. iuvenis thrived during the transition from exclusive to partial breastfeeding. 52 , 59 During the same period, the abundance of Bifidobacterium longum subsp. infantis decreased while Prevotella copri started to increase, as captured by Topic 2 (Figure G1). Altogether, LGTM captured complex bacterial co-abundance patterns and their associations with age and other covariates while at the same time providing easy-to-access visual representations of these trends.

We next applied our model to the 16S rRNA amplicon sequence data from the integrated DIABIMMUNE cohort of young children in Finland, Estonia and Russian Karelia. In these data, the country of birth accounted for a large portion of the variation for several topics (Figure 4). The genus Bacteroides was more prevalent and abundant in Finnish and Estonian children, as reported previously. 60 On the other hand, LGTM further identified the lack of early Bacteroides in children born by C-section (Figure 4c), which is a well-established effect from numerous studies. 61 , 62 LGTM further captured major trends in the genus Bifidobacterium; Russians had more bifidobacteria in the early months and, on the other hand, breastfeeding tended to increase Bifidobacterium levels, as breast milk provides an energy source primarily for these bacteria.

Figure 4.

A four panel diagram shows a heatmap, bar graphs, and line graphs with scatter plots analyzing microbiome data over time. The four panel diagram shows a heatmap, bar graphs, and line graphs with scatter plots analyzing microbiome data over time. Panel A is a heatmap displaying covariate importance across five topics and seven covariates, with a separate bottom row for aggregated importance. A vertical color bar indicates importance from 0 to 1.0. Horizontal bars on the left show topic proportions from 0 to 0.36. Panel B contains five horizontal bar graphs, each showing taxa abundance from 0 to 1.0 for up to five of the most abundant taxa in each topic. Panel C and Panel D each present six pairs of graphs for Topic 2 and Topic 3, respectively. The upper graph in each pair is a line graph showing GP component value from 0 to 1.0 over age in months from 1 to 37, with shaded uncertainty bands and Sobol indices. The lower graph is a scatter plot of topic proportion from 0 to 1.0 over age in months from 1 to 37. The pairs analyze effects of age, age times csection, age times gender, age times country, age times abx while pregnant, and age times bf ongoing. Trends vary across covariates and topics, with some showing distinct differences between groups like True and False, Female and Male, or EST, FIN, and RUS.

LGTM facilitated deconvolution of microbiome shifts related to complex early life events in the DIABIMMUNE cohort. (a) Heatmap of variance-weighted Sobol’ indices quantifying the contribution of each covariate (columns) to the variation of each topic’s proportion (rows, L=5 ). The bottom row shows the aggregated Sobol’ indices across all topics. Topics are sorted by their mean proportion across all samples, indicated by the horizontal bars on the left. (b) Taxonomic composition of the learned topics. For each topic, the bar chart displays the top five most abundant taxa whose proportions exceed 0.01. (c) Latent functions and topic proportions for Topic 2. Upper panels: each subplot shows the effect of a single covariate or an interaction term on the topic’s proportion over age in months. The subject effect is not shown, as it reflects individual differences rather than age-related variation. Shaded areas represent one standard deviation of uncertainty. The Sobol’ index (SI) is displayed above each subplot. For interaction components, the SI of the categorical variable is shown. Lower panels: strip plots of topic proportions over timepoints. Topic proportions are computed via the encoder. Each point represents a sample, colored according to the legends in the upper panels. (d) Latent functions and topic proportions for Topic 3, with the same visualization scheme as in (c). Legend: csection, cesarean section; EST, Estonia; FIN, Finland; RUS, Russia; abx_while_pregnant, antibiotic use during pregnancy; bf_ongoing, breastfeeding.

We further applied our model to the metagenomic data from the Human Microbiome Project (phase 2). 54 Unlike gut microbiome profiles from young children, time accounted for a relatively small proportion of variation in these IBD-associated microbiome profiles, while inter-subject variation accounted for the largest portion of the variance (Figure 5). This was mirrored with strong heterogeneity of the gut microbiome profiles across subjects. Subjects were classified into three groups based on their disease diagnosis: Crohn’s disease (CD), ulcerative colitis (UC), and controls without inflammatory bowel disease (non-IBD). While the variance contribution of disease diagnosis was moderate, that of dysbiosis state (as reported in Lloyd-Price et al. 54 ) was larger, indicating that LGTM distinguished dysbiotic and non-dysbiotic microbiome profiles. Microbiome features distinctive to dysbiotic microbiome profiles were distributed across Topics 1 and 5. Topic 1 was characterized by species often prevalent and abundant in healthy individuals. For example, Bacteroides uniformis and Alistipes putredinis are often depleted in IBD and their protective roles against IBD have been investigated. 63 , 64 Topic 5 captured species increased in dysbiosis, such as Escherichia coli and Ruminococcus gnavus. There was a weaker association to IBD diagnosis with Topics 1, 2 and 3. Topic 2 was enriched in both UC and CD whereas enrichment of Topic 3 was characteristic of UC. Topics 2 and 3 were characterized by Bacteroides vulgatus and Faecalibacterium prausnitzii, respectively, both of which have been extensively studied in IBD. Overall, while the topics showed large variance across subjects, they were also associated with other covariates. For example, Topic 1 was associated with probiotic intake, and consumption of drinks with artificial sweeteners, dairy and red meat, whereas Topic 6 was associated with having whole grains in diet. Altogether, this demonstrates LGTM’s ability to capture disease-relevant microbiome shifts while jointly modeling diet and other measured metadata.

Figure 5.

A two panel diagram shows a heatmap of covariate importance and six bar graphs of taxa abundance for different topics. The two panel diagram presents data on covariate importance and taxa abundance. Panel A shows a heatmap with six rows representing topics and fourteen columns representing covariates. The covariates are time, subjectID, diagnosis, dysbiosis, diet drinks, yogurt, dairy, probiotic, vegetables, beans, whole grains, red meat, fish, and sweets. A color scale on the right indicates covariate importance from 0 to 1.0. A bar graph on the left shows topic proportions from 0 to 0.30. A bottom row shows aggregated covariate importance. Panel B displays six horizontal bar graphs, one for each topic, showing up to five of the most abundant taxa. The horizontal axis indicates taxa abundance from 0.0 to 1.0. The taxa listed include s Bacteroides uniformis, s Alistipes putredinis, s Parabacteroides distasonis, s Bacteroides caccae, s Parabacteroides merdae, s Bacteroides vulgatus, s Bacteroides ovatus, s Bacteroides thetaiotaomicron, s Bacteroides xylanisolvens, s Bacteroides finegoldii, s Faecalibacterium prausnitzii, s Bacteroides fragilis, s Eubacterium rectale, s Roseburia faecis, s Eubacterium eligens, s Bacteroides stercoris, s Bacteroides dorei, s Roseburia intestinalis, s Escherichia coli, s Veillonella parvula, s Flavonifractor plautii, s Ruminococcus gnavus, s Prevotella copri, s Prevotella sp 885, s Prevotella stercorea, s Butyrivibrio crossotus, and s Prevotella sp AM42 24.

LGTM topics were associated with patient diagnosis, microbial dysbiosis and dietary factors in HMP2 data. (a) Heatmap of variance-weighted Sobol’ indices quantifying the contribution of each covariate (columns) to the variation of each topic’s proportion (rows, L=6 ). The bottom row shows the aggregated Sobol’ indices across all topics. Topics are sorted by their mean proportion across all samples, indicated by the horizontal bars on the left. (b) Taxonomic composition of the learned topics. For each topic, the bar chart displays the top five most abundant taxa whose proportions exceed 0.01.

4. Discussion

We present LGTM, a probabilistic learning framework for modeling longitudinal microbiome data with external covariates, which combines the flexibility of GPs with the interpretability of topic models. LGTM represents the microbiome using interpretable topics, each defined by a small set of co-varying microbial features, typically species. Importantly, topics are learned jointly with external covariates allowing them to capture correlations with host and environmental factors in a data-driven manner. The unified probabilistic framework enables direct comparisons of microbial trajectories across individuals and conditions while accounting for uncertainty, compositionality, and irregular sampling. In contrast to methods that analyze taxa independently, the topic-based structure in LGTM facilitates biological interpretation by linking microbial topics to measured host and environmental covariates. Using multiple datasets, we demonstrated that this allows identifying distinct microbial topics with coherent temporal behavior and association with relevant host covariates, including disease state and dietary changes. Together, these results demonstrate that LGTM provides an interpretable and flexible framework for studying longitudinal gut microbiome dynamics in the presence of complex covariates.

Our primary technical contribution is a deep generative framework that, to our knowledge, is the first to integrate basis function approximation for GPs with topic modeling in an autoencoder architecture. A central feature is interpretable dimensionality reduction. Samples are represented as mixtures of latent factors, which decompose co-varying taxa into structured co-abundance patterns. Additive GPs summarize associations with continuous and categorical covariates in the latent space, while a simplex-constrained linear decoder enhances interpretability by directly linking the latent factors to the original high-dimensional features. The GP components decompose covariate contributions, enabling clearer biological interpretation of covariate associations in longitudinal data. Together, these provide two complementary decompositions of longitudinal microbiome variation, capturing co-abundance-defined microbial topics and covariate contributions to support multi-faceted interpretability.

The inferred topics represent statistical co-abundance patterns rather than direct evidence of ecological guilds, functional groups, or pairwise microbial interactions. When the taxa in a topic are biologically coherent and the topic is associated with relevant covariates, it can suggest a hypothesis about microbial community structure, supported by external biological knowledge or downstream validation. Mechanistic ecological models, such as gLV models, address a different level of analysis by parameterizing growth and interaction coefficients. The topic proportions inferred by LGTM could therefore serve as lower-dimensional inputs for other analyses that combine topic modeling with explicit ecological interaction models.

Several statistical assumptions define the scope of the current model. LGTM is trained on taxonomic profiles represented as relative abundances, and the cross-entropy reconstruction term can be viewed as a multinomial-style working likelihood on the simplex. This preserves compositional structure and avoids CLR/log-ratio preprocessing that requires zero replacement or pseudocounts, but it does not explicitly model sample-specific read depth, overdispersion, or abundance-level zeros. Dirichlet–multinomial, zero-aware logistic-normal, or other count-aware likelihoods are natural extensions when raw count-generative modeling is required. For temporal modeling, the squared exponential kernel is appropriate for gradual longitudinal trends, and perturbation-related metadata can enter the model through covariate-time interactions, but abrupt unrecorded or poorly sampled changepoints may be smoothed over. Other stationary kernels compatible with Hilbert-space basis-function approximations, such as Matérn kernels, could relax this smoothness assumption. When precise perturbation timings are available, event-aligned covariates, such as time since antibiotic exposure or time since dietary change, or input-warped kernels based on stationary kernels would be natural extensions for modeling trajectories relative to the perturbation rather than only over absolute time. 65 Finally, the additive GP structure and Sobol’ indices summarize covariate associations rather than causal effects, so results for correlated metadata variables should be interpreted with care. Practical steps, such as applying general-purpose feature selection methods to select a representative subset of covariates, can be combined with the same modeling framework when correlated metadata are central to the analysis. In future implementations, feature selection could also be incorporated during model fitting through sparsity-inducing penalties or shrinkage priors on covariate-specific GP components.

Selecting the latent dimensionality (i.e., the number of topics) remains an open practical question. 37 We view L primarily as a resolution parameter: smaller values provide a compact summary of major co-abundance structure, whereas larger values can retain more specific or lower-variance patterns when they are relevant for the analysis. The choice of L should therefore be guided by the biological question, downstream interpretation, and sensitivity analysis. In addition, topic models may have identifiability issues because random initialization can affect the detailed composition of topics. In our implementation, NNDSVD initialization provides a useful anchor for the decoder by orienting topics toward dominant taxon-level patterns, improving robustness of the major topics without eliminating the need for biological interpretation.

The neural architecture is extensible and supports several directions for future work. For example, while we consider covariates in the metadata, one could also include response variables (such as clinical outcomes), which could then be predicted using the microbiome profiles or their latent representations. Other data modalities, such as metabolomics, could also be incorporated to enable more comprehensive modeling. At the same time, potential overfitting is mitigated by the low latent dimension and the simplex-constrained linear decoder, which constrains effective model capacity while preserving interpretability. The held-out predictive performance supports this constrained-capacity interpretation. Phylogenetic information could further strengthen biological interpretation, for example through a tree-structured prior or regularization on the topic-taxon matrix, inspired by Dirichlet-tree multinomial models. 66 Functional information could similarly be incorporated by jointly modeling functional profiles from tools such as HUMAnN, MG-RAST, or PICRUSt2 as an auxiliary output. 67-69 A limitation is that, due to the heterogeneity of microbiome and metadata across cohorts, our model currently focuses on analyzing data from one cohort at a time. Generalization across cohorts remains a significant challenge in microbiome studies, and transferable topics would require a shared taxonomic feature space, comparable metadata, and explicit validation that matched topics preserve similar biological interpretation across cohorts. As large-scale integrative microbiome studies expand, the scalability of our approach will become increasingly valuable. Overall, LGTM provides a scalable and interpretable foundation for analyzing longitudinal microbiome data, identifying biological patterns, and generating hypotheses for future experimental validation.

Acknowledgments

We would like to acknowledge the computational resources provided by the Aalto Science-IT. We acknowledge CSC for awarding this project access to the LUMI supercomputer, owned by the EuroHPC Joint Undertaking, hosted by CSC (Finland) and the LUMI consortium. ChatGPT (OpenAI, GPT-5.2) was used for language editing and clarity improvement.

Appendices.

Appendix A. Basis function GP for continuous, categorical and interaction kernels

We follow earlier work to formulate basis function approximation for GPs. 24 , 39 , 40 We use the SE kernel to model continuous covariates, which is approximated as:

K~se(x,x′)=∑m=1Msλmϕm(x)ϕm(x′),

where s(⋅) is the spectral density, λm and ϕm(x) are the m -th eigenvalue and eigenfunction of the Laplace operator. The corresponding GP has the following parametric form:

f(x)≈a⊤ϕ(x),a∼N(𝟎,S),

where ϕ(x)=[ϕ1(x),…,ϕM(x)]⊤ and S=diag(s(λ1),…,s(λM)) . Note that the approximation depends on the kernel hyperparameters. The SE kernel is defined as:

Kse(x,x′∣σ,ℓ)=σ2exp(−|x−x′|22ℓ2),

where σ2 is the variance determining the overall variation of the function and ℓ is the length scale determining how quickly the function values change with distance. Its corresponding spectral density is

sse(ω∣σ,ℓ)=σ2ℓ2πexp(−ℓ2ω22).

We model categorical covariates using a categorical kernel, which is constructed from the eigendecomposition of the kernel matrix. Let x∈{1,…,C} be a categorical covariate with C categories, and let Kca(x,x′)∈RC×C denote the kernel function. A symmetric kernel matrix admits an eigendecomposition and the kernel function can be written as:

Kca(x,x′)=∑c=1Cdcϑc(x)ϑc(x′),

where dc is the c -th eigenvalue and ϑc(x) is the x -th entry of the c -th eigenvector of the corresponding kernel matrix. The corresponding GP then has an exact parametric form:

f(x)=a⊤ϑ(x),a∼N(𝟎,D),

where ϑ(x)=[ϑ1(x),…,ϑC(x)]⊤ and D=diag(d1,…,dC) . In our implementation, we specifically use the diagonal kernel for categorical variables:

Kca(x,x′)={1ifx=x′0otherwise.

To model the joint effects of continuous and categorical covariates, we compute the product of the approximation for the SE kernel and the decomposition of the categorical kernel:

K~(x,x′)=K~se(xc,xc′)Kca(xd,xd′)=∑m=1M ∑c=1Cs(λm)dcϕm(xc)ϕm(xc′)ϑc(xd)ϑc(xd′)=∑b=1Bsbψb(x)ψb(x′),

where x=[xc,xd]⊤ , B=MC , and each sb and ψb represents one of the products in {s(λm)dc} and {ϕm(xc)ϑc(xd)} , respectively. Note that K~se(xc,xc′) depends only on a single continuous variable and Kca(xd,xd′) depends only on a single categorical variable. The corresponding GP with this interaction kernel has the following parametric form:

f(x)≈a⊤ψ(x),a∼N(𝟎,diag(s)),

where ψ(x)=[ψ1(x),…,ψB(x)]⊤ and s=[s1,…,sB]⊤ .

Appendix B. KL divergence for the basis function GP approximation

The second regularization term in our training objective in Equation (5), KLGP , is derived in earlier work, 24 which we describe here. Let A,σ,ℓ denote the collection of parameters A(r),σ(r),ℓ(r) for all components r=1,…,R . These parameters have the following prior and variational distributions:

σ(r)∼Lognormal(0,1)ℓ(r)∼Lognormal(0,1)S(r)(σ(r),ℓ(r))=diag({sse(λm∣σ(r),ℓ(r))}m=1M)A∣σ,ℓ∼∏r=1R∏l=1LN(al(r)∣𝟎,S(r)(σ(r),ℓ(r)))q(σ)=∏r=1RLognormal(σ(r)∣μσq(r),(σσq(r))2)q(ℓ)=∏r=1RLognormal(ℓ(r)∣μℓq(r),(σℓq(r))2)q(A)=∏r=1R∏l=1L∏b=1B(r)N(alb(r)∣μlb(r),(σlb(r))2).

During inference, we sample σ and ℓ from the corresponding distributions. These values are then substituted into the spectral density function to obtain an estimate, denoted as s^ . Using a single Monte Carlo sample and the mean-field approximation, the KL divergence is computed as:

KLGP=Eq(σ)q(ℓ)[KL(q(A)∥p(A∣σ,ℓ))]+KL(q(σ)∥p(σ))+KL(q(ℓ)∥p(ℓ))≈∑r=1R∑l=1L∑b=1B(r)[(σlb(r))2+(μlb(r))22s^b(r)−12−logσlb(r)s^b(r)]+∑r=1R[(σσq(r))2+(μσq(r))2−12−logσσq(r)]+∑r=1R[(σℓq(r))2+(μℓq(r))2−12−logσℓq(r)]

Appendix C. Additional details of hyperparameters

C.1. Latent dimension selection via profile likelihood

Let eL be an evaluation metric, such as the average reconstruction loss from cross-validation, given latent dimension L . The heuristic assumes that for L<L∗ , where L∗ is the (unknown) correct number of topics, the metric eL will decrease rapidly, whereas for L>L∗ , the marginal gains become smaller as the model is sufficiently complex. This method partitions the evaluation values {eL} into two groups at a changepoint L and assumes a simple model: ek∼N(μ1,σ2) if k<L and ek∼N(μ2,σ2) if k≥L . Maximum likelihood estimates are computed for the parameters, and the profile log-likelihood ℓ(L) is obtained:

μ1(L)=1L−1∑k=1L−1ek,μ2(L)=1Lmax−L+1∑k=LLmaxek,σ2(L)=1Lmax(∑k=1L−1(ek−μ1(L))2+∑k=LLmax(ek−μ2(L))2),ℓ(L)=∑k=1L−1logN(ek∣μ1(L),σ2(L))+∑k=LLmaxlogN(ek∣μ2(L),σ2(L)).

We use L^=argmaxLℓ(L) as a suggested topic number. For computational efficiency, this can also be applied to the reconstruction loss on the whole data, varying L while holding other hyperparameters at their default values.

C.2. Sensitivity analysis of latent dimensionality

To assess how the inferred microbial structures change with the number of topics, we aligned LGTM topic models trained with L=2,…,20 using topic alignment. 37 We used the optimal transport alignment option, which aligns topics across adjacent values of L using topic-taxon compositions and the relative masses of topics. Figure C1 provides a visual summary of whether dominant topics persist across resolutions or split into more specific components as L increases.

Figure C1.

A three panel diagram shows topic flow across L values 2 to 20 for Dhaka, DIABIMMUNE, and HMP2 datasets. The three panel diagram arranged vertically shows topic flow across L values 2 to 20 for Dhaka, DIABIMMUNE, and HMP2 datasets. Each panel displays a network of stacked rectangles representing topics, with ribbons connecting topics between adjacent L values. The horizontal axis is labeled with L values from 2 to 20. Panel A, labeled Dhaka, shows a relatively stable flow with a few dominant topics branching into smaller ones as L increases. Panel B, labeled DIABIMMUNE, displays a more complex branching pattern with several topics splitting and merging across the range of L values. Panel C, labeled HMP2, exhibits the most intricate flow with numerous topics branching and merging, particularly at higher L values. In all panels, the height of the rectangles varies, indicating different topic proportions, and the width of the ribbons varies, representing the alignment mass between topics. The colors of the rectangles and ribbons are anchored at the topics from the main analyses, with additional high mass paths shown using remaining colors and minor paths in grey.

Robustness of the inferred topics with respect to the number of topics. Each panel shows LGTM models trained with L = 2, . . . , 20 topics for one dataset. Each rectangle represents one topic, and its height is proportional to the mean topic proportion across samples. Ribbons connect topics in adjacent values of L; ribbon widths indicate the optimal transport alignment mass between topic-taxon profiles. Colors are anchored at the topics from the main analyses. Additional high-mass paths are shown using the remaining colors, whereas minor paths are shown in gray. The alignment demonstrates that dominant microbial structures are robust across a range of L, while larger values of L mainly refine broader topics into smaller components.

C.3. Other hyperparameters

We used M=5 basis functions for the SE kernel approximation. The coefficient for the KL term of GP was set to 0.001. We set the default learning rate to 0.05, batch size to 64, and hidden dimension of MLP to 64.

Appendix D. Additional details of datasets and preprocessing

D.1. Dhaka 52

This dataset consists of metagenomic shotgun sequencing data from fecal samples of Bangladeshi children in the Microbiota and Health Study, sampled during the first two years of life. Samples collected during diarrheal episodes were excluded from our analysis. The covariates used include age, subject ID, breastfeeding status, recent antibiotic use (within one month) and collection season.

D.2. DIABIMMUNE 53

This dataset consists of 16S rRNA gene amplicon sequencing data from the DIABIMMUNE study. DIABIMMUNE observed Finnish, Estonian and Russian children for three years from birth by monthly stool sampling. For our analysis, abundances were merged to the genus level, and any unclassified taxa were grouped into a single taxon. The covariates used include age, subject ID, mode of delivery, gender, country of birth, antibiotic courses during pregnancy, and breastfeeding status.

D.3. HMP2 54

This dataset is from the Inflammatory Bowel Disease Multi’omics Database (IBDMDB), part of the Integrative Human Microbiome Project, a study tracking participants with and without IBD for one year. We used the metagenomic shotgun sequencing data from stool samples. The week number of sample collection since recruitment was used as the timepoint. The dataset features a rich set of metadata, including subject ID, IBD diagnosis, dysbiosis, and dietary information. Dietary recalls were binarized according to whether a food item was consumed in the past week.

Appendix E. Additional details of prediction tasks

E.1. Methods for comparison

E.1.1. Mean

The mean imputation method predicts missing values by calculating the mean of all observed values for each feature. We also compare against a subject-wise mean imputation, which calculates the mean of observed values within each subject.

E.1.2. Linear interpolation

This method predicts missing values by linearly interpolating between the nearest observed values before and after the missing timepoint for each feature within each subject. Missing values at the beginning or end of a series are backfilled or forward-filled with the nearest observed value.

E.1.3. BRITS 13

BRITS is an RNN-based model that learns to impute missing values within a bidirectional recurrent dynamical system.

E.1.4. SAITS 15

SAITS is a Transformer-based model that imputes missing values using a weighted combination of two diagonally-masked self-attention blocks. We used a configuration of two layers with four attention heads each.

E.1.5. DGBFGP 24

DGBFGP is a deep generative model utilizing a Bayesian basis function approximation for its GP that eliminates the need for amortized variational inference. We used an MLP with one hidden layer for the decoder.

E.2. Experimental details

For imputation, we split the data into training, validation, and test sets by samples with a ratio of 70%, 10%, and 20%, respectively. We performed five random splits such that each sample appeared in the test set of exactly one split, ensuring that all samples were evaluated. The training set contains samples from all subjects, which is necessary when modeling subject ID as a covariate, as the model must see each subject during training. For forecasting, we split subjects into validation (10%) and test (20%) sets. For subjects in the training set, all their timepoints were used; for subjects in the validation and test sets, only the first half of their timepoints were provided as input for training, while the second half was used for evaluation. We performed five random splits such that each subject appeared in the test set of one split.

Continuous covariates were standardized to have zero mean and unit variance for DGBFGP and our model. We implemented and trained all deep learning models in PyTorch. 70 The implementations in PyPOTS 71 were used for BRITS and SAITS. Cross-entropy loss was used for all models. Adam algorithm 45 was used for optimization. For each model, hyperparameters (e.g., learning rate, batch size, hidden dimension) were tuned using grid search guided by performance on the validation set. For each split, we used five random seeds for model initialization. We ran parallel hyperparameter optimization with Optuna, 72 using multi-processing on a computing cluster to accelerate the search. We used a single thread for each process to ensure reproducibility. All models were trained for a maximum of 100 epochs.

E.3. Experiment with CLR transform

The inputs were CLR-transformed relative abundances, replacing zeros with minimum non-zero value multiplied by 0.65 and multiplicatively adjusting the other values to ensure the compositions still add up to one. Models were trained with MSE loss, and hyperparameters were tuned based on validation MSE in the transformed space. The inverse CLR transform (i.e., softmax) was applied to the model outputs to obtain predictions in the original compositional space. As shown in Table E1, the likelihood is worse than training directly in the compositional space (Table 2), validating our methodological choice.

Table E1.

Imputation with CLR transform. NLL ( ↓ ): negative log-likelihood. MSE ( ↓ ): ×10−3 .

  Dhaka
DIABIMMUNE
  NLL MSE NLL MSE
Mean 4.12 0.262 3.47 1.80
Mean (subjectwise) 5.03 0.417 3.41 1.90
Linear interpolation 4.62 0.284 2.97 1.15
BRITS 3.83 0.216 3.15 1.40
SAITS 4.16 0.263 3.33 1.57
DGBFGP 3.92 0.228 3.11 1.64

Appendix F. Additional details of topic discovery task

F.1. Methods for comparison

F.1.1. NMF 26

NMF finds two non-negative matrices whose product approximates the relative abundance matrix. Generalized KL divergence was used as the objective function to be minimized. The model was trained until convergence. The resulting matrices were normalized by dividing each row by its sum to obtain sample-topic and topic-taxon matrices.

F.1.2. LDA 25

LDA is a generative probabilistic model using Dirichlet priors for sample-topic and topic-taxon distributions. It uses the variational Bayes method for parameter estimation. We trained the model for 100 epochs.

F.1.3. VAE-LDA 27

VAE-LDA applies autoencoding variational Bayes to LDA. It uses Laplace approximation to approximate the Dirichlet prior for the sample-topic distributions. We used the same architecture for the encoder and decoder as in our model.

F.2. Metrics

F.2.1. Likelihood

We assume a multinomial distribution for the abundance data with the same total count K for all samples. Let k=Ky be the observed counts and y^ be the estimated relative abundances. The log-likelihood of the model is computed as:

logp(k∣y^)=∑d=1Dkdlogy^d+logK!∏d=1Dkd!=K∑d=1Dydlogy^d+const,

where kd , yd , and y^d are the d -th elements of k , y , and y^ , respectively. This is equivalent to the cross-entropy between the observed and estimated relative abundances up to a constant.

F.2.2. Jensen–Shannon divergence

The JS divergence is a symmetric version of KL divergence that measures the similarity between two probability distributions. For two topics βi and βj , it is defined as:

JSD(βi,βj)=12KLβi∥βi+βj2+12KLβj∥βi+βj2.

We used the base 2 logarithm, so it ranges from 0 to 1.

F.2.3. Bray–Curtis dissimilarity

Bray–Curtis dissimilarity is a measure of dissimilarity used in ecology to measure the difference in taxa composition between two samples. For two topics βi and βj , it is defined as:

BCD(βi,βj)=∑d=1D|βi,d−βj,d|∑d=1D(βi,d+βj,d),

where βi,d and βj,d are the d -th elements of βi and βj , respectively.

F.2.4. Topic matrix distance

We define the distance between two topic matrices B(r) and B(s) from runs r and s as the minimized average distance between matched topics. Let π be a permutation of {1,…,L} representing the bipartite matching between topics in the two matrices. The topic matrix distance is computed as:

TD(B(r),B(s))=minπ1L∑l=1Ldβl(r),βπ(l)(s),

where d(⋅,⋅) is a distance metric. We used the JS distance (the square root of the JS divergence), which is a distance metric that satisfies the triangle inequality.

F.3. Experimental details

We performed 5-fold cross-validation on samples to assess the held-out likelihood, using the same splitting strategy as in the imputation task. For the held-out likelihood calculation, the topic matrix (decoder) was held fixed, and the topic proportions for the test samples were optimized. To evaluate topic quality, we trained the models on all available data using five different random seeds. For NMF and LDA, implementations from scikit-learn 73 were used. We quantified the diversity of topics discovered using pairwise dissimilarity, with minimum pairwise dissimilarity to measure the worst-case redundancy and average pairwise dissimilarity to measure overall diversity. Our model consistently outperforms baselines over a wide range of topic numbers using different metrics (JS divergence and Bray–Curtis dissimilarity).

F.4. Computational efficiency

Despite integrating sophisticated modules, our approach remains computationally efficient due to the basis function approximation for GPs. We further evaluated scalability using synthetic relative-abundance datasets by varying one dimension at a time while holding the others fixed. Runtime was measured as the total training time for 100 epochs on a single CPU thread, with L=5 topics. Experiments were run on CPU with AMD EPYC 7763 processors. The benchmark varied the number of samples, taxa, subjects, and GP components. Runtime increased approximately linearly with the number of samples (log-log slope 1.02), showed only modest dependence on the number of taxa and subjects in the tested range (slopes 0.09 and 0.04), and increased with the number of GP components (slope 0.64; Figure F1). The sample-size dependence reflects the number of mini-batch updates per epoch and can be adjusted in practice by increasing the batch size. These results indicate that the main practical limit of the current implementation is the number and size of covariate components, since each component has its own basis-function expansion.

Figure F1.

Four panel diagram shows training time trends on log scales for samples, taxa, subjects, and GP components variables. The four panel diagram arranged in two rows of two shows training time trends on logarithmic scales. All panels have a vertical axis labeled Training time in seconds with a tick at 10 squared. Panel A shows a line graph with a steep linear increase from 1000 to 16000 samples N. Panel B displays a line graph with a slight increase from 128 to 2048 taxa D. Panel C contains a line graph with a nearly flat trend from 50 to 800 subjects P. Panel D presents a line graph with a steady linear increase from 2 to 32 GP components R.

Scalability benchmark on synthetic data. Points show independent runs and lines show medians. One dimension was varied at a time while the other settings were fixed. Training time was measured for 100 epochs on a single CPU thread.

Appendix G. Additional visualizations

G.1. Dhaka dataset

Figure G1.

A diagram arranged in four topic blocks. A diagram arranged in four topic blocks. Row 1 displays Topic 1 with a bar graph of species proportions, four line graphs showing GP component values and four strip plots showing topic proportions against age in months. The bar graph shows high proportions for Bifidobacterium bifidum and Bifidobacterium longum. Line graphs show GP component values increasing with age for exclusive breastfeeding and remaining low for no breastfeeding, while topic proportions generally increase. Row 2 displays Topic 2 with a bar graph and four line graphs and four strip plots. The bar graph shows high proportions for Prevotella copri. Line graphs show GP component values increasing with age for all breastfeeding types, with no breastfeeding showing the highest values, and topic proportions also increasing. Row 3 displays Topic 3 with a bar graph and four line graphs and four strip plots. The bar graph shows a high proportion for Bifidobacterium infantis. Line graphs show GP component values decreasing with age for exclusive breastfeeding and remaining low for no breastfeeding, while topic proportions decrease. Row 4 displays Topic 4 with a bar graph and four line graphs and four strip plots. The bar graph shows high proportions for Bacteroides fragilis and Escherichia coli.

Visualization of topics, latent functions, and topic proportions of samples in Dhaka dataset (L = 4).

Funding Statement

This study was supported by a seed fund awarded to AA, HL and TV, and the Research Council of Finland (decision #359135). AA, AF and YM are affiliated to Leuven.AI and received funding from the Flemish Government (AI Research Program). XY received funding from the Finnish Doctoral Program Network in Artificial Intelligence, AI-DOC (VN/3137/2024-OKM-6), University of Helsinki Seed Funding and Vlaamse regering.

Disclosure of potential conflicts of interest

No potential conflicts of interest were disclosed.

Data availability statement

The LGTM source code is available at https://github.com/yuanx749/lgtm. An archived version of the code is available on Zenodo at https://doi.org/10.5281/zenodo.20588704. Data from the DIABIMMUNE and Dhaka studies are available at NCBI Sequence Read Archive under BioProject IDs PRJNA497734 and PRJNA806984, respectively. DIABIMMUNE data can also be accessed through the DIABIMMUNE microbiome website at https://diabimmune.broadinstitute.org/. Microbiome profiles of the HMP2 study are publicly available via the IBDMDB at https://ibdmdb.org/.

References

  • 1. Schmidt TS, Raes J, Bork P. The human gut microbiome: from association to modulation. Cell. 2018;172:1198–1215. doi: 10.1016/j.cell.2018.02.044. [DOI] [PubMed] [Google Scholar]
  • 2. Stewart CJ, Ajami NJ, O’Brien JL, Hutchinson DS, Smith DP, Wong MC, Ross MC, Lloyd RE, Doddapaneni H, Metcalf GA, et al. Temporal development of the gut microbiome in early childhood from the teddy study. Nature. 2018;562:583–588. doi: 10.1038/s41586-018-0617-x. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3. Peng H, Andreu-Sanchez S, Ruiz-Moreno AJ, Fernández-Pato A, Wu J, Gacesa R, Zhernakova A, Wang D, Fu J. Longitudinal gut microbiota tracking reveals the dynamics of horizontal gene transfer. Nat Commun. 2025;16:11543. doi: 10.1038/s41467-025-66612-z. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4. David LA, Materna AC, Friedman J, Campos-Baptista MI, Blackburn MC, Perrotta A, Erdman SE, Alm EJ. Host lifestyle affects human microbiota on daily timescales. Genome Biol. 2014;15:R89. doi: 10.1186/gb-2014-15-7-r89. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5. Shenhav L, Furman O, Briscoe L, Thompson M, Silverman JD, Mizrahi I, Halperin E. Modeling the temporal dynamics of the gut microbial community in adults and infants. PLoS Comput Biol. 2019;15:e1006960. doi: 10.1371/journal.pcbi.1006960. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6. Grieneisen L, Blekhman R, Archie E. How longitudinal data can contribute to our understanding of host genetic effects on the gut microbiome. Gut Microbes. 2023;15:2178797. doi: 10.1080/19490976.2023.2178797. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7. Zhou X, Shen X, Johnson JS, Spakowicz DJ, Agnello M, Zhou W, Avina M, Honkala A, Chleilat F, Chen SJ, et al. Longitudinal profiling of the microbiome at four body sites reveals core stability and individualized dynamics during health and disease. Cell Host Microbe. 2024;32:506–526. doi: 10.1016/j.chom.2024.02.012. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8. Mallick H, Rahnavard A, McIver LJ, Ma S, Zhang Y, Nguyen LH, Tickle TL, Weingart G, Ren B, Schwager EH, et al. Multivariable association discovery in population-scale meta-omics studies. PLoS Comput Biol. 2021;17:e1009442. doi: 10.1371/journal.pcbi.1009442. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9. Bucci V, Tzen B, Li N, Simmons M, Tanoue T, Bogart E, Deng L, Yeliseyev V, Delaney ML, Liu Q, et al. Mdsine: microbial dynamical systems inference engine for microbiome time-series analyses. Genome Biol. 2016;17:121. doi: 10.1186/s13059-016-0980-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10. Joseph TA, Shenhav L, Xavier JB, Halperin E, Pe’er I. Compositional lotka-volterra describes microbial dynamics in the simplex. PLoS Comput Biol. 2020;16:e1007917. doi: 10.1371/journal.pcbi.1007917. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11. Äijö T, Müller CL, Bonneau R. Temporal probabilistic modeling of bacterial compositions derived from 16s rrna sequencing. Bioinformatics. 2018;34:372–380. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12. Cheng L, Ramchandran S, Vatanen T, Lietzén N, Lahesmaa R, Vehtari A, Lähdesmäki H. An additive Gaussian process regression model for interpretable non-parametric analysis of longitudinal data. Nat Commun. 2019;10:1798. doi: 10.1038/s41467-019-09785-8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13. Cao W, Wang D, Li J, Zhou H, Li L, Li Y. Brits: bidirectional recurrent imputation for time series. Adv Neural Inf Process Syst. 2018;31. [Google Scholar]
  • 14. Luo Y, Cai X, Zhang Y, Xu J, Yuan X. Multivariate time series imputation with generative adversarial networks. Adv Neural Inf Process Syst. 2018;31. [Google Scholar]
  • 15. Du W, Côté D, Liu Y. Saits: self-attention-based imputation for time series. Expert Syst Appl. 2023;219:119619. doi: 10.1016/j.eswa.2023.119619. [DOI] [Google Scholar]
  • 16. Choi JM, Ji M, Watson LT, Zhang L. Deepmicrogen: a generative adversarial network-based method for longitudinal microbiome data imputation. Bioinformatics. 2023;39:btad286. doi: 10.1093/bioinformatics/btad286. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17. De Brouwer E, Simm J, Arany A, Moreau Y. Gru-ode-Bayes: continuous modeling of sporadically-observed time series. Adv Neural Inf Process Syst. 2019;32. [Google Scholar]
  • 18. Qu Y, Lyu R, Wang D, Dai Y, Turcan A, Yu S, Xie J, Roach J, Butler C, Yap PT, et al. Deep-learning-based interpolation of longitudinal microbiome data powers biologically informative discovery. bioRxiv. 2025;2:2025. [Google Scholar]
  • 19. Kingma DP, Welling M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114. 2013.
  • 20. Sohn K, Lee H, Yan X. Learning structured output representation using deep conditional generative models. Adv Neural Inf Process Syst. 2015;28. [Google Scholar]
  • 21. Casale FP, Dalca A, Saglietti L, Listgarten J, Fusi N. Gaussian process prior variational autoencoders. Adv Neural Inf Process Syst. 2018;31. [Google Scholar]
  • 22. Fortuin V, Baranchuk D, Rätsch G, Mandt S. Gp-vae: deep probabilistic time series imputation. International conference on artificial intelligence and statistics. PMLR; 2020; p. 1651–1661. [Google Scholar]
  • 23. Ramchandran S, Tikhonov G, Kujanpää K, Koskinen M, Lähdesmäki H. Longitudinal variational autoencoder. International Conference on Artificial Intelligence and Statistics. PMLR; 2021; p. 3898–3906. [Google Scholar]
  • 24. Balık MY, Sinelnikov M, Ong P, Lähdesmäki H. Bayesian Basis Function Approximation for Scalable Gaussian Process Priors in Deep Generative Models. Forty-second International Conference on Machine Learning. PMLR; 2025; p. 2673–2696.
  • 25. Blei DM, Ng AY, Jordan MI. Latent dirichlet allocation. J Mach Learn Res. 2003;3:993–1022. [Google Scholar]
  • 26. Lee D, Seung HS. Algorithms for non-negative matrix factorization. Adv Neural Inf Process Syst. 2000;13. [Google Scholar]
  • 27. Srivastava A, Sutton C. Autoencoding variational inference for topic models. Int Conf Learn Repres. 2017.. [Google Scholar]
  • 28. Miao Y, Grefenstette E, Blunsom P. Discovering discrete latent topics with neural variational inference. ICML. PMLR; 2017; p. 2410–2419. [Google Scholar]
  • 29. Dieng AB, Ruiz FJ, Blei DM. Topic modeling in embedding spaces. Trans Assoc Comput Linguist. 2020;8:439–453. doi: 10.1162/tacl_a_00325. [DOI] [Google Scholar]
  • 30. Zhao Y, Cai H, Zhang Z, Tang J, Li Y. Learning interpretable cellular and gene signature embeddings from single-cell transcriptomic data. Nat Commun. 2021;12:5261. doi: 10.1038/s41467-021-25534-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 31. Lynch AW, Theodoris CV, Long HW, Brown M, Liu XS, Meyer CA. MIRA: joint regulatory modeling of multimodal expression and chromatin accessibility in single cells. Nat Methods. 2022;19:1097–1108. doi: 10.1038/s41592-022-01595-z. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32. Hosoda S, Nishijima S, Fukunaga T, Hattori M, Hamada M. Revealing the microbial assemblage structure in the human gut microbiome using latent dirichlet allocation. Microbiome. 2020;8:95. doi: 10.1186/s40168-020-00864-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 33. Frioux C, Ansorge R, Özkurt E, Nedjad CG, Fritscher J, Quince C, Waszak SM, Hildebrand F. Enterosignatures define common bacterial guilds in the human gut microbiome. Cell Host Microbe. 2023;31:1111–1125. [DOI] [PubMed] [Google Scholar]
  • 34. Jeganathan P, Holmes SP. A statistical perspective on the challenges in molecular microbial biology. J Agric Biol Environ Stat. 2021;26:131–160. doi: 10.1007/s13253-021-00447-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35. Sankaran K, Holmes SP. Latent variable modeling for the microbiome. Biostatistics. 2019;20:599–614. doi: 10.1093/biostatistics/kxy018. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36. Fukuyama J, Rumker L, Sankaran K, Jeganathan P, Dethlefsen L, Relman DA, Holmes SP. Multidomain analyses of a longitudinal human microbiome intestinal cleanout perturbation experiment. PLoS Comput Biol. 2017;13:e1005706. doi: 10.1371/journal.pcbi.1005706. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 37. Fukuyama J, Sankaran K, Symul L. Multiscale analysis of count data through topic alignment. Biostatistics. 2023;24:1045–1065. doi: 10.1093/biostatistics/kxac018. [DOI] [PubMed] [Google Scholar]
  • 38. Rasmussen CE, Williams CKI. Gaussian processes for machine learning. 2006. Cambridge, MA: MIT press. [Google Scholar]
  • 39. Solin A, Särkkä S. Hilbert space methods for reduced-rank Gaussian process regression. Stat Comput. 2020;30:419–446. doi: 10.1007/s11222-019-09886-w. [DOI] [Google Scholar]
  • 40. Timonen J, Lähdesmäki H. Scalable mixed-domain Gaussian process modeling and model reduction for longitudinal data. BayAn. 2025. 1–28. doi: 10.1214/25-BA1539. [DOI] [Google Scholar]
  • 41. Truong DT, Franzosa EA, Tickle TL, Scholz M, Weingart G, Pasolli E, Tett A, Huttenhower C, Segata N. Metaphlan2 for enhanced metagenomic taxonomic profiling. Nat Methods. 2015;12:902–903. doi: 10.1038/nmeth.3589. [DOI] [PubMed] [Google Scholar]
  • 42. Nishijima S, Stankevic E, Aasmets O, Schmidt TS, Nagata N, Keller MI, Ferretti P, Juel HB, Fullam A, Robbani SM, et al. Fecal microbial load is a major determinant of gut microbiome variation and a confounder for disease associations. Cell. 2025;188:222–236. doi: 10.1016/j.cell.2024.10.022. [DOI] [PubMed] [Google Scholar]
  • 43. Alvarez MA, Rosasco L, Lawrence ND. Kernels for vector-valued functions: a review. Found Trends® Mach Learn. 2012;4:195–266. doi: 10.1561/2200000036. [DOI] [Google Scholar]
  • 44. Boutsidis C, Gallopoulos E. Svd based initialization: a head start for nonnegative matrix factorization. PatRe. 2008;41:1350–1362. doi: 10.1016/j.patcog.2007.09.010. [DOI] [Google Scholar]
  • 45. Kingma DP, Ba J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. 2014.
  • 46. Yan J, Chuai G, Qi T, Shao F, Zhou C, Zhu C, Yang J, Yu Y, Shi C, Kang N, et al. Metatopics: an integration tool to analyze microbial community profile by topic model. BMC Genomics. 2017;18:962. doi: 10.1186/s12864-016-3257-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 47. Deveaud R, SanJuan E, Bellot P. Accurate and effective latent concept modeling for ad hoc information retrieval. Document Numérique. 2014;17:61–84. doi: 10.3166/dn.17.1.61-84. [DOI] [Google Scholar]
  • 48. Zhu M, Ghodsi A. Automatic dimensionality selection from the scree plot via the use of profile likelihood. Computat Stat Data Anal. 2006;51:918–930. doi: 10.1016/j.csda.2005.09.010. [DOI] [Google Scholar]
  • 49. Sobol IM. Global sensitivity indices for nonlinear mathematical models and their Monte Carlo estimates. Math Comput Simul. 2001;55:271–280. doi: 10.1016/S0378-4754(00)00270-6. [DOI] [Google Scholar]
  • 50. Saltelli A, Annoni P, Azzini I, Campolongo F, Ratto M, Tarantola S. Variance based sensitivity analysis of model output. Design and estimator for the total sensitivity index. Comput Phys Commun. 2010;181:259–270. doi: 10.1016/j.cpc.2009.09.018. [DOI] [Google Scholar]
  • 51. Gamboa F, Janon A, Klein T, Lagnoux A. Sensitivity indices for multivariate outputs. Comptes Rendus Math. 2013;351:307–310. doi: 10.1016/j.crma.2013.04.016. [DOI] [Google Scholar]
  • 52. Vatanen T, Ang QY, Siegwald L, Sarker SA, Le Roy CI, Duboux S, Delannoy-Bruno O, Ngom-Bru C, Boulangé CL, Stražar M, et al. A distinct clade of bifidobacterium longum in the gut of Bangladeshi children thrives during weaning. Cell. 2022;185:4280–4297. doi: 10.1016/j.cell.2022.10.011. [DOI] [PubMed] [Google Scholar]
  • 53. Vatanen T, Plichta DR, Somani J, Münch PC, Arthur TD, Hall AB, Rudolf S, Oakeley EJ, Ke X, Young RA, et al. Genomic variation and strain-specific functional adaptation in the human gut microbiome during early life. Nat Microbiol. 2019;4:470–479. doi: 10.1038/s41564-018-0321-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 54. Lloyd-Price J, Arze C, Ananthakrishnan AN, Schirmer M, Avila-Pacheco J, Poon TW, Andrews E, Ajami NJ, Bonham KS, Brislawn CJ, et al. Multi-omics of the gut microbial ecosystem in inflammatory bowel diseases. Nature. 2019;569:655–662. doi: 10.1038/s41586-019-1237-9. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 55. Pawlowsky-Glahn V, Egozcue JJ, Tolosana-Delgado R. Modeling and analysis of compositional data. John Wiley & Sons; 2015.. [Google Scholar]
  • 56. Martín-Fernández JA, Barceló-Vidal C, Pawlowsky-Glahn V. Dealing with zeros and missing values in compositional data sets using nonparametric imputation. Math Geol. 2003;35:253–278. doi: 10.1023/A:1023866030544. [DOI] [Google Scholar]
  • 57. Endres DM, Schindelin JE. A new metric for probability distributions. ITIT. 2003;49:1858–1860. doi: 10.1109/TIT.2003.813506. [DOI] [Google Scholar]
  • 58. Crouse DF. On implementing 2D rectangular assignment algorithms. IEEE Trans Aerosp Electron Syst. 2016;52:1679–1696. doi: 10.1109/TAES.2016.140952. [DOI] [Google Scholar]
  • 59. Modesto M, Ngom-Bru C, Scarafile D, Bruttin A, Pruvost S, Sarker SA, Ahmed T, Sakwinska O, Mattarelli P, Duboux S. Bifidobacterium longum subsp. iuvenis subsp. nov., a novel subspecies isolated from the faeces of weaning infants. Int J Syst Evol Microbiol. 2023;73:006013. doi: 10.1099/ijsem.0.006013. [DOI] [PubMed] [Google Scholar]
  • 60. Vatanen T, Kostic AD, d’Hennezel E, Siljander H, Franzosa EA, Yassour M, Kolde R, Vlamakis H, Arthur TD, Hämäläinen AM, et al. Variation in microbiome LPS immunogenicity contributes to autoimmunity in humans. Cell. 2016;165:842–853. doi: 10.1016/j.cell.2016.04.007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 61. Shao Y, Forster SC, Tsaliki E, Vervier K, Strang A, Simpson N, Kumar N, Stares MD, Rodger A, Brocklehurst P, et al. Stunted microbiota and opportunistic pathogen colonization in caesarean-section birth. Nature. 2019;574:117–121. doi: 10.1038/s41586-019-1560-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 62. Nunez H, Nieto PA, Mars RA, Ghavami M, Sew Hoy C, Sukhum K. Early life gut microbiome and its impact on childhood health and chronic conditions. Gut Microbes. 2025;17:2463567. doi: 10.1080/19490976.2025.2463567. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 63. Yan Y, Lei Y, Qu Y, Fan Z, Zhang T, Xu Y, Du Q, Brugger D, Chen Y, Zhang K, et al. Bacteroides uniformis-induced perturbations in colonic microbiota and bile acid levels inhibit TH17 differentiation and ameliorate colitis developments. NPJ Biofilms Microb. 2023;9:56. doi: 10.1038/s41522-023-00420-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 64. Ishikawa D, Zhang X, Nomura K, Shibuya T, Hojo M, Yamashita M, Koizumi S, Yamazaki F, Iwamoto S, Saito M, et al. Anti-inflammatory effects of bacteroidota strains derived from outstanding donors of fecal microbiota transplantation for the treatment of ulcerative colitis. Inflamm Bowel Dis. 2024;30:2136–2145. doi: 10.1093/ibd/izae080. [DOI] [PubMed] [Google Scholar]
  • 65. Timonen J, Mannerström H, Vehtari A, Lähdesmäki H. Lgpr: an interpretable non-parametric method for inferring covariate effects from longitudinal data. Bioinformatics. 2021;37:1860–1867. doi: 10.1093/bioinformatics/btab021. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 66. Wang T, Zhao H. A dirichlet-tree multinomial regression model for associating dietary nutrients with gut microorganisms. Biometrics. 2017;73:792–801. doi: 10.1111/biom.12654. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 67. Beghini F, McIver LJ, Blanco-Míguez A, Dubois L, Asnicar F, Maharjan S, Mailyan A, Manghi P, Scholz M, Thomas AM, et al. Integrating taxonomic, functional, and strain-level profiling of diverse microbial communities with biobakery 3. elife. 2021;10:e65088. doi: 10.7554/eLife.65088. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 68. Meyer F, Paarmann D, D’Souza M, Olson R, Glass EM, Kubal M, Paczian T, Rodriguez A, Stevens R, Wilke A, et al. The metagenomics rast server–a public resource for the automatic phylogenetic and functional analysis of metagenomes. BMC Bioinf. 2008;9:386. doi: 10.1186/1471-2105-9-386. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 69. Douglas GM, Maffei VJ, Zaneveld JR, Yurgel SN, Brown JR, Taylor CM, Huttenhower C, Langille MG. Picrust2 for prediction of metagenome functions. Nat Biotechnol. 2020;38:685–688. doi: 10.1038/s41587-020-0548-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 70. Paszke A, Gross S, Massa F, Lerer A, Bradbury J, Chanan G, Killeen T, Lin Z, Gimelshein N, Antiga L, et al. Pytorch: an imperative style, high-performance deep learning library. Adv Neural Inf Process Syst. 2019;32. [Google Scholar]
  • 71. Du W. 2023. Pypots: a python toolbox for data mining on partially-observed time series, arXiv preprint. arXiv:2305.18811.
  • 72. Akiba T, Sano S, Yanase T, Ohta T, Koyama M. Optuna: a next-generation hyperparameter optimization framework. In Proceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining. 2019. p. 2623–2631. [Google Scholar]
  • 73. Pedregosa F, Varoquaux G, Gramfort A, Michel V, Thirion B, Grisel O, Blondel M, Prettenhofer P, Weiss R, Dubourg V, et al. Scikit-learn: machine learning in python. J Mach Learn Res. 2011;12:2825–2830. [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

The LGTM source code is available at https://github.com/yuanx749/lgtm. An archived version of the code is available on Zenodo at https://doi.org/10.5281/zenodo.20588704. Data from the DIABIMMUNE and Dhaka studies are available at NCBI Sequence Read Archive under BioProject IDs PRJNA497734 and PRJNA806984, respectively. DIABIMMUNE data can also be accessed through the DIABIMMUNE microbiome website at https://diabimmune.broadinstitute.org/. Microbiome profiles of the HMP2 study are publicly available via the IBDMDB at https://ibdmdb.org/.


Articles from Gut Microbes are provided here courtesy of Taylor & Francis

RESOURCES