Skip to content

Implement lazy evaluation for BayesMBAR to avoid unnecessary computations#10

Open
xiki-tempula wants to merge 3 commits into
DingGroup:mainfrom
xiki-tempula:feat_lazy_evaluation
Open

Implement lazy evaluation for BayesMBAR to avoid unnecessary computations#10
xiki-tempula wants to merge 3 commits into
DingGroup:mainfrom
xiki-tempula:feat_lazy_evaluation

Conversation

@xiki-tempula

Copy link
Copy Markdown
Contributor

Summary

  • Refactor BayesMBAR to use lazy evaluation, deferring expensive computations until the relevant properties are accessed
  • When only F_mode is needed, MCMC sampling is now completely skipped, significantly improving performance

Details

Before: All computations (mode + MCMC sampling) happened in __init__, even if only F_mode was needed.

After: Computations are deferred and only triggered when the corresponding property is accessed:

Property Uniform Prior Normal Prior
F_mode Mode only Mode + samples (for hyperparams) + posterior mode
F_mean, F_cov, F_std, F_samples Mode + sampling Full posterior sampling

This is particularly beneficial for users who only need point estimates (F_mode) and don't require uncertainty quantification, as they now avoid the expensive MCMC warmup (500 steps) and sampling (1000 samples).

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.

1 participant