access: Interaction with kernel objects

Description Usage Arguments Examples

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

Arguments

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 NULL, the range -5 to 5 is used, arbitrarily.

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

Examples

 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)

goldingn/gpe documentation built on May 17, 2019, 7:41 a.m.