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

Fix for issue 903 #910

Merged
merged 2 commits into from
Sep 17, 2019
Merged

Fix for issue 903 #910

merged 2 commits into from
Sep 17, 2019

Conversation

torfjelde
Copy link
Member

Fix for #906 (comment)

@@ -146,7 +146,7 @@ function assume(spl::Sampler{<:MH}, dist::Distribution, vn::VarName, vi::VarInfo
spl.state.proposal_ratio -= log(cdf(stdG, (ub-r)/σ) - cdf(stdG,(lb-r)/σ))
else # Other than Gaussian proposal
r = rand(proposal)
if (r < support(dist).lb) | (r > support(dist).ub) # check if value lies in support
if !(insupport(dist, r)) # check if value lies in support
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the fix. Looks correct to me. Can we introduce a test for this fix?

Maybe we can extract the code within the if-statmeent if typeof(proposal) == Distributions.Normal{Float64} into a function and perform the "if-else" via multiple dispatch. And by doing we can implement some tests easily too.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not quite clear what we want to test 🤔 Sort, what is your @test the_function(args...) == ?

Copy link
Member

Choose a reason for hiding this comment

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

It's probably ok to do the refactoring @xukai92 suggested in a separate PR

@yebai yebai merged commit 6503167 into master Sep 17, 2019
@delete-merged-branch delete-merged-branch bot deleted the tor/issue-906 branch September 17, 2019 13:08
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