patrick-kidger / patrick-kidger/diffrax

Calculating First-order Sensitivity using diffrax

Open
#511 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.