rbfkernel: Calculate RBF kernel matrix

Description Usage Arguments Details Value Author(s) See Also Examples


Calculates the RBF kernel matrix for the dataset contained in the matrix X, where each row of X is a data point. If Y is also a matrix (with the same number of columns as X), the kernel function is evaluated between all data points of X and Y.


rbfkernel(X, sigma = 1, Y = NULL)



matrix containing a data point in each row


kernel width of rbf kernel


leave this NULL if the kernel function should be evaluated between the data points only contained in X (which can be regarded as Y = X) or to a matrix with same number of columns as X if you want to evaluate the function between the points of X and Y


Each row of X must be a data point, i.e. X = (x_1, x_2, ..., x_n). The kernel matrix K is then defined as

K = (k(x_i, x_j)), i,j=1,...,n

If Y is not NULL and also contains data points in each row, i.e. Y = (y_1, y_2, ..., y_m), the kernel matrix K of X and Y is defined as

K = (k(x_i, x_j)), i=1,...,n, j=1,...,m

In this case, k is the rbf (radial basis function) kernel, which is defined as

k(x, y) = exp(-0.5*\|\|x - y\|\|\^2/sigma)

where x, y are data points and sigma is the rbf kernel width.


RBF kernel matrix K for the given dataset


Jan Saputra Mueller

See Also

polykernel, sincdata


## generate sinc data and calculate rbf kernel matrix with sigma = 1
d <- sincdata(100, noise = 0.1)
K <- rbfkernel(d$X)

Search within the rdetools package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.