medianheuristic {eummd}R Documentation

Compute the median heuristic

Description

Computes the inverse of the median difference of all distinct pairs in vectors or matrices.

Usage

medianheuristic(X, Y = NULL, kernel = c("Laplacian", "Gaussian"), fast = FALSE)

Arguments

X

Numeric vector or matrix of length n.

Y

Numeric vector or matrix of length m, or NULL.

kernel

String, either "Laplacian" or "Gaussian".

fast

Boolean; if TRUE will run O(N log N) algorithm, where N = n + m, but if FALSE will run naive O(N^2 log(N)) algorithm.

Details

Computes median of differences md using mediandiff and then returns 1 / md. See mediandiff for details.

Value

A scalar, the inverse of the median of all pairwise differences.

See Also

mediandiff

Examples


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)



[Package eummd version 0.1.9 Index]