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

added option for hdf5 History to read_result_from_file #663

Merged
merged 26 commits into from
May 14, 2021

Conversation

PaulJonasJost
Copy link
Collaborator

@PaulJonasJost PaulJonasJost commented May 12, 2021

closes #259.

@codecov-commenter
Copy link

codecov-commenter commented May 12, 2021

Codecov Report

Merging #663 (3961dda) into develop (6acc530) will increase coverage by 42.51%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           develop     #663       +/-   ##
============================================
+ Coverage    47.57%   90.08%   +42.51%     
============================================
  Files           95       95               
  Lines         6117     6134       +17     
============================================
+ Hits          2910     5526     +2616     
+ Misses        3207      608     -2599     
Impacted Files Coverage Δ
pypesto/objective/history.py 95.36% <100.00%> (+48.22%) ⬆️
pypesto/optimize/optimizer.py 90.11% <100.00%> (+3.04%) ⬆️
pypesto/objective/amici_calculator.py 93.33% <0.00%> (+1.66%) ⬆️
pypesto/optimize/optimize.py 94.00% <0.00%> (+6.00%) ⬆️
pypesto/ensemble/constants.py 91.83% <0.00%> (+6.12%) ⬆️
pypesto/objective/function.py 87.96% <0.00%> (+6.48%) ⬆️
pypesto/startpoint/uniform.py 100.00% <0.00%> (+7.14%) ⬆️
pypesto/objective/amici_util.py 84.21% <0.00%> (+8.77%) ⬆️
pypesto/optimize/options.py 100.00% <0.00%> (+10.52%) ⬆️
... and 54 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6acc530...3961dda. Read the comment docs.

@@ -1115,10 +1118,10 @@ def _compute_vals_from_trace(self):
# etc
max_init_iter = 3
for it in range(min(len(self.history), max_init_iter)):
candidate = self.history.get_fval_trace(it)
candidate = self.history.get_fval_trace()[it]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this necessary? passing it into the function was designed to allow for efficient access, e.g. not calculating the full trajectory, but only that specific index/indices. Not sure if csv/hdf5 use it, but could potentially.

Copy link
Collaborator Author

@PaulJonasJost PaulJonasJost May 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

csv uses it, but hdf5 did not. that's why I changed it for now into this to be able to use the function in both file formats.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I see. That's a bug in the History class: It seems like when it was introduced, it was not properly propagated down to hdf5, only csv, therefore the function calls there raise a "Signature does not match base class" warning in pycharm. Could you modify the functions in the Hdf5History?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

pypesto/objective/history.py Outdated Show resolved Hide resolved
pypesto/objective/history.py Outdated Show resolved Hide resolved
@PaulJonasJost PaulJonasJost linked an issue May 12, 2021 that may be closed by this pull request
@yannikschaelte yannikschaelte self-requested a review May 14, 2021 11:55
Copy link
Member

@yannikschaelte yannikschaelte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks! @FFroehlich as this affects some of your code, you may want to have a look, but I think we can merge already.

for storage_type in ['.csv',
'.hdf5',
None]:
with tempfile.TemporaryDirectory(dir=".") as tmpdirname:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dir = "." is not necessary, but ok

# comparing nan and None difficult
if original_trace[iteration] is None or np.isnan(
original_trace[iteration]).all():
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better check that the same then also applies to the reconst_ one?

Copy link
Collaborator Author

@PaulJonasJost PaulJonasJost May 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
continue
assert(reconst_trace[iteration] is None or
np.isnan(reconst_trace[iteration]).all())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like this @yannikschaelte ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe separate None and nan, then it should be like the previous check

pypesto/objective/history.py Outdated Show resolved Hide resolved
PaulJonasJost and others added 3 commits May 14, 2021 14:32
Co-authored-by: Yannik Schälte <31767307+yannikschaelte@users.noreply.github.com>
@PaulJonasJost PaulJonasJost merged commit 4fd93af into develop May 14, 2021
@PaulJonasJost PaulJonasJost deleted the feature_result_from_history branch May 14, 2021 13:01
@yannikschaelte yannikschaelte mentioned this pull request May 17, 2021
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

Successfully merging this pull request may close these issues.

Fill result from history
4 participants