forked from fonnesbeck/pymc_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobs.py
More file actions
37 lines (26 loc) · 664 Bytes
/
obs.py
File metadata and controls
37 lines (26 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Import the mean and covariance
from mean import M
from cov import C
from pymc.gp import *
from numpy import *
# Impose observations on the GP
o = array([-.5,.5])
V = array([.002,.002])
data = array([3.1, 2.9])
observe(M, C, obs_mesh=o, obs_V = V, obs_vals = data)
# Generate realizations
f_list=[Realization(M, C) for i in range(3)]
x=arange(-1.,1.,.01)
#### - Plot - ####
if __name__ == '__main__':
from pylab import *
x=arange(-1.,1.,.01)
clf()
plot_envelope(M, C, mesh=x)
for f in f_list:
plot(x, f(x))
xlabel('x')
ylabel('f(x)')
title('Three realizations of the observed GP')
axis('tight')
# show()