Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

KernelICA (version 0.1.0)

kernel_matrix: Kernel Matrix Computation

Description

Computes kernel matrices for Gaussian and Hermite kernels.

Usage

kernel_matrix(
  x,
  y = x,
  kernel = c("gauss", "hermite"),
  sigma = 1,
  hermite_rank = 3
)

Arguments

x

Numeric vector.

y

Numeric vector, default is x.

kernel

Either "gauss" or "hermite".

sigma

Numeric value of the kernel variance. Default is 1.

hermite_rank

Rank of the Hermite kernel. Default is 3. Ignored, when the Gaussian kernel is chosen.

Value

A numeric kernel matrix.

Details

The function computes a matrix in the form of (Kij)(i,j)=K(xi,xj) or (Kij)(i,j)=K(xi,yj) for a kernel function K depending if a second vector was given. The following two kernels are offered:

  • Gaussian Kernel: K(x,y)=e(xy)2/2σ2

  • Hermite Kernel: K(x,y)=k=0dex2/2σ2ey2/2σ2hk(x/σ)hk(y/σ)2kk! where hk is the Hermite polynomial of grade k

Examples

Run this code
# NOT RUN {
x <- rnorm(10)
kernel_matrix(x, kernel = "gauss", sigma = 4)
kernel_matrix(x, kernel = "hermite", sigma = 4, hermite_rank = 3)
# }

Run the code above in your browser using DataLab