Exemple #1
0
def init_latin(bounds, n=None, rng=None):
    """
    Initialize using a Latin hypercube design of size `n`. If `n` is `None`
    then use 3D points where D is the dimensionality of the input space.
    """
    n = 3*len(bounds) if (n is None) else n
    X = random.latin(bounds, n, rng)
    return X
Exemple #2
0
def init_latin(bounds, n=None, rng=None):
    """
    Initialize using a Latin hypercube design of size `n`. If `n` is `None`
    then use 3D points where D is the dimensionality of the input space.
    """
    n = 3 * len(bounds) if (n is None) else n
    X = random.latin(bounds, n, rng)
    return X
Exemple #3
0
    def __init__(self, bounds, gp, N=None, rng=None):
        self.bounds = np.array(bounds, dtype=float, ndmin=2)
        self._gp = gp.copy()
        self._rng = random.rstate(rng)

        # generate some sampled observations.
        N = N if (N is not None) else 100 * len(self.bounds)
        X = random.latin(bounds, N, self._rng)
        y = self._gp.sample(X, latent=False, rng=self._rng)

        # add them back to get a new "posterior".
        self._gp.add_data(X, y)