-
Notifications
You must be signed in to change notification settings - Fork 17
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
Allow Parameters as initial values for ODEModel #279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice PR! I have some remaining questions and suggestions, but I'm really happy this got done.
symfit/core/models.py
Outdated
@@ -1100,7 +1103,7 @@ def eval_components(self, *args, **kwargs): | |||
initial_dependent, | |||
t_bigger, | |||
args=tuple( | |||
bound_arguments.arguments[param.name] for param in self.params), | |||
bound_arguments.arguments[param.name] for param in self.model_params), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this switch needed? I'm guessing because the parameter corresponding to the initial value should not be provided here? I feel like this needs either a comment or a better variable name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was needed because a0
should not be passed to the python version of the component, to be integrated by scipy. Instead, a0
should be passed to scipy in initial_dependent
.
I'll add a comment
This is great! Is there a way to "scale" the initial values? For example, I have the following equation: logistic_eqn = {
sf.D(s1,c): r*s1*(1-s1/K1)
}
logistic_model = sf.ODEModel(logistic_eqn, initial = {c:0.0,s1:s1_0}) This works fine if I give a good guess for s1_0, but I know that the local minima in the model are evenly distributed in the "log" space of the initial values. If I brute force the residuals, I find the global minima occurs at r = 0.8 and log10(s1_0) = -7.5, but there are other local minima at log10(s1_0) ~ -5.5, -6.5, -8.5, -9.5 with r = 0.6, 0.7, 0.9, and 1.0, respectively. I worry that a naive minimizer will explore the initial values in linear space, thus inefficiently. I've tried giving a first guess for Any suggestions? I can provide more code if helpful, or post to StackOverflow if that's better. |
Very interesting point! |
Sure! See this issue: #284 |
Fixes #160