Time series prediction for changes in microbial community composition
The ability to differentiate significant changes in microbial community composition from normal fluctuations is crucial for understanding microbial dynamics in human and environmental ecosystems. Here, we apply 16S rRNA gene sequencing and time-series analysis to model bacterial abundance trajectories in human gut and wastewater treatment plant (WWTP) microbiomes. We evaluated various model architectures, including Long Short-Term Memory (LSTM), Gated Recurrent Unit (GRU), Random Forest, and Vector Autoregressive Moving Average (VARMA), on datasets from two human studies and five WWTPs.  Our results showed that LSTM models consistently outperformed other architectures in predicting bacterial abundances and detecting outliers, as assessed by metrics such as Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and Normalized Root Mean Squared Error (NRMSE). By establishing prediction intervals for each genus, we could identify significant changes that may indicate shifts in community states. Our findings highlight the potential of machine learning monitoring microbial communities under conditions ranging from hospital environment to urban wastewater. This can offer insights into how microbial communities respond to host factors, nutrient inputs, or environmental stressors.