qcfc
: QC-FC measures and loss#
qcfc
#
- hypercoil.loss.qcfc(fc: Tensor, qc: Tensor, *, tol: float | Literal['auto'] = 0, tol_sig: float = 0.1, abs: bool = True, key: PRNGKey | None = None) Tensor [source]#
Alias for
batch_corr()
. Quality control-functional connectivity correlation.- Parameters:
- FCtensor
Tensor block containing functional connectivity measures.
- QCtensor
Vector of quality control measures with which the FC measures are to be correlated.
- tolnonnegative float or
'auto'
(default 0) Tolerance for correlations. Only correlation values above
tol
are counted. If this is set to'auto'
, a tolerance is computed for the batch size given the significance level intol_sig
.- tol_sigfloat in (0, 1)
Significance level for correlation tolerance. Used only if
tol
is set to'auto'
.- absbool (default True)
Use the absolute value of correlations. If this is being used as a loss function, the model’s weights will thus be updated to shrink all batchwise correlations toward zero.
- Returns:
- tensor
Absolute correlation of each vector in
X
withN
, after thresholding at tol. Note that, if you want the original correlations back, you will have to addtol
to any nonzero correlations.
QCFCLoss
#
- class hypercoil.loss.QCFCLoss(nu: float = 1.0, name: str | None = None, *, tol: float | Literal['auto'] = 0, tol_sig: float = 0.1, abs: bool = True, scalarisation: Callable | None = None, key: 'jax.random.PRNGKey' | None = None)[source]#
QC-FC loss.
- Parameters:
- name: str
Designated name of the loss function. It is not required that this be specified, but it is recommended to ensure that the loss function can be identified in the context of a reporting utilities. If not explicitly specified, the name will be inferred from the class name and the name of the scoring function.
- nu: float
Loss strength multiplier. This is a scalar multiplier that is applied to the loss value before it is returned. This can be used to modulate the relative contributions of different loss functions to the overall loss value. It can also be used to implement a schedule for the loss function, by dynamically adjusting the multiplier over the course of training.
- tolnonnegative float or
'auto'
(default 0) Tolerance for correlations. Only correlation values above
tol
are counted. If this is set to'auto'
, a tolerance is computed for the batch size given the significance level intol_sig
.- tol_sigfloat in (0, 1)
Significance level for correlation tolerance. Used only if
tol
is set to'auto'
.- absbool (default True)
Use the absolute value of correlations. If this is being used as a loss function, the model’s weights will thus be updated to shrink all batchwise correlations toward zero.
- scalarisation: Callable
The scalarisation function to be used to aggregate the values returned by the scoring function. This function should take a single argument, which is a tensor of arbitrary shape, and return a single scalar value. By default, the mean scalarisation is used.
Methods
__call__
(FC, QC, *[, key])Call self as a function.