Samplers

High Level Interface

class psdr.Sampler(fun, X=None, fX=None)[source]

Generic sampler interface

Parameters:
  • fun (Function) – Function for which to preform a design of experiments
  • X (array-like (?,m)) – Existing samples from the domain
  • fX (array-like (?,nfun)) – Existing evaluations of the function at the points in X
X

Samples from the function’s domain

fX

Outputs from the function corresponding to samples X

sample(draw=1, verbose=False)[source]

Sample the function

Parameters:draw (int, default 1) – Number of samples to take
sample_async(draw=1)[source]

Sample the function asynchronously updating the search parameters

Parameters:draw (int, default 1) – Number of samples to take
class psdr.SequentialMaximinSampler(fun, L=None, X=None, fX=None)[source]

Sequential maximin sampling with a fixed metric

Given a distance metric provided by \(\mathbf{L}\), construct a sequence of samples \(\widehat{\mathbf{x}}_i\) that are local solutions to

\[\widehat{\mathbf{x}}_j = \arg\max_{\mathbf{x} \in \mathcal{D}} \min_{i=1,\ldots,j} \|\mathbf{L}(\mathbf{x} - \widehat{\mathbf{x}}_i)\|_2.\]
Parameters:
  • fun (Function) – Function for which to preform a design of experiments
  • L (array-like (?, m)) – Matrix defining the metric
  • X (array-like (?,m)) – Existing samples from the domain
  • fX (array-like (?,nfun)) – Existing evaluations of the function at the points in X

Low Level Functions

psdr.seq_maximin_sample(domain, Xhat, Ls=None, Nsamp=1000, X0=None, slack=0.9)[source]

A multi-objective sequential maximin sampling

Given an existing set of samples \(\lbrace \widehat{\mathbf{x}}_j\rbrace_{j=1}^M\subset \mathcal{D}\) from the domain \(\mathcal{D} \subset \mathbb{R}^m\), this algorithm finds a point \(\mathbf{x} \in \mathcal{D}\) that approximately maximizes the distance of the new point to all other points in multiple distance metrics give by matrices \(\mathbf{L}_i \in \mathbb{R}^{m\times m}\)

\[\max_{\mathbf{x} \in \mathcal{D}} \left\lbrace \min_{j=1,\ldots,M} \|\mathbf{L}_i (\mathbf{x} - \widehat{\mathbf{x}}_j)\|_2 \right\rbrace_{i}\]

This algorithm uses psdr.voronoi_vertex() to generate local maximizers of this problem for each metric and then tries to greedily satisfy the distance requirements for each metric.

A typical use case will have Ls that are of size (1,m) This greedy sequential approach for constructing a maximin design is the Coffee-House Designs of Muller [Mul01]. However, the approach of Muller allows for a generic nonlinear solve for each sample point. Here though we restrict the domain to a polytope specified by linear inequalities so we can invoke psdr.voronoi_vertex() to solve each step.

Parameters:
  • domain (Domain) – The domain from which we will be sampling
  • Xhat (array-like (M, m)) – Previously existing samples from the domain
  • Ls (list of array-like (?, m) matrices, optional) – The weight matrix (e.g., Lipschitz matrix) corresponding to each metric; defaults to the identity matrix
  • Nsamp (int, optional (default 1000)) – Number of samples to use when finding Voronoi vertices
  • slack (float [0,1], optional (default 0.1)) – Rather than taking the point that maximizes the product of the distances in each metric, we choose the point x with greatest unweighted Euclidean distance from those candidates that are at least slack times the score of the best.

References

[Mul01]Coffee-House Designs. Werner G. Muller in Optimimum Design 2000, A. Atkinson et al. eds., 2001
psdr.fill_distance_estimate(domain, Xhat, L=None, Nsamp=1000, X0=None)[source]

Estimate the fill distance of the points Xhat in the domain

The fill distance (Def. 1.4 of [Wen04]) or dispersion [LC05] is the furthest distance between any point \(\mathbf{x} \in \mathcal{D}\) and a set of points \(\lbrace \widehat{\mathbf{x}}_j \rbrace_{j=1}^m \subset \mathcal{D}\):

\[\sup_{\mathbf{x} \in \mathcal{D}} \min_{j=1,\ldots,M} \|\mathbf{L}(\mathbf{x} - \widehat{\mathbf{x}}_j)\|_2.\]

Similar to psdr.seq_maximin_sample(), this uses psdr.voronoi_vertex() to find a subset of local maximizers and returns the best of these.

Parameters:
  • domain (Domain) – Domain on which to compute the dispersion
  • Xhat (array-like (?, m)) – Existing samples on the domain
  • L (array-like (?, m) optional) – Matrix defining the distance metric on the domain
  • Nsamp (int, default 1e4) – Number of samples to use for vertex sampling
  • X0 (array-like (?, m)) – Samples from the domain to use in psdr.voronoi_vertex()
Returns:

d – Fill distance lower bound

Return type:

float

References

[Wen04]Scattered Data Approximation. Holger Wendland. Cambridge University Press, 2004. https://doi.org/10.1017/CBO9780511617539
[LC05]Iteratively Locating Voronoi Vertices for Dispersion Estimation Stephen R. Lindemann and Peng Cheng Proceedings of the 2005 Interational Conference on Robotics and Automation