-
Notifications
You must be signed in to change notification settings - Fork 84
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
Implementation of Girsanov reweighting in deeptime MSM estimator #290
Conversation
add GirsanovReweightingEstimator import
This module implements an estimator for Girsanov path reweighting for Markov state models.
add possibility to input list of g,M factor arrays
Super cool, thank you for your contribution! Do you think it is possible to add a sanity unit test to the new estimator? The failing tests are due to a tab/space mismatch. Let me know if you need support, I am happy to integrate this. |
@@ -213,7 +214,83 @@ def effective_count_matrix(dtrajs, lag, average='row', mact=1.0, n_jobs=None, ca | |||
return sparse.effective_counts.effective_count_matrix(dtrajs, lag, average=average, mact=mact, n_jobs=n_jobs, | |||
callback=callback) | |||
|
|||
def girsanov_reweighted_count_matrix(dtraj, lag, reweighting_factors, | |||
sliding=True, sparse_return=True, nstates=None): | |||
r"""Generate a Girsanov reweighted count matrix from given microstate trajectory. :footcite:`donati2017girsanov` |
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.
This will need an entry in references.bib to render correctly
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 will add the reference as soon as it is published
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #290 +/- ##
==========================================
+ Coverage 92.03% 92.07% +0.04%
==========================================
Files 142 143 +1
Lines 11657 11725 +68
==========================================
+ Hits 10728 10796 +68
Misses 929 929 ☔ View full report in Codecov by Sentry. |
Thank you, that's great! We added a sanity unit test for the new estimator and fixed the tap/space mismatch. When trying to run the tests with |
The bindings are part of the c++ module of deeptime, If all dependencies are available, you can set up a development environment with it using |
If you update your branch against the current main, the errors unrelated to this PR should be gone. :) |
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.
The formatting is a bit off for some of the changes (like no spaces around equal signs) and you have a few problems in your doctests.
factors = np.concatenate(factors) | ||
data = factors | ||
else: | ||
raise NotImplementedError('An input format other than a tuple (g,M) for the reweighting factors is not implemented.') |
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.
could be covered by tests
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.
perhaps you can parametrize the tests to cover dense and sparse representations
Unfortunately, I still have the same problem. Not only the tests in 'tests/' also the doctests gives me only message pointing to the import error. |
this is probably due to the way python discovers modules: first in the local directory. as there is a one way around this is using nox: python -m pytest --doctest-modules --durations=20 --pyargs . |
ah damn, i didn't implement numpy 2.0 support yet, hence the failures. i'll push a fix soon, then ci should be green (plusminus the test you're adding). |
for all i am concerned this can be squashed and merged now. i still think the testing could be a bit more thorough (as indicated by coverage) but i'll leave that up to you if you want to provide it. |
|
||
>>> C_sliding.toarray() | ||
array([[1., 2.], | ||
[0., 1.]]) |
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.
Sorry to bug about this again, but the test expectation does not match the result here, please do fix :)
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.
Are you able to reproduce the test failure locally?
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.
oh no, of course I'll fix it! unfortunately not until September.
Welcome back! It looks good to me now and the test failure is unrelated, so if you think it is ready, I will hit the merge button. |
We extended the MSM estimator class, such that the transition counts are reweighted according to the reweighting factor trajectory.
Joana-Lysiane Schäfer, Bettina G. Keller, Implementation of Girsanov reweighting in OpenMM and Deeptime
We demonstrated the correct functioning and error-free applicability of the newly implemented
functions using both a low-dimensional test system and a molecular system.
The corresponding reference "Implementation of Girsanov reweighting in OpenMM and Deeptime" is currently under review and will be publicly available shortly.
The required input files and setup for the evaluation of a reweighted Markov state model are available at reweightingtools