Exemplo n.º 1
0
def test_gp_predict_matern52():
    X = np.arange(-2, 2, .01)[:, np.newaxis]
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 200)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape)

    gp = GaussianProcess(1, max_iter=10, kernel='matern52')
    gp.fit(X, Z)
    print gp.predict(X)
Exemplo n.º 2
0
def test_gp_predict_matern52():
    X = np.arange(-2, 2, .01)[:, np.newaxis].astype(theano.config.floatX)
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 200)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape)

    gp = GaussianProcess(1, max_iter=10, kernel='matern52')
    gp.fit(X, Z)
    print gp.predict(X)
Exemplo n.º 3
0
def test_gp_sample_parameters():
    X = np.arange(-2, 2, .01)[:, np.newaxis]
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 20)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape)

    gp = GaussianProcess(1, max_iter=1, kernel='linear')
    gp.store_dataset(X, Z)
    gp.sample_parameters()
    print gp.predict(X, True)
Exemplo n.º 4
0
def test_gp_sample_parameters():
    X = np.arange(-2, 2, .01)[:, np.newaxis].astype(theano.config.floatX)
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 20)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape).astype(theano.config.floatX)

    gp = GaussianProcess(1, max_iter=1, kernel='ardse')
    gp.store_dataset(X, Z)
    gp.sample_parameters()
    print gp.predict(X, True)
Exemplo n.º 5
0
def test_gp_predict_linear():
    raise SkipTest()
    X = np.arange(-2, 2, .01)[:, np.newaxis].astype(theano.config.floatX)
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 200)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape)

    gp = GaussianProcess(1, max_iter=1, kernel='linear')
    gp.fit(X, Z)
    print gp.predict(X)
Exemplo n.º 6
0
def test_gp_predict_matern52():
    X = np.arange(-2, 2, .1)[:, np.newaxis].astype(theano.config.floatX)
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 20)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape)
    X, Z = theano_floatx(X, Z)

    gp = GaussianProcess(1, max_iter=10, kernel='matern52')
    gp.fit(X, Z)
    print gp.predict(X)
Exemplo n.º 7
0
def test_gp_predict_linear():
    raise SkipTest()
    X = np.arange(-2, 2, .01)[:, np.newaxis].astype(theano.config.floatX)
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 200)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape)
    X, Z = theano_floatx(X, Z)

    gp = GaussianProcess(1, max_iter=1, kernel='linear')
    gp.fit(X, Z)
    print gp.predict(X)
Exemplo n.º 8
0
def test_gp_sample_parameters():
    X = np.arange(-2, 2, .1)[:, np.newaxis].astype(theano.config.floatX)
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 10)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape).astype(theano.config.floatX)
    X, Z = theano_floatx(X, Z)

    gp = GaussianProcess(1, max_iter=1, kernel='ardse')
    gp.store_dataset(X, Z)
    gp.sample_parameters()
    print gp.predict(X, True)
Exemplo n.º 9
0
def test_gp_predict_maxrows():
    X = np.arange(-2, 2, .01)[:, np.newaxis]
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 6)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape)

    gp = GaussianProcess(1, max_iter=10, kernel='matern52')
    gp.fit(X, Z)
    Y = gp.predict(X)
    Y2 = gp.predict(X, max_rows=2)

    assert np.allclose(Y, Y2)
Exemplo n.º 10
0
def test_gp_predict_maxrows():
    X = np.arange(-2, 2, .01)[:, np.newaxis].astype(theano.config.floatX)
    idxs = range(X.shape[0])
    idxs = random.sample(idxs, 6)
    X = X[idxs]
    Z = np.sin(X)
    Z += np.random.normal(0, 1e-1, X.shape).astype(theano.config.floatX)

    gp = GaussianProcess(1, max_iter=10, kernel='matern52')
    gp.fit(X, Z)
    Y = gp.predict(X)
    Y2 = gp.predict(X, max_rows=2)

    assert np.allclose(Y, Y2)