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

sigma algebras? #53

Open
cartazio opened this issue Feb 1, 2021 · 15 comments
Open

sigma algebras? #53

cartazio opened this issue Feb 1, 2021 · 15 comments

Comments

@cartazio
Copy link

cartazio commented Feb 1, 2021

depending on how you wanna use mesures on the reals, it seems to me that something like having measures provide a sorta of "valuation" function on the elements of their sigma algebras might be useful? (or at least the generators of the sigma algebras etc etc, lets ignore filtrations )

eg, for the Real line (and approximations thereof), the sigma algebra generator set would be intervals (open or closed or clopen etc), because we can define the lesbegue/riemann measure on these to be the length ?

would this allow eg, talking about dirac delta as a measure/distribution?

@cscherrer
Copy link
Collaborator

Hi @cartazio ,

I really like this idea. Julia has a few different interval libraries:
https://github.com/JuliaIntervals

I like the ideas I've seen from @dpsanders , for example I this this package could be really helpful for this:
https://github.com/JuliaIntervals/IntervalContractors.jl

The big questions I have currently are

  • Are libraries that include intervals and operations on them generally compatible? Or would tightly coupling with one part of the interval ecosystem limit users wanting to use other parts of it?
  • Is there a good way to generalize this beyond embedding in R^n? Or is that the best approach?

@dpsanders
Copy link

This is a great idea.

Unfortunately there is not much compatibility right now.
You may want to use your own interval type (yet another one) and then provide interfaces to the different packages if necessary.

Note that anything beyond Lebesgue measure / Dirac delta is more complicated, since in general it will need an integral over a density to be involved.

@dpsanders
Copy link

Or (better?) to express everything in terms of the [cumulative] distribution function instead.

@dpsanders
Copy link

Beyond R^n you will probably want something like https://github.com/JuliaManifolds/Manifolds.jl and work with atlases somehow?

Or what context did you have in mind?

@cscherrer
Copy link
Collaborator

Unfortunately there is not much compatibility right now.
You may want to use your own interval type (yet another one) and then provide interfaces to the different packages if necessary.

Maybe IntervalSets? That seems intended for a use case like this.

Or (better?) to express everything in terms of the [cumulative] distribution function instead.

For one dimension, yes. I haven't thought much about how to do this in higher dimensions. I've seen people use copulas (or is it copulae?), but I haven't worked with them much.

Beyond R^n you will probably want something like https://github.com/JuliaManifolds/Manifolds.jl and work with atlases somehow?

Maybe that's the right way, I'm not sure.

Or what context did you have in mind?

Mostly I want to have something that covers the common cases and is easily extensible beyond this. So maybe nothing too opinionated beyond the core stuff

@dpsanders
Copy link

Maybe IntervalSets? That seems intended for a use case like this.

Yes, that's probably a good option since it can handle both closed and open sets, unlike IntervalArithmetic.jl.

Or (better?) to express everything in terms of the [cumulative] distribution function instead.

For one dimension, yes. I haven't thought much about how to do this in higher dimensions. I've seen people use copulas (or is it copulae?), but I haven't worked with them much.

Not my area, but looks interesting.

Beyond R^n you will probably want something like https://github.com/JuliaManifolds/Manifolds.jl and work with atlases somehow?

Maybe that's the right way, I'm not sure.

Or what context did you have in mind?

Mostly I want to have something that covers the common cases and is easily extensible beyond this. So maybe nothing too opinionated beyond the core stuff

Maybe you literally want a SigmaAlgebra type for finite unions (so I guess just an Algebra, though now I'm really struggling to remember my measure theory course from aeons ago).

@nignatiadis
Copy link
Contributor

That would be amazing! I had a similar use case and ended up hacking something together using intervals from the Intervals.jl package here. I liked that Intervals.jl has interval types parametrized by each endpoint being unbounded, open or closed.

Another package that could be relevant here is DomainSets.jl.

@mschauer
Copy link
Member

mschauer commented Feb 9, 2021

Allowing products of intervals should go a long way.

@cscherrer
Copy link
Collaborator

There are a couple of general challenges:

  • Adding a dependency sometimes brings lots of other dependencies of its own, which can mean slower precompilation and more fiddly version bounds.
  • Sometimes there are incompatibilities, so including one means excluding another.

At the same time, we obviously want lots of nice capabilities, so we need to try to find a good middle ground.

IntervalsSets has

help?> IntervalSets.Interval
  An Interval{L,R}(left, right) where L,R are :open or :closed is an
  interval set containg x such that

    1. left  x  right if L == R == :closed

    2. left < x  right if L == :open and R == :closed

    3. left  x < right if L == :closed and R == :open, or

    4. left < x < right if L == R == :open 

I also added InfiniteArrays.jl, mostly (for now) to use its nice definition of , so for example we can write Poisson ≪ CountingMeasure(ℤ[0:∞]) . I don't see that IntervalSets has half-lines. 0..∞ returns a value, but I haven't checked any of its properties to make sure it works as we'd expect.

@nignatiadis
Copy link
Contributor

nignatiadis commented Feb 9, 2021

Fully agree! I was previously using Intervals.jl here for exactly this reason, i.e., letting type information capture half-lines (for example Intervals.Interval{Int64, Closed, Unbounded}), but 0..∞ actually seems even better (assuming it has the right properties of course). At least the following works (although type information of Intervals.Interval is less ambiguous, especially regarding which side is unbounded):

julia> halfline = 0..0..∞
julia> typeof(halfline)
Interval{:closed,:closed,Union{InfiniteArrays.Infinity, Int64}}
julia> in(1, halfline)
true
julia> in(-2, halfline)
false

@nignatiadis
Copy link
Contributor

Following up on this as well (it's functionality I would love to have), i.e., to be able to call m(ℐ) where m::AbstractMeasure and ℐ::Interval. At least for probability measures, it would be possible to implement this given access to cdf and the density with respect to Dirac at interval end points (depending on whether an interval is open, closed etc). On the other hand this would depend on IntervalSets which would be an additional dependency. Would there be any scope for reincluding this package in MeasureTheory.jl?

(Related discussion in #130)

@cscherrer
Copy link
Collaborator

Thanks @nignatiadis . @oschulz and I were talking about this recently, and I think it's a good idea.

I think a full representation of sigma algebras will always be intractable (but I'd love to be wrong about this). But for a given measure, there's usually a coarse representation for which the measure can be evaluated easily and efficiently. For univariate continuous (Lebesgue-dominated) measures intervals are a good fit.

We could have something with finer granularity (disjoint sets of intervals, or interval trees) but that has a cost of heavier dependencies. But IntervalSets is very light, so that should be good. Happy to take a PR on this :)

@oschulz
Copy link
Collaborator

oschulz commented Aug 22, 2022

But IntervalSets is very light, so that should be good.

I agree, at least for univariate measures IntervalSets would be a good solution. And maybe a vector of intervals for powers of univariate measures?

@oschulz
Copy link
Collaborator

oschulz commented Aug 22, 2022

We definitely should add massof (good name, @cscherrer ?) to MeasureBase as a first step. Do we want massof(measure) to return the mass of the whole space, or should that be massof(measure, Omega) or so?

Oh, also - if we support truncation of measures (we should, where applicable), then getting the mass in a subspace could also be expressed as getting the mass of a truncated measure.

@cscherrer
Copy link
Collaborator

cscherrer commented Aug 22, 2022

Yes, we started some discussion of that here:
JuliaMath/DensityInterface.jl#8

I think we should prototype this for addition to MeasureBase. Let's discuss further here:
JuliaMath/MeasureBase.jl#82

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

No branches or pull requests

6 participants