Probabilistic Numerical Differential Equation solvers via Bayesian filtering and smoothing

nathanaelbosch/ProbNumDiffEq.jl

Folders and files

NameName
Last commit message
Last commit date

1,014 Commits

ProbNumDiffEq.jl

ProbNumDiffEq.jl provides probabilistic numerical ODE solvers to the DifferentialEquations.jl ecosystem. The implemented ODE filters solve differential equations via Bayesian filtering and smoothing. The filters compute not just a single point estimate of the true solution, but a posterior distribution that contains an estimate of its numerical approximation error.

For a short intro video, check out the ProbNumDiffEq.jl poster presentation at JuliaCon2021.

Installation

Run Julia, enter ] to bring up Julia's package manager, and add the ProbNumDiffEq.jl package:

julia> ]


Example: Solving the FitzHugh-Nagumo ODE

using ProbNumDiffEq

# ODE definition as in DifferentialEquations.jl
function f(du, u, p, t)
a, b, c = p
du[1] = c * (u[1] - u[1]^3 / 3 + u[2])
du[2] = -(1 / c) * (u[1] - a - b * u[2])
end
u0 = [-1.0, 1.0]
tspan = (0.0, 20.0)
p = (0.2, 0.2, 3.0)
prob = ODEProblem(f, u0, tspan, p)

# Solve the ODE with a probabilistic numerical solver: EK1
sol = solve(prob, EK1())

# Plot the solution with Plots.jl
using Plots
plot(sol, color=["#CB3C33" "#389826" "#9558B2"])

In probabilistic numerics, the solution also contains error estimates - it just happens that they are too small to be visible in the plot above. But we can just plot them directly:

using Statistics
stds = std.(sol.pu)
plot(sol.t, hcat(stds...)', color=["#CB3C33" "#389826" "#9558B2"]
label=["std(u1(t))" "std(u2(t))"], xlabel="t", ylabel="standard-deviation")

Related packages

• probdiffeq: Fast and feature-rich filtering-based probabilistic ODE solvers in JAX.
• ProbNum: Probabilistic numerics in Python. It has not only probabilistic ODE solvers, but also probabilistic linear solvers, Bayesian quadrature, and many filtering and smoothing implementations.
• Fenrir.jl: Parameter-inference in ODEs with probabilistic ODE solvers. This package builds on ProbNumDiffEq.jl to provide a negative marginal log-likelihood function, which can then be used with an optimizer or with MCMC for parameter inference.

Probabilistic Numerical Differential Equation solvers via Bayesian filtering and smoothing

v0.15.0 Latest
Feb 12, 2024

Packages 0

No packages published