patrick-kidger / patrick-kidger/diffrax
Calculating First-order Sensitivity using diffrax
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 189
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 1
Description
Hi Patrick
I am trying to calculate the first order sensitivity w.r.t. to all the three kinetic parameters for the Robertson Equations using diffrax. I am using the stiff ODE example provided here.
As far as I understand, the only change I have to make is that I have to provide an option to calculate adjoints, so my diffeqsolve looks like the following
sol = diffrax.diffeqsolve(
terms,
solver,
t0,
t1,
dt0,
y0,
saveat=saveat,
stepsize_controller=stepsize_controller,
adoints = diffrax.RecursiveCheckpointAdjoint(checkpoints=None)
)
The code runs without any errors but I am not able to extract the sensitivities, and sol.ys provides values for the species, but not their sensitivities. I am trying to compare the results with the sensitivities provided by the SUNDIALS CVODES solver, see their results here.
Any help would be highly appreciated!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the stiff ODE example and the diffeqsolve call, especially RecursiveCheckpointAdjoint and sol.ys. Determine how first-order sensitivities with respect to the three kinetic parameters are expected to be obtained, then verify the result against the linked CVODES Robertson-equation output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100