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

How to set fill_fixed_parameters=True for petab parameter mappings? #1448

Open
FFroehlich opened this issue Aug 15, 2024 · 4 comments
Open

Comments

@FFroehlich
Copy link
Contributor

FFroehlich commented Aug 15, 2024

So there is

fill_fixed_parameters=False,
, which I don't like as this means that edata.plist will always be all parameters instead of subsetting to the ones that actually require sensitivities.

Now the best way that I found to fix this is

pypesto_problem = importer.create_problem()
simulation_conditions = petab.get_simulation_conditions(
    importer.petab_problem.measurement_df
)
pypesto_problem.objective.parameter_mapping = amici.petab.parameter_mapping.create_parameter_mapping(
    petab_problem=importer.petab_problem,
    simulation_conditions=simulation_conditions,
    scaled_parameters=True,
    amici_model=pypesto_problem.objective.amici_model,
    fill_fixed_parameters=True,
)

which is not great, because it requires me to have pretty deep knowledge of the code and requires a couple more lines of code than what I had hoped for.

Is there any specific reason why we are setting fill_fixed_parameters=True? If there is could we either expose this option to the user or set smarter defaults when this is really necessary?

Looks like this was introduced in #912, but seems unrelated to the linked issue #882. Unclear what "fix warning from fixed overrides" refers to.

@dweindl
Copy link
Member

dweindl commented Sep 6, 2024

Sorry for the late reply.

Looks like this was introduced in #912, but seems unrelated to the linked issue #882.

The linked issue is unrelated to fill_fixed_parameters, correct. It was linked because that other change in this PR (#882 (comment)).

Unclear what "fix warning from fixed overrides" refers to.

I don't recall that either. My guess would be: Before the change, pypesto was calling the amici/pypesto functions for filling parameter values according to the parameter mapping. The parameter mapping already set the values for the fixed parameters (fill_fixed_parameters=True). Thus, their symbols didn't show up in the parameter mapping anymore. Yet, pypesto still provided values for those parameters which triggered a warning that values were passed for unknown parameters. The PR was to prevent this warnings.

For anything based on the PEtab importer, changing fill_fixed_parameters should not be necessary.

this means that edata.plist will always be all parameters instead of subsetting to the ones that actually require sensitivities

This is very suprising. I am pretty sure this was working at some point and that there were tests in place. Needs further investigation.

@dweindl
Copy link
Member

dweindl commented Oct 8, 2024

this means that edata.plist will always be all parameters instead of subsetting to the ones that actually require sensitivities

This is very suprising. I am pretty sure this was working at some point and that there were tests in place. Needs further investigation.

So my current understanding is:

@dweindl
Copy link
Member

dweindl commented Oct 18, 2024

After a closer look: 1) plist is set correctly/efficiently if there are no pypesto-fixed parameters. I.e. condition-specific requirements are properly handled. 2) However, if there are pypesto-fixed parameters, they are not excluded from plist. For the latter I can't tell if this ever worked correctly or not.

I will try to get (2) fixed and will submit an effective test case shortly.

@dweindl
Copy link
Member

dweindl commented Oct 18, 2024

  1. However, if there are pypesto-fixed parameters, they are not excluded from plist. For the latter I can't tell if this ever worked correctly or not.

I am pretty confident this never worked.

dweindl added a commit to dweindl/pyPESTO that referenced this issue Oct 23, 2024
For further background, see ICB-DCM#1448.

We don't have to compute the full gradient in every model simulation. Some entries might not be required because of fixed parameter or some condition-specific objective parameter mapping. The former was supported (however, not tested), the latter was not supported. Now both are tested an supported.

There was no good way to communicate the fixed parameters to AmiciCalculator where ExpData.plist gets set. Passing this information is currently only possible through the parameter mapping, based on which the required sensitivities are determined. Therefore, in addition to the general parameter mapping, there is now a parameter mapping that accounts for the fixed parameters. Not sure what could be a more elegant way to handle that.
dweindl added a commit to dweindl/pyPESTO that referenced this issue Nov 4, 2024
For further background, see ICB-DCM#1448.

We don't have to compute the full gradient in every model simulation. Some entries might not be required because of fixed parameter or some condition-specific objective parameter mapping. The former was supported (however, not tested), the latter was not supported. Now both are tested an supported.

There was no good way to communicate the fixed parameters to AmiciCalculator where ExpData.plist gets set. Passing this information is currently only possible through the parameter mapping, based on which the required sensitivities are determined. Therefore, in addition to the general parameter mapping, there is now a parameter mapping that accounts for the fixed parameters. Not sure what could be a more elegant way to handle that.
dweindl added a commit to dweindl/pyPESTO that referenced this issue Nov 5, 2024
For further background, see ICB-DCM#1448.

We don't have to compute the full gradient in every model simulation. Some entries might not be required because of fixed parameter or some condition-specific objective parameter mapping. The former was supported (however, not tested), the latter was not supported. Now both are tested an supported.

There was no good way to communicate the fixed parameters to AmiciCalculator where ExpData.plist gets set. Passing this information is currently only possible through the parameter mapping, based on which the required sensitivities are determined. Therefore, in addition to the general parameter mapping, there is now a parameter mapping that accounts for the fixed parameters. Not sure what could be a more elegant way to handle that.
github-merge-queue bot pushed a commit that referenced this issue Nov 8, 2024
For further background, see #1448.

We don't have to compute the full gradient in every model simulation. Some entries might not be required because of fixed parameter or some condition-specific objective parameter mapping. The former was supported (however, not tested), the latter was not supported. Now both are tested an supported.

There was no good way to communicate the fixed parameters to AmiciCalculator where ExpData.plist gets set. Passing this information is currently only possible through the parameter mapping, based on which the required sensitivities are determined. Therefore, in addition to the general parameter mapping, there is now a parameter mapping that accounts for the fixed parameters. Not sure what could be a more elegant way to handle that.
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

No branches or pull requests

2 participants