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

Adds mass and normalize for a measure #130

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sethaxen
Copy link
Collaborator

@sethaxen sethaxen commented Aug 6, 2021

Fixes #128

@codecov
Copy link

codecov bot commented Aug 6, 2021

Codecov Report

Merging #130 (111779b) into master (8a2c551) will decrease coverage by 0.23%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #130      +/-   ##
==========================================
- Coverage   33.96%   33.73%   -0.24%     
==========================================
  Files          50       51       +1     
  Lines         998     1005       +7     
==========================================
  Hits          339      339              
- Misses        659      666       +7     
Impacted Files Coverage Δ
src/MeasureTheory.jl 50.00% <ø> (ø)
src/combinators/weighted.jl 12.90% <0.00%> (-0.44%) ⬇️
src/distributions.jl 0.00% <0.00%> (ø)
src/mass.jl 0.00% <0.00%> (ø)
src/primitives/dirac.jl 18.75% <0.00%> (-1.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8a2c551...111779b. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2021

Package name latest stable
Mitosis.jl
Soss.jl

@gdalle
Copy link
Collaborator

gdalle commented Aug 11, 2021

Hey there @sethaxen! I wanted to do that too in order to simulate Poisson processes on a given set, but I was going to make the relevant measures callable: something like

(::Lebesgue{ℝ})(interval::IntervalSets.AbstractInterval) = duration(interval)

Is that compatible with your approach? If not, which do you think is best?

@gdalle
Copy link
Collaborator

gdalle commented Aug 12, 2021

After some more thinking, I feel like it the notion of total mass is intimately linked with the subset we consider. If we want to integrate (numerically) a measure on a set, do we define the measure on that set (as in Lebesgue(S)) or do we apply the measure to that set (as in (::Lebesgue)(S)) ? I think the second one makes more sense, but I would like @cscherrer's input

@sethaxen
Copy link
Collaborator Author

The purpose of this PR was to provide an easy way to normalize a measure, but I don't think this is the right approach. For example, suppose we have a measure μ that we want to normalize, and we know how to sample from the normalized measure, but we don't know the total mass. Then this approach will not work, since it relies on computing the total mass.

I've been experimenting with a Normalized measure that simply represents the normalized version of whatever measure it wraps: https://github.com/JuliaManifolds/ManifoldMeasures.jl/blob/main/src/normalized.jl You can see, for example, how it is used here: https://github.com/JuliaManifolds/ManifoldMeasures.jl/blob/55f1713df5257c0723c6f3ff09d51e985777bb34/src/hausdorff.jl#L140-L150. This allows us to avoid computing the logmass unless absolutely necessary.

After some more thinking, I feel like it the notion of total mass is intimately linked with the subset we consider. If we want to integrate (numerically) a measure on a set, do we define the measure on that set (as in Lebesgue(S)) or do we apply the measure to that set (as in (::Lebesgue)(S)) ? I think the second one makes more sense, but I would like @cscherrer's input

I completely agree that for computing mass in general, we need a generic way to define sets, and it would be nice to be able to flexible hook into numerical integration packages for that. But because something like logmass could be called deep in some user code, we need to find a way for that user to specify parameters of the numerical integration algorithm.

@cscherrer
Copy link
Collaborator

Yes, I think these are two different things. For a measure μ, I think it makes sense to ask for μ(S) for some set S. For a point process, S might be a Set (if we have exchangability), or maybe an iterable.

Otherwise, we need to be a little restrictive, since things can get out of hand. I do think there are some things we can do for manifolds or measures dominated by Lebesgue measure, moslty in terms of intervals.

IntervalSets is very lightweight, so I think we could depend on that. Beyond that, there's lots of great stuff in JuliaIntervals that we could get to through an extension package. Those (at least mostly) don't depend on IntervalSets, but a conversion should be very easy.

@cscherrer cscherrer mentioned this pull request Aug 12, 2021
@gdalle
Copy link
Collaborator

gdalle commented Aug 12, 2021

So where does that leave us? I'm a bit lost as to what to implement

@cscherrer
Copy link
Collaborator

So where does that leave us? I'm a bit lost as to what to implement

Sounds like we collectively need to get in sync. I'll write a summary on Zulip, and we can talk some more about a broad view of where we're heading.

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.

Normalizing a measure
3 participants