Loading
Saul Diaz Infante Velasco
This is a live streamed presentation. You will automatically follow the presenter and see the slide they're currently on.
Seminario de Ciencia de Datos, UAM Iztapalapa
Junio 18,2026,
Saúl Diaz Infante Velasco saul.diazinfante@unison.mxPINNs y SNODEs aplicados al crecimiento logístico en la producción de Kéfir.
Modeling Transition: From ODE to SDE
Classical Numerical Approaches
Scientific Machine Learning (SciML)
Neural ODEs and SDEs
A journey through the integration of physical models and machine learning for stochastic bioprocesses.
Application: Bioprocess Case Study
Two of the main approaches:
drift
diffusion
drift
diffusion
[Sec. 1.2, Thm 1.2.2]
Construction
Classical simulation packages, statistical SDE toolboxes, differentiable solvers, and compiled/HPC workflows
| Package | Ecosystem | Solver focus | Best use in an SDE exposition |
|---|---|---|---|
| sde Stefano M. Iacus classic | R | Euler, Milstein, KPS, Milstein2, conditional density, Ozaki, Shoji, and exact-algorithm simulation. | Natural reference package for simulation and inference of diffusion processes in the statistical SDE tradition. [R1] [R2] |
| YUIMA Simulation and inference for stochastic processes inference | R | SDEs driven by Wiener processes, Lévy processes, fractional Brownian motion, plus CARMA, COGARCH, and point-process models. | Best for statistically oriented SDE workflows: model specification, simulation, quasi-likelihood inference, hypothesis testing, change-point analysis, and high-frequency data methods. [R10] |
| Sim.DiffProc Simulation of diffusion processes | R | Euler-Maruyama, Milstein, predictor-corrector, Itô-Taylor, Heun, and stochastic Runge-Kutta schemes. | Good for a methods-oriented slide because the package makes the numerical hierarchy of strong and weak schemes explicit. [R3] |
MATLAB sde
Financial Toolbox
Picchini SDE Toolbox
|
MATLAB | Vector SDE models, drift/diffusion objects, Brownian risk sources, and Euler-type sample-path simulation. | MATLAB analogue for finance-oriented SDE simulation; the Picchini toolbox is useful as a historical simulation/inference reference. [R4] [R5] |
| sdeint NumPy/SciPy-style interface pedagogical | Python | Itô and Stratonovich integration: Euler-Maruyama, Heun, SRI2/SRS2, and Kloeden-Platen implicit methods. | Useful Python baseline for teaching classical schemes before moving to neural or differentiable SDE solvers. [R6] |
| torchsde Differentiable SDE solvers research | PyTorch | GPU-compatible SDE solvers, stochastic adjoint sensitivity, and neural SDE training workflows. | Best positioned when the exposition includes neural SDEs, backpropagation through stochastic dynamics, or learned drift/diffusion. [R7] [R8] |
| StochasticDiffEq.jl DifferentialEquations.jl ecosystem broadest | Julia | EM, Heun, SOSRI/SOSRA, weak-order methods, stiff solvers, commutative-noise methods, jump-diffusion, GPU ensembles. | Strong general-purpose open-source SDE solver ecosystem; ideal when solver breadth, adaptivity, callbacks, and performance matter. [R9] |
| XMDS2 C++ code generation HPC / SPDE | C/C++ | High-level model specification with generated, parallelized C++ code for stochastic systems. | Best presented as the compiled/HPC route rather than as a direct one-to-one analogue of Iacus’s scalar diffusion package. [R11] |
Suggested reading order: statistical SDE packages → MATLAB/Python baselines → differentiable solvers → Julia/HPC ecosystems.
Classical SDE simulation packages and MATLAB/Python baselines
Differentiable SDE solvers, SciML ecosystems, YUIMA, HPC, and numerical SDE foundations
Numerical solvers, neural SDEs, GPU acceleration, and model-code-generation tools
| Software | Stack | Numerical focus | SciML role and references |
|---|---|---|---|
| StochasticDiffEq.jl DifferentialEquations.jl ecosystem | Julia | EM, Heun, SOSRI/SOSRA, weak-order, stiff, and jump-diffusion methods. | Strong general-purpose SDE baseline for SciML; integrates with callbacks, AD workflows, events, and GPU ensembles. [R1] [R2] |
| torchsde Differentiable SDE solvers archived | PyTorch | Neural SDEs, adjoint sensitivities, Brownian reconstruction, reversible Heun. | Natural reference for neural SDE experiments and gradient-based learning of stochastic dynamics. [R3] [R4] |
| Diffrax JAX-native solver suite | JAX | Unified ODE/SDE/CDE solvers, adjoints, PyTrees, and vmappable workflows. | Good fit for differentiable simulation, neural differential equations, and hardware-accelerated JAX pipelines. [R5] |
| Boost.odeint Compiled numerical backend ODE core | C++ | Generic ODE steppers; useful for custom low-level stochastic time stepping. | Valuable when compiled control, C++ integration, or custom kernels matter; not an SDE-specialized SciML stack. [R6] |
| PyRates Model-code generation | Python | High-level model specification with backend code generation. | Useful for biological dynamical systems and reproducible model pipelines; better viewed as code generation than as a direct SDE solver. [R7] |
Click software names for documentation or repositories. Click reference tags for the corresponding paper or source.
Cybenko, G. Approximation by superpositions of a sigmoidal function. Math. Control, Signals Syst. 2, 303–314 (1989).
Becouse each solution to the differential equation is obtained by solving an optimization problem.
This framework has strong overtones of collocation methods or finite element methods. This is a popular line of work.
Zubov, K. et al. NeuralPDE: Automating Physics-Informed Neural Networks (PINNs) with Error Approximations. arXiv (2021) doi:10.48550/arxiv.2107.09443.
Let
$$\frac{dy_{\theta}}{dt} = f(t, y_{\theta}(t)), \quad t \in (0, T],$$
with a known initial condition:
$$y_{\theta}(0) = y_0.$$
So, we want an NN \( y_{\theta}\) with parameters \(\theta\) that satisfies the above equation.
For tuning a given NN architecture, we define the Loss function
$$ L(\theta) = L_{\text{residual}} + \lambda L_{\text{IC}}.$$
We choose a set of collocation points,
\( \{t_i\}_{i=1}^{N}\), spread across the interval (0, T]. At each point, we compute the residual:
$$\text{Residual}(t_i) = \frac{dy_\theta}{dt}(t_i) - f(t_i, y_\theta(t_i)).$$
$$L_{\text{IC}} = |y_\theta(0) - y_0|^2$$
Consider a general scalar SDE,
$$dX_t = f(X_t) dt + g(X_t) dW_t$$
Fokker-Planck equation (Kolmogorov forward):
$$\frac{\partial p}{\partial t} = -\frac{\partial}{\partial x} [f(x) p(x,t)] + \frac{1}{2} \frac{\partial^2}{\partial x^2} [g^2(x) p(x,t)]$$
| Feature | Classic Methods | PINNs |
|---|---|---|
| Theory | Strong | Developing |
| Interpretability | High | Moderate |
| High Dimension | Hard | Better |
| Data Integration | Limited | Natural |
| Stability Guarantees | Yes | Often unclear |
A neural ordinary differential equation is a differential equation in which a neural network parameterizes the vector field.
The central idea now is to use a differential equation solver as part of a learned, differentiable computational graph (the sort of graph ubiquitous in deep learning).
Chen et al. Neural Ordinary Differential Equations. in Advances in Neural Information Processing Systems (eds. Bengio, S. et al.) vol. 31 (2018).
Minimizing the loss function can be achieved using gradient-based methods, then we need an effective approach to computing the gradient.
The adjoint equation from optimal control theory is one of the major tools.
The first derivation of the adjoint equation goes back to the idea of using Lagrangian formalism, where λ, the variable in the adjoint equation, plays a similar role as a Lagrange multiplier
Results that solving the adjoint equation backward in time provides the gradient of the loss.
\(y_0 \in \mathbb{R}^d\) and \( \theta \in \mathbb{R}^m \).
be continuous in \(t\), uniformly Lipschitz in \(y\), and continuously differentiable in \(y\).
Let
be the unique solution to
\[y(0) = y_0, \qquad \frac{d y}{d t}(t) = f_\theta(t, y(t))\]
Let\(L = L(y(T))\) be function of the terminal value \(y(T)\).
Then \(\frac{d L}{d y(t)} = a_y(t)\) and \(\frac{d L}{d \theta} = a_\theta(0)\),
where
\(a_y : [0, T] \to \mathbb{R}^d\)
solve
In sequence modeling and time-series analysis, the loss function is typically is a function of the state at multiple discrete time snapshots
The optimization problem then becomes:
$$\left( \frac{\partial L}{\partial \theta} \right)_k = \sum_{i=1}^{N} \frac{\partial L}{\partial z(t_i)} \frac{\partial z(t_i)}{\partial \theta_k}$$
$$\frac{\partial z(t_i)}{\partial \theta_k} = \int_{t_0}^{t_N} \frac{\partial z(t)}{\partial \theta_k} \delta(t - t_i) dt$$
$$\left( \frac{\partial L}{\partial \theta} \right)_k = \int_{t_0}^{t_N} \frac{\partial z(t)}{\partial \theta_k} \left( \sum_{i=1}^{N} \frac{\partial L}{\partial z(t_i)} \delta(t - t_i) \right) dt$$
$$\left( \frac{\partial L}{\partial \theta} \right)_k = \left\langle \sum_{i=1}^{N} \frac{\partial L}{\partial z(t_i)} \delta(t - t_i), \frac{\partial z(t)}{\partial \theta_k} \right\rangle_{X^*, X}$$
By differentiating both sides of the restriction equation respect to \(\theta\)
Suppouse \(\lambda\) = \(\lambda(t)\) s.t.
Integrating by parts
We simulate the SDE forward, obtain \(Z_T\) and compute the lossZTZ_T, compute a loss
L=ℓ(ZT),\mathcal L = \ell(Z_T)
However, the backward pass must use the same Brownian path as the forward pass.
Naively reversing an Itô SDE is not valid. The clean reverse-time construction uses the Stratonovich form:
For a fixed Brownian sample path, the Stratonovich SDE defines a stochastic flow
The inverse stochastic flow reconstructs the earlier state from the terminal state:
Fitting the data of water kefir production
Dr. José Carlos Rodríguez Figueroa
The right-hand side \(f_\theta\) is a fully connected neural network with input
\( (\tau,z) \in \mathbb R^2\), two hidden layers, 32 hidden units per layer, and
hyperbolic tangent activation:
Let \(\{\xi_m\}_{m=1}^M\) be \(M=128\) uniformly spaced collocation points in \([0,1]\).
The deterministic PINN
| Model | RMSE ↓ | R2 ↑ | AIC ↓ | BIC ↓ | p | Main reading |
|---|---|---|---|---|---|---|
| Classical logistic ODE | 1.4291 | 0.9826 | 165.84 | 171.26 | 2 | Most parsimonious |
| Neural ODE | 1.0281 | 0.9910 | 2502.20 | 4644.90 | 1185 | Best in-sample fit |
| Neural SDE | 2.0312 | 0.9649 | 4933.48 | 9217.08 | 2370 | Uncertainty model |
| Deterministic logistic PINN | 2.8167 | 0.9326 | 4644.90 | 8641.24 | 2211 | Physics-constrained fit |
| Stochastic logistic PINN drift | 2.8469 | 0.9311 | 4647.87 | 8646.01 | 2212 | Logistic drift + noise estimate |
| Stochastic logistic SDE mean | 3.2324 | 0.9112 | 4659.30 | 8657.44 | 2212 | Mean of fitted stochastic process |
| Stochastic-models | ||
|---|---|---|
| Model | 90% coverage ↑ | Mean width ↓ |
| Neural SDE | 0.9333 | 7.3887 |
| Stochastic logistic SDE | 0.8222 | 9.4517 |
| Estimated logistic PINN parameters | |||
|---|---|---|---|
| Model | r | K | σ |
| Deterministic logistic PINN | 0.035062 | 52.3350 | — |
| Stochastic logistic PINN/SDE | 0.036806 | 52.2809 | 0.017245 |
1.Baltazar-Larios, F., Delgado-Vences, F. & Ornelas, A. Parameter estimation and model selection for stochastic differential equations for biological growth. Environ. Ecol. Stat. 32, 195–227 (2025).
2.Baltazar-Larios, F., Delgado-Vences, F., Diaz-Infante, S. & Gomez, E. L. Statistical inference for a stochastic generalized logistic differential equation. Commun. Nonlinear Sci. Numer. Simul. 108261 (2024) doi:10.1016/j.cnsns.2024.108261.
3.Baltazar-Larios, F., Delgado-Vences, F. & Diaz-Infante, S. Maximum likelihood estimation for a stochastic SEIR system with a COVID-19 application. Int J Comput Math 1–23 (2022) doi:10.1080/00207160.2022.2148316.
Gracias!