Description Usage Arguments Examples
Access and interact with kernel objects. These functions allow
you to report the type of kernel (getType
), extract subkernels
(getSubKernel
) report kernel parameters (getParameters
) and
update them (setParameters
). You can also visualise GPs drawn from
1d or 2d kernels using demoKernel
.
1 2 3 4 5 6 7 8 9 10 11 | getType(kernel)
getColumns(kernel)
getParameters(kernel, continuous = FALSE)
setParameters(kernel, ..., continuous = FALSE)
getSubKernel(kernel, which = 1)
demoKernel(kernel, data = NULL, ndraw = 3)
|
kernel |
a kernel object |
continuous |
whether the parameter values should be reported (and set) on the scale of their continuous transformation rather than their true value (the default). |
which |
which of the two immediate subkernels of the kernel to extract |
data |
a dataset from which to calculate the range of values over which
to draw example GPs. If |
ndraw |
the number of (zero-mean) GP realisations from the kernel to plot. Ignored in the case of a 2d kernel. |
... |
parameters to be updated and the new values for them to take (see examples). Note that these must be passed as values, not as parameter objects |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# construct a kernel with one feature
k1 <- rbf('temperature', l = 5)
# get the kernel type
getType(k1)
# get the names of the columns the kernel acts on
getColumns(k1)
# get the parameters of the kernel
params <- getParameters(k1)
params
# evaluate and visualise it
image(k1(pressure))
# change the length scale
k2 <- setParameters(k1, l = 10)
getParameters(k2)
# change the lengthhscale and variance
k2 <- setParameters(k1, l = 9, sigma = 1.3)
getParameters(k2)
# evaluate and visualise the new kernel
image(k2(pressure))
# build a compositional kernel
k2 <- k1 + k1 * k1
# extract a subkernel
k3 <- getSubKernel(k2, 1)
# plot example GPs from this kernel, applied to the pressure dataset
demoKernel(k1, data = pressure)
# plot a draw from a 2d kernel
k4 <- k1 * expo('pressure', l = 7)
demoKernel(k4, data = pressure)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.