-
Notifications
You must be signed in to change notification settings - Fork 5
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
Remove link functions and refactor tests #86
Conversation
src/graphs.jl
Outdated
check_and_add_vertex!( | ||
g, l_vn, NodeInfo(l, vars, link_functions, node_functions, node_args) | ||
g, l_vn, NodeInfo(l, vars, node_functions, node_args) | ||
) |
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.
[JuliaFormatter] reported by reviewdog 🐶
check_and_add_vertex!( | |
g, l_vn, NodeInfo(l, vars, link_functions, node_functions, node_args) | |
g, l_vn, NodeInfo(l, vars, node_functions, node_args) | |
) | |
check_and_add_vertex!(g, l_vn, NodeInfo(l, vars, node_functions, node_args)) |
src/graphs.jl
Outdated
check_and_add_vertex!( | ||
g, r_vn, NodeInfo(r, vars, link_functions, node_functions, node_args) | ||
g, r_vn, NodeInfo(r, vars, node_functions, node_args) | ||
) |
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.
[JuliaFormatter] reported by reviewdog 🐶
check_and_add_vertex!( | |
g, r_vn, NodeInfo(r, vars, link_functions, node_functions, node_args) | |
g, r_vn, NodeInfo(r, vars, node_functions, node_args) | |
) | |
check_and_add_vertex!(g, r_vn, NodeInfo(r, vars, node_functions, node_args)) |
test/logp_tests/binomial.jl
Outdated
JuliaBUGS.evaluate!!( | ||
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | ||
).logp |
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.
[JuliaFormatter] reported by reviewdog 🐶
JuliaBUGS.evaluate!!( | |
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | |
).logp | |
JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, false), DefaultContext()).logp |
test/logp_tests/blockers.jl
Outdated
JuliaBUGS.evaluate!!( | ||
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | ||
).logp |
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.
[JuliaFormatter] reported by reviewdog 🐶
JuliaBUGS.evaluate!!( | |
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | |
).logp | |
JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, false), DefaultContext()).logp |
test/logp_tests/bones.jl
Outdated
JuliaBUGS.evaluate!!( | ||
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | ||
).logp |
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.
[JuliaFormatter] reported by reviewdog 🐶
JuliaBUGS.evaluate!!( | |
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | |
).logp | |
JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, false), DefaultContext()).logp |
test/logp_tests/dogs.jl
Outdated
JuliaBUGS.evaluate!!( | ||
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | ||
).logp |
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.
[JuliaFormatter] reported by reviewdog 🐶
JuliaBUGS.evaluate!!( | |
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | |
).logp | |
JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, false), DefaultContext()).logp |
test/logp_tests/gamma.jl
Outdated
JuliaBUGS.evaluate!!( | ||
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | ||
).logp |
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.
[JuliaFormatter] reported by reviewdog 🐶
JuliaBUGS.evaluate!!( | |
DynamicPPL.settrans!!(bugs_model, false), DefaultContext() | |
).logp | |
JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, false), DefaultContext()).logp |
test/logp_tests/rats.jl
Outdated
)[2].logp | ||
bugs_logp = JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, true), DefaultContext()).logp |
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.
[JuliaFormatter] reported by reviewdog 🐶
)[2].logp | |
bugs_logp = JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, true), DefaultContext()).logp | |
)[2].logp | |
bugs_logp = | |
JuliaBUGS.evaluate!!(DynamicPPL.settrans!!(bugs_model, true), DefaultContext()).logp |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #86 +/- ##
==========================================
+ Coverage 69.20% 71.75% +2.54%
==========================================
Files 17 16 -1
Lines 1640 1625 -15
==========================================
+ Hits 1135 1166 +31
+ Misses 505 459 -46
☔ View full report in Codecov by Sentry. 📢 Have feedback on the report? Share it here. |
src/compiler_pass.jl
Outdated
pass.array_sizes, | ||
pass.array_bitmap, | ||
pass.link_functions, | ||
pass.node_args, | ||
pass.node_functions, |
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.
[JuliaFormatter] reported by reviewdog 🐶
pass.array_sizes, | |
pass.array_bitmap, | |
pass.link_functions, | |
pass.node_args, | |
pass.node_functions, | |
pass.array_sizes, pass.array_bitmap, pass.node_args, pass.node_functions, |
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.
Nice work @sunxd3 -- I left some minor comments below.
src/utils.jl
Outdated
Bijectors.transform(::Inverse{LogisticBijector}, x::Real) = logit(x) | ||
Bijectors.logabsdet(::LogisticBijector, x::Real) = log(logistic(x)) + log(1 - logistic(x)) | ||
|
||
struct CExpExp <: Bijectors.Bijector end |
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.
Consider adding suffix Bijector
to all bijectors here for consistency and clarity.
struct CExpExp <: Bijectors.Bijector end | |
struct CExpExpBijector <: Bijectors.Bijector end |
src/utils.jl
Outdated
Bijectors.transform(::Inverse{ExpBijector}, x::Real) = log(x) | ||
Bijectors.logabsdet(::ExpBijector, x::Real) = x | ||
|
||
struct Phi <: Bijectors.Bijector end |
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.
struct Phi <: Bijectors.Bijector end | |
struct PhiBijector <: Bijectors.Bijector end |
I am not sure what this means. Can you elaborate? |
Sorry that was confusing -- I just mean we can allow user to specify what bijector they want to use on certain variables. Not sure if people actually want this. The priority is pretty low by my measure. |
I see, for clarity, link functions inside the model specification are different from bijective transforms we use during inference. The former is part of the model, and cannot be replaced with a inference time bijector. |
Do you have a reference on this? |
Nimble Doc |
NodeInfo
Nimble
supports this syntax while the original BUGS doesn't, so this is not really a loss of featureBijectors.jl
, the benefits of supporting link functions in stochastic assignments is diminishing. In the future, we can add support for specifying thebijector
to use, which would be a solid improvement over the link function syntax in my opiniondist
through a bijector, and then pull it back and accumulate logabsdetjac. Now this is removedDynamicPPL.reconstruct
, matrix values are handled correctlyDynamicPPL
, now we just uselink
to transform the varinfo; useLogDensityFunction
when possible