GaussianDistributions.jl icon indicating copy to clipboard operation
GaussianDistributions.jl copied to clipboard

Should Gaussian really be iterable?

Open fredcallaway opened this issue 3 years ago • 5 comments

I ran into a nasty bug just now trying to do quantile(P, 0.9). This runs without error (returning the mean for a univariate at least) but is obviously not what I intended.

I think it would make more sense if Gaussians were treated as quasi-scalars (as distributions are in Distributions.jl). This would also make broadcasting easy, e.g pdf.(P, -3:.01:3).

fredcallaway avatar May 09 '22 22:05 fredcallaway

👍, but IIRC it's to support (m, sig) = some_gaussian. Could be changed to (m, sig) = params(some_gaussian)...

cstjean avatar May 12 '22 02:05 cstjean

As of Julia 1.7, you can also do (;μ, Σ) = some_gaussian with parameter unpacking.

fredcallaway avatar May 12 '22 03:05 fredcallaway

Oh, let’s go for that!

mschauer avatar May 12 '22 07:05 mschauer

Shall I make a pull request or would you like to implement it?

fredcallaway avatar May 12 '22 12:05 fredcallaway

Please do make a PR if you would like!

mschauer avatar May 12 '22 14:05 mschauer