NeuralPDE.jl icon indicating copy to clipboard operation
NeuralPDE.jl copied to clipboard

Migrate functionality to HighDimPDE.jl

Open ChrisRackauckas opened this issue 2 years ago • 10 comments

ChrisRackauckas avatar May 13 '22 12:05 ChrisRackauckas

The migration of NNPDENS and the associated test file is addressed in the specific issue https://github.com/SciML/HighDimPDE.jl/issues/30.

vboussange avatar May 21 '22 10:05 vboussange

Work in progress on branch https://github.com/SciML/HighDimPDE.jl/tree/NeuralPDE_integration.

Thanks to @ashutosh-b-b, the integration is almost completed and partially works. A major change is that now in HighDimPDE.jl, only one algorithm, DeepBSDE, replaces the former NNPDENS and NNPDEHAN from NeuralPDE.jl. The latter were basically the same algorithms, except that NNPDENS was used to call a solve function that would allow the use of SDE solvers from DifferentialEquations.jl to solve the reformulated stochastic problem. What happens now is that if an sdealg is provided in the solve function, then a different solve function which formulates the SDE problem is called (see : https://github.com/SciML/HighDimPDE.jl/blob/a83198b733f94865824f7d6dfa29188077ccebd5/src/DeepBSDE.jl#L72 ).

What still needs to be done:

  • [x] Clean up the tests, located in test/DeepBSDE_Han.jl and test/DeepBSDE_Han.jl. Style should be similar to e.g. test/DeepSplitting.jl.
  • [ ] Fix the tests that are not working (marked by a #TODO comment).
  • [x] Add a page on the documentation under solver algorithms, documenting DeepBSDE.
  • [x] Migrate the tutorials listed above.

vboussange avatar Jun 10 '22 13:06 vboussange

@ashutosh-b-b you had a PR around this? What's left here?

ChrisRackauckas avatar Jun 21 '22 20:06 ChrisRackauckas

Its merged. HighDimPDE#32, I guess mostly the documentation is left there.

ashutosh-b-b avatar Jun 22 '22 09:06 ashutosh-b-b

@ChrisRackauckas,@ashutosh-b-b, the PR is merged, but on the branch https://github.com/SciML/HighDimPDE.jl/tree/NeuralPDE_integration and not on the main branch, as stated above.

@ashutosh-b-b, Could you take look at the test files DeepBSDE_Han.jl and DeepBSDE.jl, and fix the tests with annotated #TODO? On my side, I will complete the documentation, and migrate the tutorials.

vboussange avatar Jun 23 '22 07:06 vboussange

@ChrisRackauckas @vboussange the problem with some of the tests is ambiguity regarding methods on Tracked variables. For example: MethodError: vcat(::TrackedArray{…,Vector{Float32}}, ::Vector{Tracker.TrackedReal{Float32}}) is ambiguous

is what we get for DeepBSDE - Nonlinear Black-Scholes Equation with Default Risk

and

MethodError: no method matching Float32(::Tracker.TrackedReal{Float32}) for DeepBSDE - Black-Scholes-Barenblatt equation

ashutosh-b-b avatar Jun 30 '22 09:06 ashutosh-b-b

If you end up with Array{TrackedReal} you'll take quite a performance hit. Are you using any mutation that would trigger this?

ChrisRackauckas avatar Jun 30 '22 11:06 ChrisRackauckas

Yeap, its here. and here

ashutosh-b-b avatar Jun 30 '22 11:06 ashutosh-b-b

That's not mutation, but would still trigger it. Maybe do Tracker.collect(vcat(σ(X,_p,t),_σᵀ∇u))?

ChrisRackauckas avatar Jun 30 '22 11:06 ChrisRackauckas

@ChrisRackauckas @vboussange the problem with some of the tests is ambiguity regarding methods on Tracked variables. For example: MethodError: vcat(::TrackedArray{…,Vector{Float32}}, ::Vector{Tracker.TrackedReal{Float32}}) is ambiguous

is what we get for DeepBSDE - Nonlinear Black-Scholes Equation with Default Risk

and

MethodError: no method matching Float32(::Tracker.TrackedReal{Float32}) for DeepBSDE - Black-Scholes-Barenblatt equation

@ashutosh-b-b @ChrisRackauckas , where are we now with this? Would be nice to finally merge all of this work and make a release, since NeuralPDE.jl does not provide anymore the algorithms. Why do we use Tracker here? Wouldn't Zygote be more appropriate?

vboussange avatar Jul 18 '22 07:07 vboussange