Resolves a kernel_spec's bandwidth against data: when kernel$bandwidth
is "median" (the default for RBF and Matern kernels) the median heuristic
is computed from x; otherwise the fixed bandwidth is returned unchanged.
This is the helper kernel_matrix() uses internally, exposed so that callers
building kernel matrices by hand – for example a custom HSIC statistic via
weighted_hsic_stat() – resolve the bandwidth exactly as the package does.
See also
kernel_spec(), kernel_matrix(), weighted_hsic_stat()
Other kernel primitives:
kernel_matrix(),
kernel_spec(),
select_bandwidth(),
weighted_hsic_stat()
Examples
x <- matrix(rnorm(40), ncol = 2)
resolve_bandwidth(kernel_spec(), x)
#> Kernel specification:
#> Type: rbf
#> Bandwidth: 1.914354
