On Wed, Jan 18, 2017 at 4:30 PM, <josef.p...@gmail.com> wrote:

> Having more sampling schemes would be useful, but it's not possible to
>> implement sampling schemes with impossible properties.
> BTW: sampling 3 out of 3 without replacement is even worse
> No matter what sampling scheme and what selection probabilities we use, we
> always have every element with probability 1 in the sample.

I agree. The random-sample function of the type I envisioned will be able
to reproduce the desired probabilities in some cases (like the example I
gave) but not in others. Because doing this correctly involves a set of n
linear equations in comb(n,k) variables, it can have no solution, or many
solutions, depending on the n and k, and the desired probabilities. A
function of this sort could return an error if it can't achieve the desired

But in many cases (the 0.2, 0.4, 0.4 example I gave was just something
random I tried) there will be a way to achieve exactly the desired

I guess I'll need to write this new function myself :-) Because my use case
definitely requires that the output of the random items produced matches
the required probabilities (when possible).

NumPy-Discussion mailing list

Reply via email to