## 4 Semi-Supervised Learning Based on Mean Teacher Model
### AMT for Indoor Positioning  
The AMT ensembles the teacher and student model, aiming to train a better teacher model from the student model without additional training. In this paper, the teacher and student models use the same network structure, which can be considered as a self-ensemble method. The framework of the proposed AMT is shown in Figure 2.  
The labeled data are denoted as \(X_{L}=\{(x_{l},y_{l})\}_{l=1}^{N}\), where \(L\) represents the total number of labeled samples. The unlabeled data are expressed as \(X_{U}=\{(x_{u})\}_{u=L}^{N}\), where \(U\) represents the total number of unlabeled samples. The total dataset is presented as \(X=X_{L}\cup X_{U}\), and \(X=\{x_{n}\}_{n=1}^{N}\). The random signal perturbations (data augmentation) for the teacher and student models are denoted as \(\eta_{t}\) and \(\eta_{s}\), respectively, and the weightsof the two neural networks are denoted as \(\theta_{t}\) and \(\theta_{s}\), respectively. Then, the predictions of the teacher and student models are expressed as \(f(\theta_{t},\eta_{t},x)\) and \(f(\theta_{s},\eta_{s},x)\), respectively, where they use the identical input \(x\) with a fixed proportion of labeled and unlabeled data, and both teacher and student models use the same network structure \(f(\cdot)\). We first input two CIR data streams, and use different random augmentations for each stream, and then predict UEs' position using the two models. During training steps, the two models interact, with the teacher model \(\theta_{t}^{k}\) using the EMA weights of the student model. In more detail, at the end of the \(k\)th step, the weights of the teacher model \(\theta_{t}^{k}\) are updated using the EMA weights of the student model, and the weight update function of the teacher model is given by  
\[\theta_{t}^{k}=\alpha\theta_{t}^{k-1}+(1-\alpha)\theta_{s}^{k}, \tag{8}\]  
where \(\alpha\) represents the smoothing coefficient hyper-parameter. Instead of regulating the consistency loss of the image classification task in the original Mean Teacher method, we measure the consistency of the users' predicted coordinates. Therefore, we set the distance function \(\mathcal{D}(\cdot)\) as the smooth L1 loss between the batch outputs of data streams instead of the cross-entropy loss. The advantage of using the smooth L1 loss is that the loss can be updated more smoothly, and it is the combination of the L1 and L2 loss with the benefits of both approaches. The specific formula can be expressed as  
\[SmoothL_{1}(x)= \begin{cases}0.5x^{2}&\text{if }|x|<1\\ |x|-0.5&\text{otherwise}\end{cases} . \tag{9}\]  
Using the distance Function (9), we define the loss function for the student model, updating in a minibatch as the weighted sum of the labeled loss of the student model and the consistency loss, which is namely the distance between student and teacher model's prediction. The loss function is  
\[ \begin{split}& Loss_{s}=\sum_{l=1}^{L}SmoothL_{1}(f(\theta_{s}, \eta_{s},x_{l})-y_{l})+\\ &\epsilon_{t}w(\frac{T}{T_{max}})\sum_{n=1}^{N}SmoothL_{1}(f( \theta_{t},\eta_{t},x_{n})-f(\theta_{s},\eta_{s},x_{n})),\end{split}  \tag{10}\]  
where \(T\in[0,T_{max}]\) represents the current training epoch, \(T_{max}\) is a coefficient that represents the maximum ramp-up length, \(T/T_{max}\) linearly increases from 0 to 1, and \(w(T/T_{max})\)  
Figure 2: The framework of the proposed Adapted Mean Teacher(AMT). is the unsupervised weight ramp-up function that controls the weight of the unsupervised loss, which increases linearly to 1 over a certain number of epochs. The mild increase in training is important to assist the model in adapting to the increased training interference caused by the unlabeled data and prevent any degradation in performance. In this paper, we use a Gaussian ramp-up function with \(w(T/T_{max})=e^{-5(1-T/T_{max})^{2}}\).