sample_points {volesti} | R Documentation |
Sample N points with uniform or multidimensional spherical gaussian -centered in an internal point- target distribution. The d-dimensional unit simplex is the set of points \vec{x}\in \R^d, s.t.: ∑_i x_i≤q 1, x_i≥q 0. The d-dimensional canonical simplex is the set of points \vec{x}\in \R^d, s.t.: ∑_i x_i = 1, x_i≥q 0.
sample_points(P = NULL, N = NULL, distribution = NULL, WalkType = NULL, walk_step = NULL, exact = NULL, body = NULL, Parameters = NULL, InnerPoint = NULL)
P |
A convex polytope. It is an object from class (a) Hpolytope or (b) Vpolytope or (c) Zonotope. |
N |
The number of points that the function is going to sample from the convex polytope. The default value is 100. |
distribution |
Optional. A string that declares the target distribution: a) |
WalkType |
Optional. A string that declares the random walk method: a) |
walk_step |
Optional. The number of the steps for the random walk. The default value is \lfloor 10 + d/10\rfloor, where d implies the dimension of the polytope. |
exact |
A boolean parameter. It should be used for the uniform sampling from the boundary or the interior of a hypersphere centered at the origin or from the unit or the canonical or an arbitrary simplex. The arbitrary simplex has to be given as a V-polytope. For the rest well known convex bodies the dimension has to be declared and the type of body as well as the radius of the hypersphere. |
body |
A string that declares the type of the body for the exact sampling: a) |
Parameters |
A list for the parameters of the methods:
|
InnerPoint |
A d-dimensional numerical vector that defines a point in the interior of polytope P. |
A d\times N matrix that contains, column-wise, the sampled points from the convex polytope P.
R.Y. Rubinstein and B. Melamed, “Modern simulation and modeling” Wiley Series in Probability and Statistics, 1998.
A Smith, Noah and W Tromble, Roy, “Sampling Uniformly from the Unit Simplex,” Center for Language and Speech Processing Johns Hopkins University, 2004.
Art B. Owen, “Monte Carlo theory, methods and examples,” Art Owen, 2009.
# uniform distribution from the 3d unit cube in V-representation using ball walk P = GenCube(3, 'V') points = sample_points(P, WalkType = "BW", walk_step = 5) # gaussian distribution from the 2d unit simplex in H-representation with variance = 2 A = matrix(c(-1,0,0,-1,1,1), ncol=2, nrow=3, byrow=TRUE) b = c(0,0,1) P = Hpolytope$new(A,b) points = sample_points(P, distribution = "gaussian", Parameters = list("variance" = 2)) # uniform points from the boundary of a 10-dimensional hypersphere points = sample_points(exact = TRUE, body = "hypersphere", Parameters = list("dimension" = 10)) # 10000 uniform points from a 2-d arbitrary simplex V = matrix(c(2,3,-1,7,0,0),ncol = 2, nrow = 3, byrow = TRUE) P = Vpolytope$new(V) points = sample_points(P, N = 10000, exact = TRUE)