diffusion_mapping
#
- hypercoil.functional.connectopy.diffusion_mapping(W: Array | ndarray, k: int = 10, alpha: float = 0.5, diffusion_time: int = 0) Tuple[Array | ndarray, Array | ndarray] [source]#
Manifold coordinates estimated using diffusion mapping.
This functionality is adapted very closely from
brainspace
with some minor adaptations for differentiability.Warning
Sparse inputs are currently unsupported because an implementation of a sparse extremal eigenvalue solver does not yet exist in JAX. For sparse inputs, use the generalised connectopic functional instead – once we implement VJP rules for elementary operations on sparse matrices, anyway.
Note
The anisotropic diffusion parameter determines the kind of diffusion map produced by the algorithm.
produces Laplacian eigenmaps, corresponding to a random walk-style diffusion operator. (default) corresponds to Fokker-Planck diffusion. corresponds to Laplace-Beltrami diffusion.
- Dimension:
- W :
or *
denotes any number of preceding dimensions, N denotes number of vertices, and E denotes number of edges. The shape should be ifedge_index
is not provided and ifedge_index
is provided.- edge_index :
As above.
- Q :
k denotes the number of diffusion maps.
- L :
As above.
- W :
- Parameters:
- Wtensor
Edge weight tensor. This should be the graph adjacency (or affinity) matrix.
- kint (default 10)
Number of eigenmaps to compute.
- alphafloat
(default 0.5) Anisotropic diffusion parameter.
- diffusion_timeint (default 0)
Diffusion time parameter. A value of 0 indicates that a multi-scale diffusion map should be computed, which considers all valid times (1, 2, 3, etc.).
- Returns:
- Qtensor
Diffusion maps.
- Ltensor
Eigenvalues corresponding to diffusion maps.
See also