RBF: Gaussian RBF (Radial Basis Function) kernel

View source: R/kernel_functions.R

RBFR Documentation

Gaussian RBF (Radial Basis Function) kernel

Description

'RBF()' computes the RBF kernel between all possible pairs of rows of a matrix or data.frame with dimension NxD.

Usage

RBF(X, g = NULL)

Arguments

X

Matrix or data.frame that contains real numbers ("integer", "float" or "double").

g

Gamma hyperparameter. If g=0 or NULL, 'RBF()' returns the matrix of squared Euclidean distances instead of the RBF kernel matrix. (Defaults=NULL).

Details

Let x_i,x_j be two real vectors. Then, the RBF kernel is defined as:

K_{RBF}(x_i,x_j)=\exp(-\gamma \|x_i - x_j \|^2)

Sometimes the RBF kernel is given a hyperparameter called sigma. In that case: \gamma = 1/\sigma^2.

Value

Kernel matrix (dimension: NxN).

Examples

dat <- matrix(rnorm(250),ncol=50,nrow=5)
RBF(dat,g=0.1)

kerntools documentation built on April 3, 2025, 7:52 p.m.