SciML / DiffEqNoiseProcess.jl

A library of noise processes for stochastic systems like stochastic differential equations (SDEs) and other systems that are present in scientific machine learning (SciML)
https://docs.sciml.ai/DiffEqNoiseProcess/stable/
Other
63 stars 29 forks source link

add `cur_time` as a guess to `NoiseGrid` to speed up search for time point #141

Closed frankschae closed 1 year ago

frankschae commented 1 year ago

Improves the timing of NG by roughly 10x for the example in https://github.com/SciML/DiffEqNoiseProcess.jl/issues/140.

dt = 0.001

W = WienerProcess!(0.0, rand(2))
prob = NoiseProblem(W, (0.0, 1000.0))
sol = @btime solve(prob; dt=dt)

NG = NoiseGrid((sol.t), sol.u)
_prob = NoiseProblem(NG, (0.0, 1000.0))
_sol = @btime solve(_prob; dt=dt)

@test _sol.u ≈ sol.u

#  87.323 ms (1000095 allocations: 95.86 MiB)
#  56.537 ms (1000034 allocations: 91.55 MiB)

I thought initially that the idea could also be applied to NoiseWrapper but since NoiseWrapper uses the interpolate! function from the source noise process, e.g.

https://github.com/SciML/DiffEqNoiseProcess.jl/blob/0b4f6976f4905ee4cc4cc6b5cc5e6db3ddc3c4a0/src/noise_interfaces/noise_process_interface.jl#L338

it seems a bit less nice to keep track of a cur_time.

ChrisRackauckas commented 1 year ago

Tests seem to fail when the number of noise terms is sufficiently low.

frankschae commented 1 year ago

The SciMLSensitivity error is the Zygote Buffer regression we reported.

Should I update the name from DiffEqSensitivity to SciMLSensitivity in https://github.com/SciML/DiffEqNoiseProcess.jl/blob/master/.github/workflows/Downstream.yml#L22-L24 ?