The DeepBSDE algorithm
Problems Supported:
HighDimPDE.DeepBSDE — TypeDeepBSDE(u0,σᵀ∇u;opt=Flux.Optimise.Adam(0.1))DeepBSDE algorithm, from J. Han, A. Jentzen and Weinan E.
Arguments
u0: a Flux.jlChainwith a d-dimensional input and a 1-dimensional output for the solytion guess.σᵀ∇u: a Flux.jlChainfor the BSDE value guess.opt: the optimization algorithm to be used to optimize the neural networks. Defaults toFlux.Optimise.Adam(0.1).
Example
Black-Scholes-Barenblatt equation
d = 30 # number of dimensions
x0 = repeat([1.0f0, 0.5f0], div(d,2))
tspan = (0.0f0,1.0f0)
dt = 0.2
m = 30 # number of trajectories (batch size)
r = 0.05f0
sigma = 0.4f0
f(X,u,σᵀ∇u,p,t) = r * (u - sum(X.*σᵀ∇u))
g(X) = sum(X.^2)
μ_f(X,p,t) = zero(X) #Vector d x 1
σ_f(X,p,t) = Diagonal(sigma*X) #Matrix d x d
prob = PIDEProblem(μ_f, σ_f, x0, tspan, g, f)
hls = 10 + d #hidden layer size
opt = Flux.Optimise.Adam(0.001)
u0 = Flux.Chain(Dense(d,hls,relu),
Dense(hls,hls,relu),
Dense(hls,1))
σᵀ∇u = Flux.Chain(Dense(d+1,hls,relu),
Dense(hls,hls,relu),
Dense(hls,hls,relu),
Dense(hls,d))
pdealg = DeepBSDE(u0, σᵀ∇u, opt=opt)
solve(prob,
pdealg,
EM(),
verbose=true,
maxiters=150,
trajectories=m,
sdealg=StochasticDiffEq.,
dt=dt,
pabstol = 1f-6)CommonSolve.solve — Methodsolve(
prob::ParabolicPDEProblem,
pdealg::DeepBSDE,
sdealg;
verbose,
maxiters,
trajectories,
dt,
pabstol,
save_everystep,
limits,
ensemblealg,
trajectories_upper,
trajectories_lower,
maxiters_limits,
kwargs...
) -> Any
Returns a PIDESolution object.
Arguments
sdealg: a SDE solver from DifferentialEquations.jl. If not provided, the plain vanilla DeepBSDE method will be applied. If provided, the SDE associated with the PDE problem will be solved relying on methods from DifferentialEquations.jl, using Ensemble solves viasdealg. Check the availablesdealgon the DifferentialEquations.jl doc.limits: iftrue, upper and lower limits will be calculated, based on Deep Primal-Dual algorithm for BSDEs.maxiters: The number of training epochs. Defaults to300trajectories: The number of trajectories simulated for training. Defaults to100- Extra keyword arguments passed to
solvewill be further passed to the SDE solver.
CommonSolve.solve — Methodsolve(
prob::ParabolicPDEProblem,
alg::DeepBSDE;
dt,
abstol,
verbose,
maxiters,
save_everystep,
trajectories,
ensemblealg,
limits,
trajectories_upper,
trajectories_lower,
maxiters_limits
)
Returns a PIDESolution object.
Arguments:
maxiters: The number of training epochs. Defaults to300trajectories: The number of trajectories simulated for training. Defaults to100
To use SDE Algorithms use DeepBSDE
The general idea 💡
The DeepBSDE algorithm is similar in essence to the DeepSplitting algorithm, with the difference that it uses two neural networks to approximate both the the solution and its gradient.
References
- Han, J., Jentzen, A., E, W., Solving high-dimensional partial differential equations using deep learning. arXiv (2018)