pymc.gp.LatentKron#
- class pymc.gp.LatentKron(*, mean_func=<pymc.gp.mean.Zero object>, cov_funcs=<pymc.gp.cov.Constant object>)[source]#
Latent Gaussian process whose covariance is a tensor product kernel.
The gp.LatentKron class is a direct implementation of a GP with a Kronecker structured covariance, without reference to any noise or specific likelihood. The GP is constructed with the prior method, and the conditional GP over new input locations is constructed with the conditional method. For more information on these methods, see their docstrings. This GP implementation can be used to model a Gaussian process whose inputs cover evenly spaced grids on more than one dimension. LatentKron relies on the KroneckerNormal distribution, see its docstring for more information.
- Parameters:
- mean_func
Mean
, defaultZero
The mean function.
- cov_funcs
list
ofCovariance
, default [Constant
] The covariance functions that compose the tensor (Kronecker) product.
- mean_func
Examples
# One dimensional column vectors of inputs X1 = np.linspace(0, 1, 10)[:, None] X2 = np.linspace(0, 2, 5)[:, None] Xs = [X1, X2] with pm.Model() as model: # Specify the covariance functions for each Xi cov_func1 = pm.gp.cov.ExpQuad(1, ls=0.1) # Must accept X1 without error cov_func2 = pm.gp.cov.ExpQuad(1, ls=0.3) # Must accept X2 without error # Specify the GP. The default mean function is `Zero`. gp = pm.gp.LatentKron(cov_funcs=[cov_func1, cov_func2]) # ... # After fitting or sampling, specify the distribution # at new points with .conditional # Xnew need not be on a full grid Xnew1 = np.linspace(-1, 2, 10)[:, None] Xnew2 = np.linspace(0, 3, 10)[:, None] Xnew = np.concatenate((Xnew1, Xnew2), axis=1) # Not full grid, works Xnew = pm.math.cartesian(Xnew1, Xnew2) # Full grid, also works with model: fcond = gp.conditional("fcond", Xnew=Xnew)
Methods
LatentKron.__init__
(*[, mean_func, cov_funcs])LatentKron.conditional
(name, Xnew[, jitter])Return the conditional distribution evaluated over new input locations Xnew.
LatentKron.marginal_likelihood
(name, X, ...)LatentKron.predict
(Xnew[, point, given, ...])LatentKron.prior
(name, Xs[, jitter])Return the prior distribution evaluated over the input locations Xs.
Attributes
Xs
f