Laplace: Laplacian kernel

View source: R/kernel_functions.R

LaplaceR Documentation

Laplacian kernel

Description

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

Usage

Laplace(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, 'Laplace()' returns the Manhattan distance (L1 norm between two vectors). (Defaults=NULL)

Details

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

K_{Lapl}(x_i,x_j)=\exp(-\gamma \|x_i - x_j \|_1)

Value

Kernel matrix (dimension: NxN).

Examples

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

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