vendredi 4 décembre 2020

Sample uniformly at random from a simplex in Python

I want to uniformly sample from a simplex in python. I found the following in R but nothing so far in python

 runif_in_simplex(n, simplex)

EDIT: Is the following solution correct?

  1. generate N random numbers (N = no of vertices of simplex)
  2. Normalize these N numbers (divide by sum)
  3. Form the linear combination of N numbers and Vertice's coordinates.



Aucun commentaire:

Enregistrer un commentaire