Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semiquant: Add spline knots to the optimization result #1314

Merged
merged 9 commits into from
Mar 7, 2024

Conversation

Doresic
Copy link
Contributor

@Doresic Doresic commented Feb 29, 2024

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.

Adds spline knots to the optimization result so they can be easily obtained after optimization. This then allows easy further use, if needed.
@codecov-commenter
Copy link

codecov-commenter commented Feb 29, 2024

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 ⚠️

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

Additional details and impacted files
@@             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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Doresic Doresic marked this pull request as ready for review March 4, 2024 14:25
Copy link
Contributor

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only looked at changes in pypesto/objective/amici/amici.py

pypesto/visualize/spline_approximation.py Outdated Show resolved Hide resolved
Doresic and others added 3 commits March 4, 2024 16:29
Copy link
Collaborator

@PaulJonasJost PaulJonasJost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Doresic
Copy link
Contributor Author

Doresic commented Mar 6, 2024

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.

Copy link
Contributor

@m-philipps m-philipps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any issues in the visualize/spline_approximation.py. For the future it would be useful to have you as a codeowner of that file.

pypesto/visualize/spline_approximation.py Outdated Show resolved Hide resolved
Doresic and others added 2 commits March 7, 2024 12:57
Co-authored-by: Maren Philipps <55318391+m-philipps@users.noreply.github.com>
@Doresic Doresic merged commit d32563b into develop Mar 7, 2024
18 checks passed
@Doresic Doresic deleted the semiquant_add_knots_to_result branch March 7, 2024 14:46
@PaulJonasJost PaulJonasJost mentioned this pull request Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants