compute_similarity_graph: Compute the manual similarity graph S (Eq. (4) in the paper)

View source: R/dpage.R

compute_similarity_graphR Documentation

Compute the manual similarity graph S (Eq. (4) in the paper)

Description

For each pair of samples (x_i, x_j), the entry s_{ij} in the similarity matrix S is computed as:

s_{ij} = \begin{cases} \frac{1}{2}\left( e^{-\|x_i - x_j\|^2 / \tau_i^+} + e^{-\|x_j - x_i\|^2 / \tau_j^+} \right), & \text{if } c_i = c_j, \\ -\frac{1}{2}\left( e^{-\|x_i - x_j\|^2 / \tau_i^-} + e^{-\|x_j - x_i\|^2 / \tau_j^-} \right), & \text{if } c_i \neq c_j, \end{cases}

where \tau_i^+ and \tau_i^- (Eqs. (5) and (6)) characterize the intra- and inter-class geometric distributions for sample x_i, respectively.

Usage

compute_similarity_graph(X, y, q = 1.5)

Arguments

X

A numeric matrix of size n \times d, where each of the n rows is one sample.

y

A length-n vector/factor of class labels.

q

A positive exponent (see Eqs. (5) and (6)). Typical range is 1, 3.

Value

An n \times n matrix S.


bbuchsbaum/discursive documentation built on April 14, 2025, 4:57 p.m.