SciML / SciMLSensitivity.jl

A component of the DiffEq ecosystem for enabling sensitivity analysis for scientific machine learning (SciML). Optimize-then-discretize, discretize-then-optimize, adjoint methods, and more for ODEs, SDEs, DDEs, DAEs, etc.
https://docs.sciml.ai/SciMLSensitivity/stable/
Other
324 stars 69 forks source link

Need new ways to specify parameters for adjoint sensitivity analysis #80

Open huanglangwen opened 5 years ago

huanglangwen commented 5 years ago

I think it is better to pass in f_p, g_p and g_u explicitly for adjoint sensitivity analysis instead of relying on the parameter p in f(du,u,p,t) and dg(out,u,p,t). Because p can be used for other purposes like caching and storing configurations which are not for differentiation.

ChrisRackauckas commented 5 years ago

I think we definitely want to make it so that people can just use the same function. However, there does need to be a nicer way to mix non-parameters with parameters. Maybe an array type.

huanglangwen commented 5 years ago

But someone may prefer their own f_p g_p and g_u compared to AD-generated one for reasons like analytical solutions, foreign language calls, etc. For the non-parameters, perhaps we need a new optional argument for f?

ChrisRackauckas commented 5 years ago

Which function is missing? You don't need to rely on AD?

huanglangwen commented 5 years ago

For example, f_p is needed when doing back-integration in adjoint sensitivity. I can't find anyplace to specify them.

ChrisRackauckas commented 5 years ago

http://docs.juliadiffeq.org/latest/features/performance_overloads.html#ODEFunction-1

huanglangwen commented 5 years ago

Oh, I didn't notice that. How about g_u and g_p because adjoint_sensitivities only got dg?

ChrisRackauckas commented 5 years ago

For discrete adjoints we only need dg. For continuous adjoints we only need g and dg.

huanglangwen commented 5 years ago

Sorry, I can't get your point. How does the adjoint sensitivity equation go to your conclusion that only dg and g are needed?

ChrisRackauckas commented 5 years ago

dg=g_u. For everything but continuous adjoints where g is dependent on p, this is sufficient. We could use a PR to add g_p to the integrand for continuous adjoints, right now that's just not supported.

huanglangwen commented 5 years ago

Thank you.