mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
Fixed MCMC sampler.
This commit is contained in:
parent
f60abf7262
commit
d3730bb518
4 changed files with 61 additions and 18 deletions
36
ib_tests/test_regression.py
Normal file
36
ib_tests/test_regression.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
"""
|
||||
Test the regression we get with the new transformations.
|
||||
|
||||
Author:
|
||||
Ilias Bilionis
|
||||
|
||||
Date:
|
||||
3/8/2015
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
import os
|
||||
# Make sure we load the GP that is here
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
import GPy
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import triangle
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
m = GPy.examples.regression.olympic_marathon_men(optimize=True)
|
||||
plt.show(block=True)
|
||||
print m
|
||||
mcmc = GPy.inference.mcmc.samplers.Metropolis_Hastings(m)
|
||||
mcmc.sample(Ntotal=100000, Nburn=10000, Nthin=100, tune_interval=1000, tune_throughout=True)
|
||||
samples = np.array(mcmc.chains[-1])
|
||||
fig = triangle.corner(samples)
|
||||
m.plot()
|
||||
fig = plt.figure()
|
||||
for i in xrange(samples.shape[1]):
|
||||
ax = fig.add_subplot(samples.shape[1], 1, i + 1)
|
||||
ax.plot(samples[:, i], linewidth=1.5)
|
||||
plt.show(block=True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue