-
Notifications
You must be signed in to change notification settings - Fork 47
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
Feature fixedpars #37
Conversation
I'd prefer if somebody who was using this feature in matlab before could review this. Who? |
Codecov Report
@@ Coverage Diff @@
## master #37 +/- ##
=========================================
- Coverage 82.94% 82.35% -0.6%
=========================================
Files 13 15 +2
Lines 604 918 +314
=========================================
+ Hits 501 756 +255
- Misses 103 162 +59
Continue to review full report at Codecov.
|
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.
Looks good and convenient to use
@@ -21,5 +21,20 @@ Tests can be written with `pytest <https://docs.pytest.org/en/latest/>`_ | |||
or the `unittest <https://docs.python.org/3/library/unittest.html>`_ module. | |||
|
|||
|
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.
Is contribute.rst recognized by github? Otherwise change to CONTRIBUTING.md to show this information in pull requests?
|
||
if x_fixed_vals is None: | ||
x_fixed_vals = np.array([]) | ||
self.x_fixed_vals = np.array(x_fixed_vals) |
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.
Check that len(x_fixed_vals) == len(x_fixed_indices) ?
SORRY FOR THE BIG MERGE!!! Merging with another pull request where, among other things, the objective was enabled to record a history, a couple of more changes became necessary:
One remark on the underlying idea: Objective should be rather free from dimensions, because in particular different parameter fixings can be used, and the dimensions can be read automatically from the data (bounds etc) passed to a Problem. Therefore, the problem deals with everything dimension-related, and just updates the objective accordingly. It also provides functions to switch between representations, as well as the dimension used in the optimization etc. Please indicate if you would do sth different, e.g. the options constructs or whatever. |
@dweindl @FFroehlich maybe you can have a short look bc due to the merge many changes were required. I will merge to master tomorrow then hopefully. the problems with the notebooks should be resolved. |
pypesto/objective/objective.py
Outdated
] | ||
|
||
# check whether to append to trace | ||
if not self.options.trace_all and fval >= self.fval_min: |
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.
we could check for that a bit earlier, right?
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.
At this point one remark: I found that pd.DataFrame.toc appending is really slow compared to list.append() (like 10s to <1s), but of course has better readability. Usually won't matter for our ODE problems.
pypesto/optimize/optimize.py
Outdated
print(('start ' + str(j_start) + ' failed: {0}').format(err)) | ||
optimizer_result = recover_result(objective, startpoint, err) | ||
return optimizer_result | ||
raise err |
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.
does this properly rethrow the error with full traceback? If not, I would prefer the inline version.
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.
true, the stacktrace is wrong, starting in the new method. will change that.
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.
Looks good. Had only a superficial look because of time-constraints though.
from .objective import Objective | ||
|
||
try: | ||
import amici |
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.
Here I would add a version check as mentioned in #40 . The AMICI python interface is likely to undergo some more changes, and I think it's quite annoying for the user to find out which version works
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.
requires AMICI-dev/AMICI#426, then we should test that here using amici.__version__
and see here: https://stackoverflow.com/questions/11887762/how-do-i-compare-version-numbers-in-python
return self.get_error_output(sensi_orders, mode) | ||
|
||
self.preequilibration_edata[fixedParameters]['x0'] = \ | ||
rdata['x0'] |
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 are we using x0 here? Why are we not using preequilibration inside amici?
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.
pypesto/objective/objective.py
Outdated
Flag indicating whether to save the trace. | ||
Default: False. | ||
|
||
trace_file: str, optional |
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.
Do we need trace_save? Is this not implied by trace_file?
pypesto/objective/objective.py
Outdated
|
||
def _save_trace(self, finalize=False): | ||
""" | ||
Save to file via pickle if options.trace_save is True and other |
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.
pickle? pandas?
Fix rule scanning for observables and sigma
Enable fixing of parameters: