Uniform sampling draws points so that equal-size regions of a domain have equal probability. In optimization, random search samples candidate evaluations uniformly within the objective domain, without favoring any region in advance. section 1.2.4
Sampling supports several practical activities:
- Explore an objective function when evaluations are limited, while recognizing that random points can cluster and waste evaluations. section 1.2.4
- Compare random search with grid search: grids spread evaluations evenly, while random sampling may discover useful regions without a fixed layout. section 1.2.4
- Draw function realizations from a Gaussian-process predictive distribution to visualize possible behaviors beyond its mean and confidence interval. section 2.4.4
Sampling an optimization domain
Suppose an objective is evaluated at most 10 times over [-5, 5]. Random search samples locations uniformly and evaluates the objective there; one run finds a point near x = 4 with value 3.38. A different run could cluster elsewhere, so uniform sampling may spend resources in an unpromising region. section 1.2.4
torch.manual_seed(0)
samples = predictive_distribution.sample(torch.Size([5]))
Reproduce five GP function samples with a fixed random seed using the predictive distribution's sample method. section 2.4.4






















