Skip to contents

Parameters are identified by the names returned by kernel_parameters(kernel, flatten = TRUE). Partial updates are supported, which allows an optimizer or tuning routine to modify selected parameters without manually unpacking nested kernel objects.

Usage

update_kernel_parameters(kernel, parameters)

Arguments

kernel

A Gaussian-process kernel specification.

parameters

Named numeric vector of parameter updates.

Value

A new kernel specification with updated parameters.

Stability

Stable: from version 1.0.0 this interface changes incompatibly only in a major release, after a deprecation period. Results and options that concern an experimental model class, kernel, or argument follow that interface's tier. See gaussianprocesses-package for the policy.

Examples

kernel <- sum_kernel(
  rbf_kernel(length_scale = c(1, 2)),
  white_noise_kernel(variance = 0.1)
)

updated <- update_kernel_parameters(
  kernel,
  c("kernel1.length_scale[2]" = 5, "kernel2.variance" = 0.01)
)
kernel_parameters(updated, flatten = TRUE)
#>        kernel1.variance kernel1.length_scale[1] kernel1.length_scale[2] 
#>                    1.00                    1.00                    5.00 
#>        kernel2.variance 
#>                    0.01