JuliaMath / DensityInterface.jl

Interface for mathematical/statistical densities in Julia
Other
12 stars 3 forks source link

API for objects that support rand? #16

Open oschulz opened 1 year ago

oschulz commented 1 year ago

In relation to the discussion on DiffEqBase and QuasiMonteCarlo in JuliaStats/Distributions.jl#1139 - should have a trait based API for (density-like) objects that support IID sampling, i.e. that support rand (and possibly rand! as well)? This could be part of DensityInterface or it could go into a separate package, but it might be nice to have a community-standard way to ask something "do you support rand?", or maybe even "what do you produce on rand?".

CC @ChrisRackauckas , @devmotion

devmotion commented 1 year ago

Haven't thought much about it yet, but my initial feeling is that this is a bit orthogonal to the density aspect. Maybe it would be better to add traits (if needed/useful) to Random or RandomExtensions?

oschulz commented 1 year ago

orthogonal to the density aspect

I agree. Adding it to Random would take time though, and we'd have to have the API "perfect" from the get-go because it would be frozen immediately. Maybe a separate package?

devmotion commented 1 year ago

IIRC RandomExtensions was supposed to be some experimental "playground" for Random?

oschulz commented 1 year ago

Oh, completely overlooked RandomExtensions, lol. Maybe that ties into https://github.com/JuliaStats/Distributions.jl/issues/1139 as well?