View source: R/kernel_weight.r
kernel_weight | R Documentation |
Calculate the Gaussian kernel weights between rows of X1
and rows of X2
.
kernel_weight(x1, x2, kernel = "gaussian", dist = "euclidean")
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. |
A distance matrix, with its (i, j)th element being the kernel weights for
the i th row of X1
jth row of X2
.
# two matrices
set.seed(1)
x1 <- matrix(rnorm(10), 5, 2)
x2 <- matrix(rnorm(6), 3, 2)
kernel_weight(x1, x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.