jeudi 21 janvier 2021

Generate discrete probability distribution from constraints

Given:

  • a discrete probability distribution over n-bit integers represented as a list ys of floats (i.e. sum(ys) == 1)
  • a parameter eps such that 0 < eps < 0.5

I want to generate a new probability distribution over n-bit integers, xs, such that the following holds:

(1) (forall) i in range(0, 2**n): 
    (1 - eps) <= xs[i] / ys[i] <= (1 + eps)

(2) sum(xs) == 1

My (naive) starting point is this:

for i in range(2**n):
    xs[i] = uniform(ys[i] * (1 - eps), ys[i] * (1 + eps))

but obviously sum(xs) may not be 1.


It seems to me that there should be a way to generate such a list where both constraints are met. Am I missing something fundamental here?




Aucun commentaire:

Enregistrer un commentaire