DOI: 10.1098/rsif.2026.0240 ISSN: 1742-5662

From data-driven differential equations to mechanistic forecasting with machine learning

Amit K. Chakraborty, Hao Wang, Pouria Ramazi

Abstract

The equations of complex dynamical systems may not be identified by expert knowledge, especially if the underlying mechanisms are unknown. Data-driven discovery methods address this challenge by inferring governing equations from time-series data using a library of functions constructed from the measured variables. However, these methods typically assume time-invariant coefficients, which limits their ability to capture evolving system dynamics. To overcome this limitation, we allow some of the parameters to vary over time, learn their temporal evolution directly from data and infer a system of equations that incorporates both constant and time-varying parameters. We then transform this framework into a forecasting model by predicting the time-varying parameters and substituting these predictions into the learned equations. The model is validated on simulated susceptible–infected–recovered and consumer–resource systems, as well as on real-world greenhouse gas concentration and cyanobacteria cell count datasets. By dynamically adapting to temporal shifts, our proposed model achieved a mean absolute error below 3% for learning a time series and below 6% for forecasting up to a month ahead. We additionally compare forecasting performance against convolutional neural network–long short-term memory and gradient boosting machine, and show that our model outperforms these methods across most datasets. Our findings demonstrate that integrating time-varying parameters into data-driven discovery of differential equations improves both modelling accuracy and forecasting performance.

More from our Archive