Skip to contents

Formula: K(x_i, x_j) = exp(-gamma * ||x_i - x_j||^2)

Usage

Rbfkern(X, gamma = NULL, Z = NULL)

Arguments

X

One record per row.

gamma

Bandwidth; None uses 1/p, p the number of columns of X.

Z

Second set of records; None gives the square Gram matrix of X.

Value

List with K, gamma, n, m.

References

Montesinos Lopez, Montesinos Lopez and Crossa (2022), Multivariate Statistical Machine Learning Methods for Genomic Prediction, Springer, doi:10.1007/978-3-030-89010-0. Chapter 8, Sect. 8.2.2 pp. 263-264. The book prints the Gaussian kernel through its R implementation K.radial, which computes exp(-gamma * ||x1 - x2||^2); gamma, not a variance-style bandwidth, is the parameter the text discusses on p. 264. The placeholder this replaced carried a 1/(2h^2) parameterization that the book does not use. Read from the chapter PDF, not recalled.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Rbfkern(V)
#> $K
#>              [,1]         [,2]         [,3]         [,4]         [,5]
#> [1,] 1.000000e+00 3.678794e-01 1.831564e-02 1.234098e-04 1.125352e-07
#> [2,] 3.678794e-01 1.000000e+00 3.678794e-01 1.831564e-02 1.234098e-04
#> [3,] 1.831564e-02 3.678794e-01 1.000000e+00 3.678794e-01 1.831564e-02
#> [4,] 1.234098e-04 1.831564e-02 3.678794e-01 1.000000e+00 3.678794e-01
#> [5,] 1.125352e-07 1.234098e-04 1.831564e-02 3.678794e-01 1.000000e+00
#> [6,] 1.388794e-11 1.125352e-07 1.234098e-04 1.831564e-02 3.678794e-01
#> [7,] 2.319523e-16 1.388794e-11 1.125352e-07 1.234098e-04 1.831564e-02
#> [8,] 5.242886e-22 2.319523e-16 1.388794e-11 1.125352e-07 1.234098e-04
#>              [,6]         [,7]         [,8]
#> [1,] 1.388794e-11 2.319523e-16 5.242886e-22
#> [2,] 1.125352e-07 1.388794e-11 2.319523e-16
#> [3,] 1.234098e-04 1.125352e-07 1.388794e-11
#> [4,] 1.831564e-02 1.234098e-04 1.125352e-07
#> [5,] 3.678794e-01 1.831564e-02 1.234098e-04
#> [6,] 1.000000e+00 3.678794e-01 1.831564e-02
#> [7,] 3.678794e-01 1.000000e+00 3.678794e-01
#> [8,] 1.831564e-02 3.678794e-01 1.000000e+00
#> 
#> $gamma
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $m
#> [1] 8
#> 
#> $method
#> [1] "Gaussian (RBF) kernel, MVSML Sect. 8.2.2"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"