## 5 Materials and Methods
### Contrastive Semantic Alignment
``` Data:\(N\) labelled source domains \(\{D_{s_{i}}\}_{i=1}^{N}=\left\{\{x_{i_{i}}^{(j)},y_{i_{j}}^{(j)}\}_{j=1}^{M} \right\}_{i=1}^{N}\) and unlabelled target domain \(D_{i}=\{x_{i}^{(j)}\}_{j=1}^{M_{i}}\) Result: Optimized pre-trained ResNet50 (\(F\)) [80], \(N\) trained domain-specific feature extractors \(\{H_{\Omega}\}_{i=1}^{N}\), and \(N\) trained domain-specific classifiers \(\{\{C_{2}\}\}_{i=1}^{N}\) Initialize \(N\) domain-specific feature extractors \(\{H_{\Omega}\}_{i=1}^{N}\), and \(N\) domain-specific classifiers \(\{\{C_{2}\}\}_{i=1}^{N}\) repeat foreach iterationdo

sample L-sized instances for each of \(N\) source domains such that \(\left\{\{(x_{i_{i}}^{(j)})\}_{j=1}^{L}\right\}_{i=1}^{N}\subseteq\{D_{i_{i}} \}_{i=1}^{N}\) sample L-sized instances from target domain such that \(\left\{(x_{i}^{(j)})\}_{j=1}^{L}\subseteq D_{\Omega}\right.\) Pass \(\left\{\{(x_{i_{i}}^{(j)})\}_{j=1}^{L}\right\}_{i=1}^{N}\) and \(\{(x_{i}^{(j)})\}_{j=1}^{L}\) through \(F\) to obtain \(F_{i}(\left\{x_{i_{i}}^{L}\right\}_{j=1}^{L}\right]_{i=1}^{N})\) and \(F(\{x_{i}\}_{j=1}^{L})\) Pass \(F_{i}(\left\{x_{i_{j}}^{L}\right\}_{i=1}^{N})\) through one of the \(\{H_{\Omega}\}_{i=1}^{N}\) Pass \(F(\{x_{i}\}_{j=1}^{L})\) through each of the \(\{H\}_{i=1}^{N}\) Pass \(H_{\Omega}\left(\left[\left(F\big{(}\big{[}x_{i_{i}}^{(j)}\big{]}_{i=1}^{L} \big{]}_{i=1}^{N}\right)\right]_{i=1}^{N}\right)\) to each of the \(\{C_{2}\}_{i=1}^{N}\) and calculate classification loss using Equation (14) Evaluate distance minimization loss for each pair of \(H_{\Omega}(\left[\left(F_{i}\big{(}\big{[}x_{i_{j}}^{L}\big{]}_{j=1}^{N}\big{]} _{i=1}^{N}\right)\right]_{i=1}^{N})\) and \(H_{\Omega}\left[\left(F(\{x_{i}\}_{j=1}^{L})\right]_{i=1}^{N}\right)_{i=1}^{N}\) using your choice of metric: Equations (4), (8) and (11) Evaluate contrastive semantic alignment loss for each pair of \(\mathcal{C}_{2}(\left[H_{\Omega}\left[\left(F_{i}\big{(}\big{[}x_{i_{j}}^{L} \big{]}_{j=1}^{N}\big{]}_{i=1}^{N}\right)\right]_{i=1}^{N})\right]_{i=1}^{N})\) and \(\mathcal{C}_{2}(\left[H_{\Omega}\left[\left(F(\{x_{i}\}_{j=1}^{L}\right) \right]_{i=1}^{N}\right)\right]_{i=1}^{N})\) using Equation (1

## 6 Experimental Results

The main objective of our evaluation is to assess the performance of M-FUDA in tackling the main types of domain adaptation tasks in human activity recognition using device-free sensing identified in the previous discussion as domain-shifting inconsistency produced due to varying users, environments, and/or atmospheric conditions from the training to the testing phase of the model. All experiments conducted in this study were performed on an Intel Core i7-9700K CPU (Intel Corp., Santa Clara, CA, USA) equipped with 32 GB of internal memory and an Nvidia RTX 3060 GPU (Nvidia Corp, Santa Clara, CA, USA). ### Datasets

We accessed three publicly available datasets [41; 49; 84] for our model evaluation on 24 September 2024. We have not had access to information that could identify individual participants during or after data collection. Regarding our first dataset, a personal computer using Raspberry Pi as a monitoring point (MP) and a TP-link archer c20 as an access point (AP) was employed to communicate over a single antenna pair with 52 useful sub-carriers, and a Nexmon Tool [85] was used to collect CSI data for seven daily activities repeated by 3 volunteers 20 times, each resulting in 420 samples in total. We used the magnitude values of the complex CSI to create cross-user domain transformations from the source to the target domain using the underlined dataset, which we called the Parisafm dataset [49]. For our assessment of cross-user and cross-environment variations overall, we utilized the Alsaify dataset [84], which was collected from 12 sets of activities repeated by 30 volunteers, with 20 trials for each, and 30 useful sub-carriers among 3 antenna pairs, resulting in 90 effective data features (columns) of complex CSI.