ICB-DCM / pyPESTO

python Parameter EStimation TOolbox
https://pypesto.readthedocs.io
BSD 3-Clause "New" or "Revised" License
216 stars 47 forks source link

Semiquant: Add spline knots to the optimization result #1314

Closed Doresic closed 6 months ago

Doresic commented 6 months ago

Fixes #1308 by saving the spline knots in the OptimizerResult object under spline_knots in the form of list[list[np.array[float], np.array[float]]]. Each list in the first level corresponds to a semiquantitative observable. Each of these lists contains two arrays: the first array contains the spline bases, the second array contains the spline knot values. The ordering of the observable lists is the same as in pypesto.problem.hierarchical.semiquant_observable_ids.

This also allows the visualization plot_splines_from_pypesto_result to just extract the spline knot values from the pypesto result object instead of solving the inner problem to get them. The latter could even a bit wrong due to possibly different initial conditions of the inner optimization problem.

Except this, there is some random cleanup here and there.

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 84.21053% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 84.44%. Comparing base (7ecee81) to head (ffa7c26).

Files Patch % Lines
pypesto/visualize/spline_approximation.py 0.00% 6 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1314 +/- ## =========================================== - Coverage 84.48% 84.44% -0.04% =========================================== Files 153 153 Lines 12455 12478 +23 =========================================== + Hits 10522 10537 +15 - Misses 1933 1941 +8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Doresic commented 6 months ago

Do we have a test yet, saving and loading this results? If not, please add before merging. Otherwise looks good to me

Added a test to test/hierarchical/test_spline.py I'm just running a simple optimization with 2 starts, saving the result, loading it, and checking the spline knots before and after are the same.