Skip to content

Conversation

cscherrer
Copy link
Collaborator

@cscherrer cscherrer commented May 28, 2021

Changes

Dependencies

  • now using KeywordCalls.jl
  • Early stages of trait interface for IsPrimitive and IsRepresentative, using SimpleTraits.jl (see traits.jl)
  • New Distributions.jl version (no real changes here from that)
  • New TransformVariables has breaking changes, see transforms.jl

Renaming

  • @measure is too vague, changed to @parameterized
  • ElementwiseProductMeasure is a bit much, it's now PointwiseProductMeasure
  • Likelihood is now LogLikelihood, and it's callable as a function
  • src/probability is now src/parameterized

New stuff

@github-actions
Copy link
Contributor

Package name latest stable
Mitosis.jl
Soss.jl

@cscherrer cscherrer requested a review from mschauer May 28, 2021 18:10
@github-actions
Copy link
Contributor

Package name latest stable
Mitosis.jl
Soss.jl

@github-actions
Copy link
Contributor

Package name latest stable
Mitosis.jl
Soss.jl

@github-actions
Copy link
Contributor

Package name latest stable
Mitosis.jl
Soss.jl

@github-actions
Copy link
Contributor

Package name latest stable
Mitosis.jl
Soss.jl

@cscherrer
Copy link
Collaborator Author

I had to make some adjustments in KeywordCalls. Best to use version 1.8 of that, or (until that's registered) this branch:
cscherrer/KeywordCalls.jl#23

(::typeof(identity), ::Dists.Distribution) = 1.0

logdensity::Dists.Distribution, x) = Dists.logpdf(μ,x)
Dists.logpdf(d::AbstractMeasure, x) = logdensity(d,x)
Copy link
Member

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

Copy link
Collaborator Author

@cscherrer cscherrer May 30, 2021

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.

Copy link
Collaborator Author

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?

@cscherrer
Copy link
Collaborator Author

@mschauer I'm going to go ahead with this, with the understanding that some of the "representative measure" stuff is still very unstable

@cscherrer cscherrer merged commit 70a1117 into master Jun 1, 2021
@cscherrer cscherrer deleted the cs-keywordcalls branch June 1, 2021 13:21
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.

2 participants