kernels
Hyperparameters and kernel functors
Defines kernel functors (inheriting
KernelFn
) that transform crosswise
difference tensors into cross-covariance matrices and pairwise difference
matrices into covariance or kernel tensors.
See the following example to initialize an MuyGPyS.gp.kernels.Matern
object. Other kernel functors are similar, but require different
hyperparameters.
Example
>>> from MuyGPyS.gp.kernels import Matern
>>> kern = Matern(
... nu=ScalarHyperparameter("log_sample", (0.1, 2.5)),
... metric=IsotropicDistortion(
... l2,
... length_scale=ScalarHyperparameter(1.0),
... ),
... )
One uses a previously computed pairwise_diffs tensor (see
MuyGPyS.gp.tensor.pairwise_tensor()
) to compute a kernel tensor whose
second two dimensions contain square kernel matrices. Similarly, one uses a
previously computed crosswise_diffs matrix (see
MuyGPyS.gp.tensor.crosswise_diffs()
) to compute a cross-covariance
matrix. See the following example, which assumes that you have already
constructed the difference numpy.ndarrays and the kernel kern as shown
above.
Example
>>> K = kern(pairwise_diffs)
>>> Kcross = kern(crosswise_diffs)
- class MuyGPyS.gp.kernels.kernel_fn.KernelFn(metric)[source]
Bases:
object
A kernel functor.
Base class for kernel functors that include a hyperparameter Dict and a call mechanism.
- Parameters:
kwargs – Ignored (by this base class) keyword arguments.
- get_opt_params()[source]
Report lists of unfixed hyperparameter names, values, and bounds.
- Return type:
Tuple
[List
[str
],List
[float
],List
[Tuple
[float
,float
]]]- Returns:
- names:
A list of unfixed hyperparameter names.
- params:
A list of unfixed hyperparameter values.
- bounds:
A list of unfixed hyperparameter bound tuples.
- MuyGPyS.gp.kernels.rbf
alias of <module ‘MuyGPyS.gp.kernels.rbf’ from ‘/home/docs/checkouts/readthedocs.org/user_builds/muygpys/envs/docs/lib/python3.8/site-packages/MuyGPyS/gp/kernels/rbf.py’>
- MuyGPyS.gp.kernels.matern
alias of <module ‘MuyGPyS.gp.kernels.matern’ from ‘/home/docs/checkouts/readthedocs.org/user_builds/muygpys/envs/docs/lib/python3.8/site-packages/MuyGPyS/gp/kernels/matern.py’>