gpflow.conditionals.util#
Functions#
gpflow.conditionals.util.base_conditional_with_lm#
- gpflow.conditionals.util.base_conditional_with_lm(Kmn, Lm, Knn, f, *, full_cov=False, q_sqrt=None, white=False)[source]#
Has the same functionality as the base_conditional function, except that instead of Kmm this function accepts Lm, which is the Cholesky decomposition of Kmm.
This allows Lm to be precomputed, which can improve performance.
- Parameters
Kmn (
Tensor
) –Lm (
Tensor
) –Knn (
Tensor
) –f (
Tensor
) –full_cov (
bool
) –q_sqrt (
Optional
[Tensor
]) –white (
bool
) –
- Return type
Tuple
[Tensor
,Tensor
]
gpflow.conditionals.util.expand_independent_outputs#
- gpflow.conditionals.util.expand_independent_outputs(fvar, full_cov, full_output_cov)[source]#
Reshapes fvar to the correct shape, specified by full_cov and full_output_cov.
- Parameters
fvar (
Tensor
) – has shape [N, P] (full_cov = False) or [P, N, N] (full_cov = True).full_cov (
bool
) –full_output_cov (
bool
) –
- Return type
Tensor
- Returns
full_cov: True and full_output_cov: True fvar [N, P, N, P]
full_cov: True and full_output_cov: False fvar [P, N, N]
full_cov: False and full_output_cov: True fvar [N, P, P]
full_cov: False and full_output_cov: False fvar [N, P]
gpflow.conditionals.util.independent_interdomain_conditional#
- gpflow.conditionals.util.independent_interdomain_conditional(Kmn, Kmm, Knn, f, *, full_cov=False, full_output_cov=False, q_sqrt=None, white=False)[source]#
The inducing outputs live in the g-space (R^L).
Interdomain conditional calculation.
- Parameters
Kmn (
Tensor
) – [M, L, N, P]Kmm (
Tensor
) – [L, M, M]Knn (
Tensor
) – [N, P] or [N, P, P] or [P, N, N] or [N, P, N, P]f (
Tensor
) – data matrix, [M, L]q_sqrt (
Optional
[Tensor
]) – [L, M, M] or [M, L]full_cov (
bool
) – calculate covariance between inputsfull_output_cov (
bool
) – calculate covariance between outputswhite (
bool
) – use whitened representation
- Return type
Tuple
[Tensor
,Tensor
]- Returns
mean: [N, P]
variance: [N, P], [N, P, P], [P, N, N], [N, P, N, P]
gpflow.conditionals.util.mix_latent_gp#
- gpflow.conditionals.util.mix_latent_gp(W, g_mean, g_var, full_cov, full_output_cov)[source]#
Takes the mean and variance of an uncorrelated L-dimensional latent GP and returns the mean and the variance of the mixed GP, f = W g, where both f and g are GPs, with W having a shape [P, L]
- Parameters
W (
Tensor
) – [P, L]g_mean (
Tensor
) – […, N, L]g_var (
Tensor
) – […, N, L] (full_cov = False) or [L, …, N, N] (full_cov = True)full_cov (
bool
) –full_output_cov (
bool
) –
- Return type
Tuple
[Tensor
,Tensor
]- Returns
f_mean and f_var, shape depends on full_cov and full_output_cov
gpflow.conditionals.util.rollaxis_left#
gpflow.conditionals.util.rollaxis_right#
gpflow.conditionals.util.sample_mvn#
- gpflow.conditionals.util.sample_mvn(mean, cov, full_cov, num_samples=None)[source]#
Returns a sample from a D-dimensional Multivariate Normal distribution.
- Parameters
mean (
Tensor
) – […, N, D]cov (
Tensor
) – […, N, D] or […, N, D, D]full_cov (
bool
) – if True return a “full” covariance matrix, otherwise a “diag”: - “full”: cov holds the full covariance matrix (without jitter) - “diag”: cov holds the diagonal elements of the covariance matrixnum_samples (
Optional
[int
]) –
- Return type
Tensor
- Returns
sample from the MVN of shape […, (S), N, D], S = num_samples
gpflow.conditionals.util.separate_independent_conditional_implementation#
- gpflow.conditionals.util.separate_independent_conditional_implementation(Kmns, Kmms, Knns, f, *, full_cov=False, q_sqrt=None, white=False)[source]#
Multi-output GP with independent GP priors.
Number of latent processes equals the number of outputs (L = P). The covariance matrices used to calculate the conditional have the following shape:
Kuu: [P, M, M]
Kuf: [P, M, N]
Kff: [P, N] or [P, N, N]
Further reference:
See gpflow.conditionals._conditional for a detailed explanation of conditional in the single-output case.
See the multioutput notebook for more information about the multioutput framework.
See above for the parameters and the return value.
- Parameters
Kmns (
Tensor
) –Kmms (
Tensor
) –Knns (
Tensor
) –f (
Tensor
) –full_cov (
bool
) –q_sqrt (
Optional
[Tensor
]) –white (
bool
) –
- Return type
Tuple
[Tensor
,Tensor
]