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

Unifying trajectories #245

Merged
merged 8 commits into from
Feb 15, 2021
Merged

Unifying trajectories #245

merged 8 commits into from
Feb 15, 2021

Conversation

xukai92
Copy link
Member

@xukai92 xukai92 commented Feb 10, 2021

This PR unifies all trajectories under the same interface.
For example, NUTS shall be constructed by:

τ = Trajectory{MultinomialTS}(Leapfrog(1e-3), GeneralisedNoUTurn())

Old constructors are supported but deprecated.

Besides, the way to unify FixedNSteps and FixedIntegrationTime is via a new-introduced nsteps(::Trajectory), suggested by @torfjelde.

  • Previously, FixedIntegrationTime was converted to FixedNSteps before calling transition, and termination_criterion.L appears here and there, which is not ideal.

@xukai92 xukai92 requested review from yebai and torfjelde February 10, 2021 19:55
torfjelde
torfjelde previously approved these changes Feb 12, 2021
Copy link
Member

@torfjelde torfjelde left a comment

Choose a reason for hiding this comment

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

LGTM! Just address my one comment. And, though it's not directly related to this PR, after we completely remove the NUTS struct it would still be useful to have a NUTS method which simply constructs the corresponding Trajectory so that people who aren't too familiar with the topic find what they expect.

Also, I really like this work:)

src/trajectory.jl Show resolved Hide resolved
src/AdvancedHMC.jl Outdated Show resolved Hide resolved
@xukai92
Copy link
Member Author

xukai92 commented Feb 13, 2021

CI passed now and it's ready for a final look @yebai

@xukai92
Copy link
Member Author

xukai92 commented Feb 13, 2021

The only CI which "fails" due to running out of time.
For some reaon the Geweke tests are pretty slow on Julia 1.0 (>4h) vs nightly (~1.5h).
I check previous CI logs and this was true before (this PR) as well.

@xukai92
Copy link
Member Author

xukai92 commented Feb 13, 2021

To be safe I just triggered a re-run of all CI. Let's see how it goes this time.

Copy link
Member

@yebai yebai left a comment

Choose a reason for hiding this comment

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

Excellent work - many thanks to Kai! I left some minor comments below.

README.md Outdated Show resolved Hide resolved
ClassicNoUTurn, GeneralisedNoUTurn,
StrictGeneralisedNoUTurn,
export Trajectory,
FixedNSteps, FixedIntegrationTime,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe consider unifying these type names in a future PR, e.g. FixedNSteps ==> FixedIntegrationSteps.

Copy link
Member Author

Choose a reason for hiding this comment

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

Created an issue for this and some other potential naming improvements #246.

src/AdvancedHMC.jl Outdated Show resolved Hide resolved
@xukai92
Copy link
Member Author

xukai92 commented Feb 15, 2021

Is this good to go?

@yebai yebai merged commit 7db7e90 into master Feb 15, 2021
@delete-merged-branch delete-merged-branch bot deleted the kx/rfc-trajectory branch February 15, 2021 12:47
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.

3 participants