-
Notifications
You must be signed in to change notification settings - Fork 32
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
analytical form for convolution and bind of two Normal distributions #226
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #226 +/- ##
==========================================
+ Coverage 44.60% 44.98% +0.37%
==========================================
Files 42 44 +2
Lines 1307 1325 +18
==========================================
+ Hits 583 596 +13
- Misses 724 729 +5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Thanks @nignatiadis ! I see how the result in the normal case is equivalent to a convolution, but more generally I think There's a nice overview here. Eventually (though not necessarily this PR, unless you want to) we should have all of the examples in that article as unit tests :) |
Yes exactly! A lot of my research is about such compound distributions. I plan to add a few more to this PR (though not all in the Wikipedia list). |
Also, I had never heard the term In my papers I typically just call it the marginal distribution (where marginal refers to the fact, that we start with a joint distribution on (X,Y), with samples generated as: X~μ, Y~k(X), for a measure μ and a kernel k) but then are only interested in the marginal of Y. [Calling this a marginal distribution in this package would cause ambiguity.] |
Some background on In functional programming, a monad is a type constructor
Monads are also required to satisfy the "monad laws":
For us,
|
This package also aims at a very similar task: https://github.com/filtron/MarkovKernels.jl |
Good find! That looks very useful |
Hello. Can I be of assistance somehow? |
I think you can be witness to us appreciating your package and possibly figure out if there is some problem we share |
Pardon my late reply. I am quite new to Julia so encouragement + feedback is much appreciated. Regarding discussing issues we might share, I feel like I am missing some context. We are both interested in convolving Normal distributions but it is not clear to me what the issue is beyond that? |
@filtron: Thank you for your response! I was very excited to see your MarkovKernels.jl package; thanks for writing it! Here's the reason I initially tagged your package in this thread: |
I would be happy to help get any desired functionality from MarkovKernels.jl into MeasureTheory.jl. I suppose concretely what we are talking about is the concepts I call |
If you want, have a look https://arxiv.org/abs/2010.03509. We also end up with such primitives which describe Bayesian inference in tree models (you can formulate a state space model this way too): Pullbacks of likelihoods for example the fusion step of the Kalman-filter is a form of step (1). With that you add tilting kernels with likelihoods and marginalisation Together (1), (2) and (3) allow you to describe an RTS type smoother made of a backward filter with fusion step (1) and a forward smoother (2). |
I have been meaning to get back to you on this. Please don't mistake my tardiness for disinterest. Doing inference on trees by means of the h-transform is indeed an interesting development. However, not to come off as pedantic, but in my mind there are three ways of doing inference in partially observed Markov processes namely,
Formally, these alternatives produce the same output. However, algorithmically they are quite different to me and offer different avenues for developing approximate inference methods. The above looks more like alternative 3 to me (I guess 1 & 2 would also have tree analogues). In any case, I would like to re-iterate that I would be pleased to collaborate. |
Hi Chad,
I am following up here on our discussion from Zulip. I followed your advice therein. Let me explain a couple more points of this PR:
It defines
convolve
as a new combinator. The reason is that for this problem, the Normal->Normal bind is really just the convolution of two normals.In Zulip you suggested using
mean(d)
, andstd(d)
to make the code more generic. Currently these would throw a method error, so I had to add some code for the calculation ofmean
andstd
forAffine
(ly transformed) measures.Compared to the Zulip discussion, I also added code to dispatch when σ (of the Normal kernel) is fixed, but possibly unequal to 1. This relates to a conversation we had a while ago about constraints in kernels/likelihoods.
One possible concern (though not a concern for my use case) is the following:
Let me know what you think!