## 2 Methods
### DAIDA Framework
#### 2.2.4 Training Scheme  
The section aims to validate DAIDA's performance in adapting to arm positions from multiple perspectives. We collected data from different arm positions to use as the source domain, target domain and testing datasets to validate the generalization performance of DAIDA. For each subject, data from one single arm position containing 6 motions \(\times\) 10 repetitions were collected as an acquisition. These experiments were designed to test the arm position stability of DAIDA, with a CNN as the baseline for without-domain adaption. When testing the CNN, an odd number of repetitions was used for training and an even number of repetitions was used for testing. And when testing DAIDA, the 1 st and 2 nd repetitions were used for retraining as the target domain, and the  
Figure 4: The process of domain adversarial training. remaining eight repetitions were used for testing. The pre-training datasets of DAIDA under each strategy comprised the same data as the CNN training sets as the source domain, and the testing set was different. ```
Input: (1) Training data: Labeled source \(D_{S}\) and unlabeled target \(D_{T}\). (2) learning rate \(\eta\), \(T_{max}\) and iteration \(N_{max}\); (3) Initialized parameters: \(\theta_{f}\) of feature extractors, \(\theta_{y}\) of label classifier, \(\theta_{d}\) of domain classifier, weighting hyper-parameter \(\lambda\). Output: Optimized parameters \(\theta_{f}\), \(\theta_{y}\) and \(\theta_{d}\). for T = 1,2, \(\ldots\), \(T_{max}\) do for N = 1,2, \(\ldots\), \(N_{max}\) do  Select mini batch: \(d_{S}\), \(d_{T}\) from \(D_{S}\), \(D_{T}\)  Calculate weights: \(\theta_{f}\), \(\theta_{y}\) and \(\theta_{d}\)  Calculate the losses: \(\text{Loss}_{y}\Big{(}\theta_{f},\theta_{y}\Big{)}=\frac{1}{n}\sum\limits_{(x, y)\in d_{s}}y^{T}logG_{y}\Big{(}G_{f}\Big{(}x_{i};\theta_{f}\Big{)};\theta_{y} \Big{)}\) \(\text{Loss}_{d}\Big{(}\theta_{f},\theta_{d}\Big{)}=\frac{1}{n}\sum\limits_{(x, y)\in d_{T}}y^{T}logG_{d}\Big{(}G_{f}\Big{(}x_{i};\theta_{f}\Big{)};\theta_{d} \Big{)}\)  Calculate the final loss: \(\text{Loss}=\text{Loss}_{y}-\lambda\text{Loss}_{d}\)  Update the parameters: \(\theta_{f}=\theta_{f}-\eta\
abla\text{Loss}\Big{(}\theta_{f}\Big{)}\) \(\theta_{y}=\theta_{y}-\eta\
abla\text{Loss}\Big{(}\theta_{y}\Big{)}\) \(\theta_{d}=\theta_{d}-\eta\
abla\text{Loss}(\theta_{d})\) End for End for
```  
**Algorithm 1** Proposed DAIDA Algorithm  
The purpose of the baseline model is to verify the feasibility of the CNN model for upper arm motion recognition and the separability of arm positions. The data used as input came from the sEMG signals obtained from a single subject's upper arm position when completing a movement at a single position as a set. There were 10 healthy subjects and 2 translumeral amputees, and each subject completed six motions in 3 arm positions, i.e., 18 sets of data in total. The experimental data for arm position separability came from a single action for all subjects, with a total of six sets of motions i.e., six sets of data to validate the variability in the same action between different arm positions. The datasets used for training and testing for both types of experiments are from the same set of experimental data, and both types of experiments use only the source network for recognition. The DAIDA model is proposed to address the performance degradation of models at different arm elevation positions. In this study, this problem is regarded as a transfer learning problem. To achieve the desired transfer learning effect, the model needs to extract similar deep features from sEMG signals belonging to both the source domain and the target domain. The distributions of the source domain and the target domain can be used to assess the similarity of the extracted deep features.