View source: R/medianheuristic.R
medianheuristic | R Documentation |
Computes the inverse of the median difference of all distinct pairs in vectors or matrices.
medianheuristic(X, Y = NULL, kernel = c("Laplacian", "Gaussian"), fast = FALSE)
X |
Numeric vector or matrix of length |
Y |
Numeric vector or matrix of length |
kernel |
String, either |
fast |
Boolean; if |
Computes median of differences md
using mediandiff
and then returns 1 / md
. See mediandiff
for details.
A scalar, the inverse of the median of all pairwise differences.
mediandiff
X <- c(7.1, 1.2, 4.3, 0.4)
Y <- c(5.5, 2.6, 8.7)
mh <- medianheuristic(X, Y, kernel="Laplacian", fast=TRUE)
#using fast method, Gaussian kernel, loglinear in number of observations
mh <- medianheuristic(X, Y, fast=TRUE, kernel="Gaussian")
#using naive method (default), with Laplacian kernel
mh <- medianheuristic(X, Y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.