Either "too many indices for array" or "array must not contain infs or NaNs" error with a GP

Doc says X needs to be a column vector. I guess both x and y need to be column vector?

The first piece of code in the doc doesn’t actually work. The code didnt’ define variable y.

Fix for 1st error:

import numpy as np
import pymc3 as pm

x = y = np.arange(150)[:, None]

with pm.Model():
    a = pm.gp.cov.Periodic(1, 2, 3)
    b = pm.gp.Marginal(cov_func=a)
    b.marginal_likelihood(
        "y", X=x, y=y, noise=3)

But that doesn’t fix the 2nd error.

1 Like