3
$\begingroup$

I would like to uniformly generate weights for n different objects. I understand this is the same as sampling from the Dirichlet distribution with alpha = 1 or sampling uniformly from the standard n-simplex which i can do in the same way as covered here: Generate uniformly distributed weights that sum to unity?

If I wanted to add further constraints, such as maximums and minimums for each weight, is there a way I can do this without repeatedly sampling until the values fall within my constraints?

$\endgroup$
1
$\begingroup$

You need to sample your weights from Dirichlet distribution and then simply transform them, by taking $x' = a + x \cdot (b - a)$, where $a$ is the new minimum and $b$ is the new maximum. Now your $x'$ values have $(a, b)$ bounds instead of $(0,1)$.

However if you really want to use those values as weights, then in most applications this should not have any effect on your results as most weighting schemes use weighting that is proportional to the weights.

$\endgroup$
1
  • $\begingroup$ This solution looks like it is not a distribution defined on the simplex. $\endgroup$
    – whuber
    Dec 10 '20 at 21:36

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .