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

Handling unsampled states in offline/realtime analysis. #593

Merged
merged 2 commits into from
Jun 7, 2022

Conversation

ijpulidos
Copy link
Contributor

@ijpulidos ijpulidos commented Jun 7, 2022

Description

This aims to refactor MultiStateSampler._offline_analysis to handle unsampled states when doing the mbar estimate.

In this case the _offline_analysis method was decoupled from the _online_analisis one (which is still experimental). So that it initializes the first time with zeros as guess and subsequent results are updated using the previous calculation.

For this I had to make a new private attribute _last_mbar_f_k_offline which gets also written to the nc file independently of the attributes used in the _online_analysis method.

Resolves #592

Todos

  • Implement feature / fix bug
  • [n/a] Add tests
  • Update documentation as needed
  • Update changelogNotable points that this PR has either accomplished or will accomplish.

Status

  • Ready to go

@ijpulidos ijpulidos requested a review from mikemhenry June 7, 2022 21:36
@ijpulidos
Copy link
Contributor Author

ijpulidos commented Jun 7, 2022

This test, inside TestHarmonicOscillatorsMultiStateSampler, should be executing the _offline_analysis method using unsampled states. Therefore these changes should be already covered in the tests.

Copy link
Contributor

@mikemhenry mikemhenry left a comment

Choose a reason for hiding this comment

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

LGTM

@ijpulidos ijpulidos merged commit cea9d2c into main Jun 7, 2022
@ijpulidos ijpulidos deleted the offline-analysis-unsampled-states branch June 7, 2022 23:55
@zhang-ivy
Copy link
Contributor

This test, inside TestHarmonicOscillatorsMultiStateSampler, should be executing the _offline_analysis method using unsampled states. Therefore these changes should be already covered in the tests.

@ijpulidos : Was this test passing before? If so, we may want to discuss editing it or adding another version of it that fails without this PR

@ijpulidos
Copy link
Contributor Author

ijpulidos commented Jun 8, 2022

@zhang-ivy Yeah, good catch!

I guess it is worth mentioning that failing to make the MBAR estimates in the _offline_analysis method has never killed the simulation, I think we want to leave like that so far, just because I have the feeling there are many ways this estimate could fail (not just with the unsampled states thing).

My guess is that since we are relying more and more on this real time analysis file, it is a good idea to write a test for it. I'll raise an issue about it, and maybe also discuss in the same issue if it's worth to stop/kill the simulation if the MBAR estimates are not correctly computed. Does that sound okay?

@ijpulidos
Copy link
Contributor Author

So this means running the _offline_analysis method could've been silently failing this whole time. Since the exception gets caught and it's never raised.

@zhang-ivy
Copy link
Contributor

zhang-ivy commented Jun 8, 2022

I guess it is worth mentioning that failing to make the MBAR estimates in the _offline_analysis method has never killed the simulation

Ah, I didn't realize this!

My guess is that since we are relying more and more in this real time analysis file, it is a good idea to write a test for it. I'll raise an issue about it, and maybe also discuss in the same issue if it's worth to stop/kill the simulation if the MBAR estimates are not correctly computed. Does that sound okay?

Yes sounds good, I think its ok for that to be a part of the next release, not openmmtools 0.21.4
I actually don't think we will want to kill the simulation if the offline analysis fails. I think the current behavior makes sense.
I think we just need a test to check that that the online/offline analysis is working properly.

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.

Don't use online analysis to set offline analysis matrix dim
3 participants