spectralbrain.descriptor_distance#
- spectralbrain.descriptor_distance(desc_a, desc_b, *, method='wasserstein', **kwargs)[source]#
Distance between two descriptor distributions.
Used to build the geometric connectome: for each pair of parcels, compute the distance between their descriptor distributions.
- Parameters:
desc_a (ndarray, shape (N_a,) or (N_a, T)) – Descriptor values at vertices of parcel A.
desc_b (ndarray, shape (N_b,) or (N_b, T)) – Descriptor values at vertices of parcel B.
method (str) –
"wasserstein"— 1D Wasserstein (Earth Mover’s Distance)."mmd"— Maximum Mean Discrepancy with Gaussian kernel."euclidean"— L2 between distribution means."cosine"— cosine distance between means."correlation"— 1 − Pearson r between aggregated features.
- Returns:
float
- Return type:
Notes
For 1D descriptors (ScalarMap), Wasserstein is exact and O(N log N). For multi-dimensional descriptors (DescriptorMatrix), the columns are treated independently and distances are averaged.