Kernel functions

Share:

Description

Compute similarities between feature vectors according to a specific kernel function

Usage

1
2
3
4
5
6
7
cauchy.kernel(W, sigma = 1)
laplacian.kernel(W, sigma = 1)
gaussian.kernel(W, sigma = 1)
inv.multiquadric.kernel(W, v = 1)
identity.kernel(W, a = 1)
linear.kernel(W, a = 1)
poly.kernel(W, degree = 2, scale = -1, v = 0)

Arguments

W

a numeric matrix, Rows are examples and columns are features

sigma

a real value representing the sigma parameter (def. 1) of the Cauchy, Gaussian and Laplacian kernel

v

constant factor (def. 1) of the inverse multiquadric kernel and of the polynomail kernel; for the inverse multiquadric kernel v must be larger than 0.

a

unused parameter, maintained for compatibility reasons .

degree

integer corresponding to a degree of the polynomial (def. 2)

scale

double: scaling factor of the polynomial kernel. If scale=-1 (def) scale is set to 1/ncol(W);

Details

All the kernel matrices are computed by calling C code to speed-up the computation.

cauchy.kernel computes the Cauchy kernel.

laplacian.kernel computes the Lapalacian kernel.

gaussian.kernel computes the Gaussian kernel.

inv.multiquadric.kernel computes the inverse multiquadric kernel.

identity.kernel computes the identity kernel. In this case the input W represents a similarity square matrix (obtained i.e. through the Pearson correlation) between examples.

linear.kernel computes the linear kernel.

Value

A kernel matrix representing the similarities between the examples (rows of W), according to a specific kernel function.

See Also

rw.kernel-methods

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# computing kernels on the Tanimoto chemical structure similarity matrix
library(bionetdata);
data(DD.chem.data);
K <- identity.kernel(DD.chem.data);
K <- linear.kernel(DD.chem.data);
## Not run: 
K <- gaussian.kernel(DD.chem.data);
K <- inv.multiquadric.kernel(DD.chem.data);
K <- poly.kernel(DD.chem.data);

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.