runlmc.lmc.functional_kernel module¶
-
class
runlmc.lmc.functional_kernel.FunctionalKernel(D=None, lmc_kernels=None, lmc_ranks=None, slfm_kernels=None, indep_gp=None, indep_gp_index=None, name='kern')[source]¶ Bases:
runlmc.parameterization.parameterized.ParameterizedAn LMC kernel can be specified by the number of latent GP kernels it contains. Recall a full LMC kernel defines the similarity between two inputs \(\textbf{x}_i,\textbf{x}_j\) belonging to two outputs \(a,b\), respectively, as follows (noise not included)
\[K((\textbf{x}_i, a),(\textbf{x}_j, b)) = \sum_{q=1}^Q B_{ab}^{(q)} k_q(\textbf{x}_i,\textbf{x}_j)\]If we enumerate all inputs across all our \(D\) outputs \(\{z_j\}_j=\{( \textbf{x}_i, a)|a\in [D]\}\), then the complete LMC kernel evaluated as single matrix over an entire multi-output dataset \(X\) gives \(K_{X,X}\in\mathbb{R}^{n\times n}\), with $mn$-th entry \((K_{X,X})_{mn}=K(z_m,z_n)\).
Since we can perform certain optimizations if \(B^{(q)}\) contains a single nonzero diagonal entry or is of single rank. We refer to this as the coregionalization matrix for stationary subkernel \(k_q\).
FunctionalKernel provides a convenient wrapper for specifying such kernels, which should all be instances of
runlmc.kern.stationary_kernel.StationaryKern. This class is not tied to any data \(X\) but represents the \(K\) function, not matrix, above. This class is, however, tied to parameters. Especially important is the dichotomy withrunlmc.lmc.likelihood.LMCLikelihood, which is a fixed evaluation of a FunctionalKernel with a fixed set of parameters on fixed data.After a successful initialization, we have Q == len(lmc_kernels) + len(slfm_kernels) + len(indep_gp) and len(indep_gp) == D. Each \(A_q,\boldsymbol\kappa_q\), becomes this model, with name a<q>, where <q> is replaced with a specific number.
Before use, input dimension should be specified with
set_input_dim(). This is usually done automatically by the model, such asrunlmc.models.interpolated_llgp.InterpolatedLLGP.Parameters: - D – number of outputs
- lmc_kernels – a list of kernels for which the corresponding coregionalization matrix has full rank
- lmc_ranks – a list of integers of the same length as lmc_kernels each with value \(r_q\) at least 1 which specify that the coregionalization matrix for the corresponding kernel \(k_q\) in the lmc_kernels list can be decomposed as \(B^{(q)}=A_qA_q^{ \top } + \mathop{\text{diag}} \boldsymbol\kappa_q\), with \(A_q\) of rank \(r_q\).
- slfm_kernels – an SLFM kernel restricts its coregionalization matrix to a single rank \(A_qA_q^\top\)
- indep_gp – indpedent GPs for each output \(i\), with associated coregionalization matrices \(\textbf{e}_i\textbf{e}_i^\top\).
- indep_gp_index – should be the same length as indep_gp, and specifies which output the kernel in the indep_gp list in the same place as an index is associated with. Defaults to range(len(indep_gp)).
- name –
paramzname for this kernel
Raises: ValueError – if any of the parameters don’t meet the above requirements, or D,Q are unspecified, 0, or inconsistent.
Variables: - Q – Q, subkernel count including SLFM and indpendent kernels
- D – D, output dimension
- num_lmc – number of LMC kernels (a dictionary, where the key is the active dimensions and the value is the number of LMC kernels for that set of active dimensions)
- num_slfm – number of SLFM kernels, as num_lmc
- num_indep – number of independent GP kernels, as num_lmc
- active_dims – a dictionary whose keys are the subsets of the full
input dimension set {1, …, P}. Only defined after
set_input_dim()has been called.
-
Q¶
-
coreg_diags¶
-
coreg_vecs¶
-
eval_kernel_gradients(dists)[source]¶ Computes the list of grad k_q applied to each distance in dists, where dists should be a dict of active_dim-keyed distances.
-
eval_kernels(dists)[source]¶ Computes the array of k_q applied to each distance in dists, where dists should be a dict of active_dim-keyed distances.
-
eval_kernels_fixed_dim(dists, active_dim)[source]¶ Computes the array of k_q applied to each distance in dists, where only kernels with the passed-in active dimensions are evaluated.
-
filter_non_indep_idxs(idxs)[source]¶ Return only the kernel indices associated with coregionalized (non-independent) kernels
-
noise¶