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

Improve readability by packing frequently used variables into namedtuples. #99

Merged
merged 3 commits into from Jun 22, 2023

Conversation

zoj613
Copy link
Member

@zoj613 zoj613 commented May 9, 2023

closes #67

Here are a few important guidelines and requirements to check before your PR can be merged:

  • There is an informative high-level description of the changes.
  • The description and/or commit message(s) references the relevant GitHub issue(s).
  • pre-commit is installed and set up.
  • The commit messages follow these guidelines.
  • The commits correspond to relevant logical changes, and there are no commits that fix changes introduced by other commits in the same branch/BR. If your commit description starts with "Fix...", then you're probably making this mistake.
  • There are tests covering the changes introduced in the PR.

Don't worry, your PR doesn't need to be in perfect order to submit it. As development progresses and/or reviewers request changes, you can always rewrite the history of your feature/PR branches.

If your PR is an ongoing effort and you would like to involve us in the process, simply make it a draft PR.

@zoj613 zoj613 changed the title Improve readability by pack frequently used variables into namedtuples. Improve readability by packing frequently used variables into namedtuples. May 9, 2023
@zoj613 zoj613 force-pushed the pack_vars branch 3 times, most recently from 3f74ae4 to 40e5160 Compare May 10, 2023 01:01
@brandonwillard brandonwillard added enhancement New feature or request refactoring A change that improves the codebase but doesn't necessarily introduce a new feature labels May 10, 2023
@zoj613
Copy link
Member Author

zoj613 commented May 10, 2023

@rlouf could you please help diagnose the one failed test test_nuts_mcse? It appears that the MCSE fails for one of the cases in the NUTS sampler. The changes seem fine and do not appear to change behavior so i'm a little confused.

@codecov
Copy link

codecov bot commented May 15, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (75fd205) 100.00% compared to head (53f8f8b) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #99   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          544       565   +21     
  Branches        31        31           
=========================================
+ Hits           544       565   +21     
Impacted Files Coverage Δ
aehmc/algorithms.py 100.00% <100.00%> (ø)
aehmc/hmc.py 100.00% <100.00%> (ø)
aehmc/integrators.py 100.00% <100.00%> (ø)
aehmc/nuts.py 100.00% <100.00%> (ø)
aehmc/proposals.py 100.00% <100.00%> (ø)
aehmc/step_size.py 100.00% <100.00%> (ø)
aehmc/termination.py 100.00% <100.00%> (ø)
aehmc/trajectory.py 100.00% <100.00%> (ø)
aehmc/window_adaptation.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

brandonwillard
brandonwillard previously approved these changes May 16, 2023
Copy link
Member

@brandonwillard brandonwillard left a comment

Choose a reason for hiding this comment

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

These changes look great!

Comment on lines +71 to +74
da_state.iterates, # log_step_size
da_state.iterates_avg, # log_step_size_avg
da_state.gradient_avg,
da_state.shrinkage_pts, # mu
Copy link
Member

Choose a reason for hiding this comment

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

What are these comments indicating?

Copy link
Member Author

@zoj613 zoj613 May 16, 2023

Choose a reason for hiding this comment

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

The dual averaging state's "iterates" is represented by the log_step_size variable and the "shrinkage_pts" is represented by the mu variable in the context of this function. Is this correct, @rlouf ?

brandonwillard
brandonwillard previously approved these changes May 17, 2023
@brandonwillard
Copy link
Member

These updates look great; I'm ready to move forward with them.

@zoj613
Copy link
Member Author

zoj613 commented May 23, 2023

These updates look great; I'm ready to move forward with them.

I will still need to look into updating the docstrings. @rlouf any thoughts on these changes?

@brandonwillard brandonwillard merged commit ece0aaf into aesara-devs:main Jun 22, 2023
11 checks passed
@brandonwillard
Copy link
Member

Merged, because these changes are already very helpful. We can add follow-ups for the docstrings and anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring A change that improves the codebase but doesn't necessarily introduce a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ProposalStateType, IntegratorStateType, etc should be namedtuples
2 participants