-
Notifications
You must be signed in to change notification settings - Fork 32
KeywordCalls compatibility #93
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
Conversation
probability => parameterized
I had to make some adjustments in KeywordCalls. Best to use version 1.8 of that, or (until that's registered) this branch: |
∫(::typeof(identity), ::Dists.Distribution) = 1.0 | ||
|
||
logdensity(μ::Dists.Distribution, x) = Dists.logpdf(μ,x) | ||
Dists.logpdf(d::AbstractMeasure, x) = logdensity(d,x) |
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.
should this mimic distribution's pdf
, which is kind of broken? If we would like to represent the actual behaviour
function Dists.logpdf(d::AbstractMeasure, x)
μ = basemeasure(d)
if μ ≪ Lebesgue(...) # depending on size?
logdensity(d,Lebesgue, x)
elseif μ ≪ CountingMeasure(...)
logdensity(d,CountingMeasure, x)
else
error("logpdf undefined, try logdensity")
end
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.
Ahh, good point. I'd like to avoid the conditionals if possible, since they can make it hard to extend. But this is the idea of representative
. There are actually some pending design decisions around that concept. This PR review won't be very visible, so maybe I'll start a new issue to discuss this.
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.
@mschauer I added an issue on this here:
#98
That's maybe not entirely clear - giving a clear description of something as I'm figuring it out is kind of tricky. I think what it comes down to is that we can have
function Dists.logpdf(d::AbstractMeasure, x)
b = fix(basemeasure, d)
return logdensity(d, b)
end
This traverses to a fixpoint twice (once to find the fixpoint, and again to compute the logdensity
). I'm sure we can make this more efficient. When we do, we can add a test
d = ...
x = rand(d)
@test Dists.logpdf(d, x) == logdensity(d, fix(basemeasure, d), x)
What do you think?
@mschauer I'm going to go ahead with this, with the understanding that some of the "representative measure" stuff is still very unstable |
Changes
Dependencies
IsPrimitive
andIsRepresentative
, using SimpleTraits.jl (seetraits.jl
)transforms.jl
Renaming
@measure
is too vague, changed to@parameterized
ElementwiseProductMeasure
is a bit much, it's nowPointwiseProductMeasure
Likelihood
is nowLogLikelihood
, and it's callable as a functionsrc/probability
is nowsrc/parameterized
New stuff
@σ_methods
, mostly for use with measures on postive realsasparams
working better@primitive
to declare a measure to have theIsPrimitive
trait (very simple, really just to save end users from having to worry about traits)