brainmass.objectives.fc_corr

Contents

brainmass.objectives.fc_corr#

brainmass.objectives.fc_corr(as_loss=False)[source]#

Build a functional-connectivity correlation score.

Computes the correlation between the static functional-connectivity (FC) matrices of the prediction and the target via braintools.metric.functional_connectivity() and braintools.metric.matrix_correlation().

Parameters:

as_loss (bool, default False) – If True, return 1 - corr (a quantity to minimise); otherwise return the raw correlation (in [-1, 1], to maximise).

Returns:

score(prediction, target) -> scalar.

Return type:

callable

Examples

>>> import numpy as np, jax.numpy as jnp
>>> from brainmass import objectives
>>> rng = np.random.default_rng(0)
>>> x = jnp.asarray(rng.standard_normal((200, 5)))
>>> score = objectives.fc_corr()
>>> float(score(x, x))
1.0