Modifying ODE Lotka-Volterra With Bayesian Inference tutorial example

Hi all,

I am familiarizing myself with PyMC by modifying the excellent example ODE Lotka-Volterra With Bayesian Inference in Multiple Ways.

The example uses observations of both state vector components x and y (or lynxs and hares). I would like to run the example with only observations for x and not for y. However, no matter what I try, I cannot get the example to run like that.

As the example is a bit lengthy, I’m not exactly sure how much details I should post here. Things I tried:

  • simply slicing the matrices, like
pm.Normal("Y_obs", mu=ode_solution[:, 0], sigma=sigma, observed=data[["hare"]].values)`
  • changing the pytensor wrapper like
@as_op(itypes=[pt.dvector], otypes=[pt.dvector])
def pytensor_forward_model_matrix(theta):
    return odeint(func=rhs, y0=theta[-2:], t=data.year, args=(theta,))[:, 0]
  • creating a new pytensor object for the observation data like
y_obs_pt = pytensor.shared(y_obs[:, 0])`

I guess I’m just not familiar enough with how to use pytensor.

I would be very happy about any suggestions of what else I could try.

Thank you in advance!