Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update note on sensitivity analysis for hybrid DEs #613

Merged
merged 1 commit into from
Aug 27, 2021

Conversation

frankschae
Copy link
Member

#612 .

Use BacksolveAdjoint if
the event terminates the time evolution and several states are saved.

That one is very technical...I'm not sure if we want that in here. If you terminate the integration but save the time points, the ts range in InterpolatingAdjoint and QuadratureAdjoint will (likely) be wrong. This is like using a saveat which doesn't fit to the time span...Thus a wrong gradient ..

the continuous adjoint sensitivities do not support multiple events per time point.

Just a bookkeeping issue.. This can be solved but not done yet (at least no tests).

@ChrisRackauckas
Copy link
Member

That one is very technical...I'm not sure if we want that in here. If you terminate the integration but save the time points, the ts range in InterpolatingAdjoint and QuadratureAdjoint will (likely) be wrong. This is like using a saveat which doesn't fit to the time span...Thus a wrong gradient ..

Oh interesting. Is this because of the save at the terminating point?

@ChrisRackauckas ChrisRackauckas merged commit 4bcfc23 into SciML:master Aug 27, 2021
@frankschae
Copy link
Member Author

It happens here:
https://github.com/SciML/DiffEqSensitivity.jl/blob/a6fff921278bf8f14b9f2a3bc451245a72f963bc/src/concrete_solve.jl#L128

Without events, the issue is that when you choose a saveat which doesn't match the time span, you'll loose the endtime:

julia> collect(0.:2.3:10.)
5-element Vector{Float64}:
 0.0
 2.3
 4.6
 6.9
 9.2

Regarding terminating events. Suppose you had tspan=(0,10) with saveat=1.0 (which works) but then you terminate earlier. The range still goes until 10 (because it checks in prob). This results in loss function gradients that are off, i.e., applied at the wrong times.

@frankschae frankschae deleted the bb_docs branch August 27, 2021 20:46
@ChrisRackauckas
Copy link
Member

ahh, thanks. Yeah that is worth handling.

@ChrisRackauckas
Copy link
Member

Is there an issue on this?

@frankschae
Copy link
Member Author

No, it doesn't have an issue yet. I only mentioned it briefly in SciML/SciMLSensitivity.jl#474 .

@ChrisRackauckas
Copy link
Member

Alright, please document it. It doesn't sound too hard to fix though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants