Skip to content

Instantly share code, notes, and snippets.

@beckdaniel
Last active March 2, 2016 19:38
Show Gist options
  • Save beckdaniel/6a526a67714fe93331db to your computer and use it in GitHub Desktop.
Save beckdaniel/6a526a67714fe93331db to your computer and use it in GitHub Desktop.
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
m_gpy = GPy.models.GPRegression(X, Y)
m_gpy.optimize()
# GPflow
m_gpflow = GPflow.gpr.GPR(X, Y, GPflow.kernels.RBF(2))
m_gpflow.optimize()
print m_gpy
print m_gpflow
########################
# Expected Output
"""
(optimization...)
optimization terminated, setting model state
-1372.99859855
Name : GP regression
Objective : 1372.99859855
Number of Parameters : 3
Number of Optimization Parameters : 3
Updates : True
Parameters:
GP_regression. | value | constraints | priors
rbf.variance | 0.00171168915388 | +ve |
rbf.lengthscale | 109.006106489 | +ve |
Gaussian_noise.variance | 0.911268070608 | +ve |
model.likelihood.variance transform:+ve prior:None
[ 0.91126679]
model.kern.variance transform:+ve prior:None
[ 0.00171146]
model.kern.lengthscales transform:+ve prior:None
[ 108.981745]
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment