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

Simultaneous Parameter Estimation #50

Open
Theo-BRN opened this issue Apr 18, 2024 · 5 comments
Open

Simultaneous Parameter Estimation #50

Theo-BRN opened this issue Apr 18, 2024 · 5 comments

Comments

@Theo-BRN
Copy link

Theo-BRN commented Apr 18, 2024

Heya, hope you're well!

I was wondering if simultaneous parameter estimation was possible with copasi/basico. For example, if you had two experiments you want to fit to, and of the two parameters to fit (k1 and k2), each experiment has a different k1, but a shared k2. Can you essentially tell copasi "this parameter is the same in both experiments, please fit it" and "this parameter may be different in each experiment, please fit it".

I know you can declare what experiments are affected by a parameter with set_fit_parameters but I'm not sure that's quite the same.

Any clarification, or reference to examples in documentation would be greatly appreciated.

Thanks,
Theo

@fbergmann
Copy link
Member

You are completely right, that is what affected experiments are made for. If not specified the parameter will be assumed to be the same for all experiments. Otherwise that parameter would be only used for the experiments specified. So if you had a different k1, you'd have 2 fit items for k1, with different affected experiments. I hope this makes it clear.

@Theo-BRN
Copy link
Author

Ah great, thank you for the clarification, that does help!

Is it possible to have a parameter be fitted as shared for some experiments and then independent for the rest? Let's say experiments 1, 2 and 3 share the same k_on variable and experiments 4 and 5 have different k_on variables. Perhaps the fit_parameters argument would look like:

fit_items = [
    {'name': "Values[k_on]", 'lower': 1e05, 'upper': 1e09, 'affected': ['Exp_1, Exp_2, Exp_3']},
    {'name': "Values[k_on]", 'lower': 1e05, 'upper': 1e09, 'affected': ['Exp_4']},
    {'name': "Values[k_on]", 'lower': 1e05, 'upper': 1e09, 'affected': ['Exp_5']},
]

@fbergmann
Copy link
Member

indeed, but you'd have to write it like:

fit_items = [
    {'name': "Values[k_on]", 'lower': 1e05, 'upper': 1e09, 'affected': ['Exp_1', 'Exp_2', 'Exp_3']},
    {'name': "Values[k_on]", 'lower': 1e05, 'upper': 1e09, 'affected': ['Exp_4']},
    {'name': "Values[k_on]", 'lower': 1e05, 'upper': 1e09, 'affected': ['Exp_5']},
]

@Theo-BRN
Copy link
Author

Theo-BRN commented Apr 19, 2024

Oh of course, tha's just a silly mistake of mine.

In which case that's brilliant functionality! Thank you so much for your help!

Are you able to supply a pandas dataframe to the function instead of a list of dictionaries?

@fbergmann
Copy link
Member

oh i missed this question. Indeed the fititems can be set as pandas dataframe

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