skada.deep.SPALoss

class skada.deep.SPALoss(max_epochs, domain_criterion=None, memory_features=None, memory_outputs=None, K=5, reg_adv=1, reg_gsa=1, reg_nap=1)[source]

Loss SPA.

This loss tries to minimize the divergence between features with adversarial method. The weights are updated to make harder to classify domains (i.e., remove domain-specific features).

See [36] for details.

Parameters:
max_epochsint

Maximum number of epochs to train the model.

target_criteriontorch criterion (class), default=None

The initialized criterion (loss) used to compute the adversarial loss. If None, a BCELoss is used.

reg_advfloat, default=1

Regularization parameter for adversarial loss.

reg_gsafloat, default=1

Regularization parameter for graph alignment loss

reg_napfloat, default=1

Regularization parameter for nap loss

References

[36]

Xiao et. al. SPA: A Graph Spectral Alignment Perspective for Domain Adaptation. In Neurips, 2023.

forward(y_pred_t, domain_pred_s, domain_pred_t, features_s, features_t, sample_idx_t, **kwargs)[source]

Compute the domain adaptation loss