@@ -42,6 +42,7 @@ def logprob(weights, inputs, targets):
42
42
43
43
44
44
def build_toy_dataset (n_data = 100 , noise_std = 0.1 , toy_example = 'blackbox' ):
45
+ print (toy_example )
45
46
if toy_example == "blackbox" :
46
47
D = 1
47
48
rs = npr .RandomState (0 )
@@ -51,7 +52,7 @@ def build_toy_dataset(n_data=100, noise_std=0.1, toy_example='blackbox'):
51
52
inputs = (inputs - 4.0 ) / 4.0
52
53
inputs = inputs .reshape ((len (inputs ), D ))
53
54
targets = targets .reshape ((len (targets ), D ))
54
- elif toy_example == "wierstra " :
55
+ if toy_example == "Wierstra " :
55
56
noise_std = 0.02
56
57
inputs = np .linspace (0 , 0.5 , n_data ).reshape (- 1 ,1 )
57
58
n_traces = 1
@@ -71,7 +72,7 @@ def build_toy_dataset(n_data=100, noise_std=0.1, toy_example='blackbox'):
71
72
72
73
if __name__ == '__main__' :
73
74
74
- toy_example = "blackbox " # blackbox or Wierstra
75
+ toy_example = "Wierstra " # blackbox or Wierstra
75
76
76
77
# Specify inference problem by its unnormalized log-posterior.
77
78
rbf = lambda x : np .exp (- x ** 2 )
@@ -106,7 +107,7 @@ def callback(params, t, g):
106
107
if toy_example == "blackbox" :
107
108
plot_inputs = np .linspace (- 8 , 8 , num = 400 )
108
109
y_lim = [- 2 , 3 ]
109
- elif toy_example == "wierstra " :
110
+ elif toy_example == "Wierstra " :
110
111
plot_inputs = np .linspace (- 0.2 , 1.2 , num = 400 )
111
112
y_lim = [- 0.6 , 1.2 ]
112
113
@@ -115,6 +116,7 @@ def callback(params, t, g):
115
116
116
117
# Plot data and functions.
117
118
plt .cla ()
119
+ plt .title (toy_example )
118
120
ax .plot (inputs .ravel (), targets .ravel (), 'bx' )
119
121
ax .plot (plot_inputs , outputs [:, :, 0 ].T )
120
122
ax .set_ylim (y_lim )
0 commit comments