Learn R Programming

orthoDr (version 0.6.8)

kernel_weight: Kernel Weight

Description

Calculate the Gaussian kernel weights between rows of X1 and rows of X2.

Usage

kernel_weight(x1, x2, kernel = "gaussian", dist = "euclidean")

Value

A distance matrix, with its (i, j)th element being the kernel weights for the i th row of X1 jth row of X2.

Arguments

x1

First data matrix

x2

Second data matrix

kernel

The kernel function, currently only using Gaussian kernel.

dist

The distance metric, currently only using the Euclidean distance.

Examples

Run this code
# two matrices
set.seed(1)
x1 <- matrix(rnorm(10), 5, 2)
x2 <- matrix(rnorm(6), 3, 2)
kernel_weight(x1, x2)

Run the code above in your browser using DataLab