Example #1
0
# display data
a = input('Do you want to display test data ? ')
if a == 'y':
    print 'X: ', XT
    print 'y: ', y

# initialize the kernel 
kernel_test = RBFBoolS(length_scale = [2, 2, 2, 2, 2, 2, 2], length_scale_bounds = [0.1, 10])

print 'after kernel init'

# train the model
gp_test = GaussianProcessRegressor(kernel=kernel_test, alpha=0.1, normalize_y=True)

print 'after GP regressor'
gp_test.InitKernel()
print("GPML kernel: %s" % gp_test.kernel_)
print("Log-marginal-likelihood: %.3f"
       % gp_test.log_marginal_likelihood_data(XT, y))

gp_test.fit(XT, y)

print("GPML kernel: %s" % gp_test.kernel_)
print("Log-marginal-likelihood: %.3f"
      % gp_test.log_marginal_likelihood(gp_test.kernel_.theta))
print("GPML kernel: %s" % gp_test.kernel_)
print("Log-marginal-likelihood: %.3f"
       % gp_test.log_marginal_likelihood_data(XT, y))


start_time = time()