Skip to main content

Module gradient

Module gradient 

Source
Expand description

PaCMAP loss gradient computation (Algorithm 1, Wang et al. 2021).

Loss terms (where d̃_ab = ‖ya − yb‖² + 1): L_NB = d̃_ij / (10 + d̃_ij) attractive — near neighbours L_MN = d̃_ik / (10000 + d̃_ik) attractive — mid-near pairs L_FP = 1 / (1 + d̃_il) repulsive — further pairs

Gradients are accumulated per point into a pre-allocated buffer.

Functions§

compute_gradient
Compute the full gradient over all three pair types for the current embedding.