skada.deep.losses.cdd_loss
- skada.deep.losses.cdd_loss(y_s, features_s, features_t, target_kmeans, sigmas=None, distance_threshold=0.5, class_threshold=3, eps=1e-07)[source]
Define the contrastive domain discrepancy loss based on [33].
- Parameters:
- y_stensor
labels of the source data used to compute the loss.
- features_stensor
features of the source data used to compute the loss.
- features_ttensor
features of the target data used to compute the loss.
- target_kmeansSphericalKMeans
Pre-computed target KMeans clustering model.
- sigmasarray like, default=None,
If array, sigmas used for the multi gaussian kernel. If None, uses sigmas proposed in [1]_.
- distance_thresholdfloat, optional (default=0.5)
Distance threshold for discarding the samples that are to far from the centroids.
- class_thresholdint, optional (default=3)
Minimum number of samples in a class to be considered for the loss.
- epsfloat, default=1e-7
Small constant added to median distance calculation for numerical stability.
- Returns:
- lossfloat
The loss of the method.
References
[33]Kang, G., Jiang, L., Yang, Y., & Hauptmann, A. G. (2019). Contrastive adaptation network for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (pp. 4893-4902).