Skip to contents

Computes the alpha-decaying kernel from kNN distances.

Usage

compute_alpha_kernel(knn_graph, decay = 1, threshold = 1e-04, verbose = FALSE)

Arguments

knn_graph

Result from magic_knn_graph.

decay

Numeric. Alpha parameter. If NULL, uses unweighted kernel. Default is 1.

threshold

Numeric. Values below this are set to 0. Default is 1e-4.

verbose

Logical or integer. Verbosity level.

Value

A sparse symmetric kernel matrix (dgCMatrix).

Details

The alpha-decaying kernel: $$K(i,j) = \exp\left(-\left(\frac{d(i,j)}{\epsilon_i}\right)^\alpha\right)$$

where \(\epsilon_i\) is the distance to the k-th neighbor (adaptive bandwidth) and \(\alpha\) controls the decay rate.

Reference: Moon, K.R., et al. (2019). Visualizing structure and transitions in high-dimensional biological data. Nature Biotechnology, 37(12), 1482-1492.