# SCS-JPGD: Single-Channel-Signal Joint Projected Gradient Descent
## 3 Methods
### Adversarial Training  
Modern deep learning models are often highly sensitive to small perturbations in the input data. Through adversarial training, we can teach the model to maintain high accuracy under such conditions, thereby improving its security in real-world applications. The objective of adversarial training is to enhance the model's robustness against adversarial attacks by incorporating adversarial samples into the training process. Specifically, in each training batch, adversarial samples are first generated, and then both clean and adversarial samples are combined for training. The goal of iterative training is to minimize the following loss function, as shown in Equation (14).  
\[\mathcal{L}(\theta)=\mathbb{E}_{(x,y)\sim\mathcal{D}}[\mathcal{L}_{\text{CE}} (f_{\theta}(x),y)+\mathcal{L}_{\text{CE}}(f_{\theta}(\text{adv}(x)),y)] \tag{14}\]  
The loss function \(\mathcal{L}_{\text{CE}}\) represents the cross-entropy loss, \(f_{\theta}\) denotes the model, and \(\text{adv}(x)\) refers to the adversarial sample.  
Batch-wise training iteratively updates the adversarial samples, progressively increasing their interference with the model. The core idea of adversarial training is to introduce carefully crafted adversarial samples to help the model adapt to perturbations, thereby improving its generalization ability. Adversarial training methods combine standard loss and adversarial loss optimization to ensure that the model performs well on both normal and adversarial samples. Specifically, the loss functions of adversarial and normal samples are jointly optimized, encouraging the model to gradually adapt to perturbations during the learning process. By incorporating adversarial samples into the training process, the model can learn more robust feature representations, enabling it to maintain high classification accuracy even when faced with malicious perturbations. The specific procedure is shown in Algorithm 1.  
```
1:Input: Training dataset \(\mathcal{D}=\{(x_{i},y_{i})\}\), model hyperparameters \(\theta\), step size \(\alpha\), maximum adversarial perturbation magnitude \(\epsilon\), number of training epochs \(T\), batch size \(B\)
2:Output: Trained model hyperparameters \(\theta\)
3:for each training epoch \(t=1\) to \(T\)do
4:for each batch \((x^{(b)},y^{(b)})\) from dataset \(\mathcal{D}\)do
5: Generate clean sample \(x^{(b)}\)
6: Generate adversarial sample \(\text{adv}(x^{(b)})\) using SPGD method: \[\text{adv}(x^{(b)})=x^{(b)}+\epsilon\cdot\text{sign}(\
abla_{x}\mathcal{L}_{ \text{CE}}(f_{\theta}(x^{(b)}),y^{(b)}))\]
7: Compute loss for clean and adversarial samples: \[\mathcal{L}_{\text{CE}}(f_{\theta}(x^{(b)}),y^{(b)})\quad\text{and}\quad \mathcal{L}_{\text{CE}}(f_{\theta}(\text{adv}(x^{(b)})),y^{(b)})\]
8: Compute total loss function \(\mathcal{L}(\theta)\): \[\mathcal{L}(\theta)=\mathbb{E}_{(x,y)\sim\mathcal{D}}[\mathcal{L}_{\text{CE} }(f_{\theta}(x),y)+\mathcal{L}_{\text{CE}}(f_{\theta}(\text{adv}(x)),y)]\]
9: Compute gradient \(\
abla_{\theta}\mathcal{L}(\theta)\)
10: Update model hyperparameters \(\theta\): \[\theta\leftarrow\theta-\eta\cdot\
abla_{\theta}\mathcal{L}(\theta)\]
11:endfor
12:endfor
13:Return: Trained model parameters \(\theta\)
```  
**Algorithm 1** Adversarial Training Algorithm