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

pypesto.profile.parameter_profile leaves Problem in modified state if an error occurs during profiling #1150

Closed
dweindl opened this issue Oct 25, 2023 · 5 comments · Fixed by #1153
Assignees
Labels
bug Something isn't working fixed but not released profiling Related to profiling

Comments

@dweindl
Copy link
Member

dweindl commented Oct 25, 2023

What happens:

fixed_parameters_before = problem.x_fixed_indices

parameter_profile(problem, profile_index=[0], ...) # <- fails for unrelated reasons

assert problem.x_fixed_indices == fixed_parameters_before # <- fails, because parameters were fixed during profiling but not unfixed

# retry computing profiles
parameter_profile(problem, profile_index=[0], ...) # <- nothing happens, because that parameter is still set to fixed

parameter_profile should either create a copy of problem, or make sure that it is in the original state when parameter_profile exists, independent of any potential errors.

@dweindl dweindl added the bug Something isn't working label Oct 25, 2023
@PaulJonasJost PaulJonasJost added the profiling Related to profiling label Oct 25, 2023
@PaulJonasJost PaulJonasJost self-assigned this Oct 25, 2023
@PaulJonasJost
Copy link
Collaborator

Would go with copy for now. Any strong arguments against that?

@dweindl
Copy link
Member Author

dweindl commented Oct 25, 2023

Would go with copy for now. Any strong arguments against that?

No. Considering the cost of profiling, the copying-overhead should be negligible.
That Problem/Objective is copy-able is already expected elsewhere, so it shouldn't be a problem here either.

@PaulJonasJost
Copy link
Collaborator

yes, that's what I thought as well. 👍🏼

@dweindl
Copy link
Member Author

dweindl commented Oct 25, 2023

Somewhat independent issue, but related to the pseudo-code above: Would be good to issue some warning when attempting to compute profiles for fixed parameters instead of just not doing anything.

@PaulJonasJost
Copy link
Collaborator

You are right, just went through the profile code and noticed that as well. As it Is a somewhat independent issue, I will create a new issue and fix it as well 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed but not released profiling Related to profiling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants