AMICI icon indicating copy to clipboard operation
AMICI copied to clipboard

Adjoint event

Open paulstapor opened this issue 2 years ago • 11 comments

paulstapor avatar Aug 05 '21 11:08 paulstapor

Codecov Report

Merging #1539 (3d0d582) into develop (ee1f445) will decrease coverage by 4.59%. The diff coverage is 64.86%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1539      +/-   ##
===========================================
- Coverage    78.75%   74.16%   -4.60%     
===========================================
  Files           69       25      -44     
  Lines        10732     3549    -7183     
===========================================
- Hits          8452     2632    -5820     
+ Misses        2280      917    -1363     
Flag Coverage Δ
cpp ?
petab 66.44% <35.13%> (-0.27%) :arrow_down:
python ?
sbmlsuite 87.17% <55.88%> (-0.47%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/amici/import_utils.py 47.69% <0.00%> (-40.01%) :arrow_down:
python/amici/ode_export.py 88.56% <70.58%> (-5.04%) :arrow_down:
python/amici/pandas.py 11.62% <0.00%> (-86.63%) :arrow_down:
python/amici/testing.py 0.00% <0.00%> (-50.00%) :arrow_down:
python/amici/pysb_import.py 57.03% <0.00%> (-36.83%) :arrow_down:
python/amici/numpy.py 65.21% <0.00%> (-17.40%) :arrow_down:
python/amici/__init__.py 76.08% <0.00%> (-16.31%) :arrow_down:
python/amici/setuptools.py 50.00% <0.00%> (-7.70%) :arrow_down:
python/amici/parameter_mapping.py 69.56% <0.00%> (-6.09%) :arrow_down:
... and 48 more

codecov[bot] avatar Aug 05 '21 11:08 codecov[bot]

Okay, this seems to be indeed the last status of my work on adjoints with events. Sorry it took me so long to actually double-check it. In principle, the implemented algorithm seems to work fine for multiple test models, but it is - for some reason that I failed to understand - inexact, i.e., gradients are off by a little. This problem only occurred for the Leonhardt test model (purely parameter dependent event with state update). However, this little (in the range of a few percent) being off markedly affected the performance of parameter estimation, as I checked in some (by now) deleted file.

I don't really know what to do with this. The work done here enables adjoint computations for a couple of models with events and heaviside. However, it seems to have a bug for certain types of models with events. Possible reasons might be:

  • an error in the implementation
  • a problem with interpolation of the forward solution (which is discontinuous), or, as a result, with the right hand side, or dfdp

paulstapor avatar Feb 10 '22 19:02 paulstapor

Thanks for the update @paulstapor

dweindl avatar Feb 10 '22 21:02 dweindl

Okay, this seems to be indeed the last status of my work on adjoints with events. Sorry it took me so long to actually double-check it. In principle, the implemented algorithm seems to work fine for multiple test models, but it is - for some reason that I failed to understand - inexact, i.e., gradients are off by a little. This problem only occurred for the Leonhardt test model (purely parameter dependent event with state update). However, this little (in the range of a few percent) being off markedly affected the performance of parameter estimation, as I checked in some (by now) deleted file.

I don't really know what to do with this. The work done here enables adjoint computations for a couple of models with events and heaviside. However, it seems to have a bug for certain types of models with events. Possible reasons might be:

  • an error in the implementation
  • a problem with interpolation of the forward solution (which is discontinuous), or, as a result, with the right hand side, or dfdp

when using adjoint sensitivities with events, one should always use polynomial instead of hermite interpolation.

FFroehlich avatar May 12 '22 21:05 FFroehlich