brainmass.objectives.fcd_ks

Contents

brainmass.objectives.fcd_ks#

brainmass.objectives.fcd_ks(window_size=30, step_size=5, midpoints=None, bw_method=None, n_diag=1)[source]#

Build a Kolmogorov-Smirnov FCD-distribution loss.

Like fcd_wasserstein() but using the ks_distance() statistic between the two FCD off-diagonal distributions. The KS statistic is the common literature metric for FCD comparison, but it is non-smooth (a supremum); prefer fcd_wasserstein() when the loss drives a gradient optimiser, and use this for evaluation / reporting.

Parameters:
  • window_size (int) – Sliding-window length and stride (in samples) for braintools.metric.functional_connectivity_dynamics().

  • step_size (int) – Sliding-window length and stride (in samples) for braintools.metric.functional_connectivity_dynamics().

  • midpoints (array, optional) – FCD-value evaluation grid (default 100 points on [-0.99, 0.99]).

  • bw_method (optional) – KDE bandwidth forwarded to fcd_distribution().

  • n_diag (int, default 1) – Upper-triangle diagonal offset.

Returns:

loss(prediction, target) -> scalar KS distance between the two FCD distributions (a quantity to minimise; 0 on identity).

Return type:

callable

See also

fcd_wasserstein

the smooth, gradient-friendly counterpart.