Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import GPy as gp
X = np.random.uniform(-3.,3.,(2000,17))
Y = np.sin(X) + np.random.randn(2000,17)*0.05
kernel = gp.kern.rbf(D=17, variance=1., lengthscale=1.)
m = gp.models.GP_regression(X,Y,kernel,normalize_X=True,normalize_Y=True)
m.constrain_positive('')
m.optimize()
danielb@elgon:~/Research/Datasets/QE$ head -1 eamt11/fr-en/feats_17.tsv
13.0 15.0 4.38461538462 -31.6027 -34.8847 0.8 310.461538462 1185.38461538 0.153846153846 15632.0 0.166666666667 16934.6666667 0.181818181818 18474.1818182 1.0 0.0769230769231 0.0666666666667
danielb@elgon:~/Research/Datasets/QE$ head -1 wptp-12_daniel/qe_17
19.0 17.0 4.4210525 -43.948 -39.2668 1.0 144.0 0.04820285 0.0 0.7894737 0.0 0.5 0.0 0.23529412 0.8947368 2.0 2.0
@beckdaniel
beckdaniel / parallel_opt_bug
Created November 30, 2015 16:13
Bug in optimize_restarts
Python 2.7.10 |Anaconda 2.4.0 (64-bit)| (default, Oct 19 2015, 18:04:42)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import numpy as np
import numpy as np
import GPy
from sklearn.svm import SVR
import sys
import memory_profiler as mprof
model = sys.argv[1]
feats = np.random.random(size=(100,10))
labels = np.random.random(size=(100,1))
@beckdaniel
beckdaniel / gpflow_vs_gpy.py
Created February 26, 2016 13:02
GPflow vs. GPy
import GPy
import GPflow
import numpy as np
rng = np.random.RandomState(0)
X = rng.randn(100,2)
Y = rng.randn(100,1)
Xtest = rng.randn(10,2)
# GPy
import GPy
import GPflow
import numpy as np
rng = np.random.RandomState(0)
X = rng.randn(1000,2)
Y = rng.randn(1000,1)
Xtest = rng.randn(10,2)
# GPy