@@ -53,6 +53,7 @@ We'll use some time artificial data:::
5353 hare_data = np.array([
5454 30.0, 47.2, 70.2, 77.4, 36.3, 20.6, 18.1, 21.4, 22.0, 25.4,
5555 27.1, 40.3, 57.0, 76.6, 52.3, 19.5, 11.2, 7.6, 14.6, 16.2, 24.7
56+ ])
5657
5758We also define a function for the right-hand-side of the ODE:::
5859
@@ -138,12 +139,12 @@ We are only missing the likelihood now::
138139 with model:
139140 # We can access the individual variables of the solution using the
140141 # variable names.
141- pm.Deterministic('hares_mu', y_hat ['hares'])
142- pm.Deterministic('lynx_mu ', y_hat['lynx '])
142+ pm.Deterministic('hares_mu', solution ['hares'])
143+ pm.Deterministic('lynxes_mu ', solution['lynxes '])
143144
144145 sd = pm.HalfNormal('sd')
145- pm.Lognormal('hares', mu=y_hat ['hares'], sd=sd, observed=hare_data)
146- pm.Lognormal('lynx ', mu=y_hat['lynx '], sd=sd, observed=lynx_data)
146+ pm.Lognormal('hares', mu=solution ['hares'], sd=sd, observed=hare_data)
147+ pm.Lognormal('lynxes ', mu=solution['lynxes '], sd=sd, observed=lynx_data)
147148
148149We can sample from the posterior with the gradient-based PyMC3 samplers:::
149150
0 commit comments