chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.77k stars 417 forks source link

Sampling from a probability distribution #9806

Open hmedal opened 6 years ago

hmedal commented 6 years ago

What I would like: To be able to do draw a number (or a sample) from a probability distribution (real or integer, depending on the distribution).

What it should look like:

proc getRandomFromDistributionX(params : real){
//returns a random value from "DistributionX", given "params", which is the parameters of that distribution
}

proc getRandomSampleFromDistributionX(params : real, n : int){
//returns a random sample from "DistributionX", given "params", which is the parameters of that distribution and "n" which is the sample size
}

Example:

var params = [2.0]; //mean of the Poisson distribution is 2.0
var randomValue = getRandomFromPoisson(params); //a random draw from the Poisson distribution
var randomSample = getRandomSampleFromPoisson(params, 10); //a random sample of size 10 from the Poisson distribution

Use case: For random graph generation in which we are randomly generating the degree sequence of the vertices in the graph.

bradcray commented 5 years ago

@ben-albrecht, do you own this issue?

ben-albrecht commented 5 years ago

Not necessarily, but this feature may be dependent on #9805, which I consider myself to own.