# Open-Set Signal Recognition Based on Transformer and Wasserstein Distance
## 3 Preliminaries
In ARPL, the reciprocal point of each category plays an important role, while the reciprocal point \(p^{k}\) for category \(k\) is designed to denote the latent representation of the sub-dataset \(\mathcal{D}_{train}^{\
eq k}\cup\mathcal{D}_{\mathcal{U}}\). The key constraint on the reciprocal point \(p^{k}\) is that the samples of \(\mathcal{O}_{k}\) should be closer to \(p^{k}\) than the samples of \(\mathcal{S}_{k}\), which can be expressed mathematically as [26]  
\[\max\Big{(}\sum d\Big{(}\mathcal{D}_{train}^{\
eq k}\cup\mathcal{D}_{\mathcal{ U}},p^{k}\Big{)}\Big{)}<d,\quad\forall d<\sum d\Big{(}\mathcal{D}_{train}^{k},p^{k} \Big{)}, \tag{2}\]  
where the distance \(d(\cdot,\cdot)\) is typically calculated by combining the Euclidean distance and dot product. For efficient and tractable computation, this constraint can be relaxed and further used in designing the open space risk function. To summarize, \(\mathcal{L}_{known}\) and \(\mathcal{L}_{o}\) can be expressed in detail as:\[\left\{ \begin{array}{l}\mathcal{L}_{known}(f,\mathcal{D}_{train}):=\mathcal{L}_{ known}\left(\theta,\left\{p^{k}\right\}\right)=\sum_{k=1}^{\ell}\sum_{\mathbf{x}\in \mathcal{S}_{k}\cup\mathcal{O}_{k}^{\text{positive}}}\left\{-\log\left[p\left( \mathbf{y}=k\mid\mathbf{x},f,\left\{p^{k}\right\}\right)\right]\right\},\\ \mathcal{L}_{o}(f,\mathcal{D}_{\mathcal{U}}):=\mathcal{L}_{o}\left(\theta, \left\{p^{k}\right\},\mathcal{R}\right)=\sum_{k=1}^{\ell}\sum_{\mathcal{D}_{ min}^{rk}\cap\mathcal{D}_{\mathcal{U}}}\left\{\max\left(d\left(\mathbf{x},p^{k} \right)-\mathcal{R},0\right)\right\},\end{array} \right. \tag{3}\]  
where \(\theta\) denotes the parameter of the embedding and prediction functions, and the function \(p(\cdot)\) is defined as follows with a hyperparameter \(\gamma\):  
\[p\left(\mathbf{y}=k\mid\mathbf{x},f,\left\{p^{k}\right\}\right)=\frac{e^{ \gamma d\left(\mathbf{x},p^{k}\right)}}{\sum_{j=1}^{\ell}e^{\gamma d\left( \mathbf{x},p^{j}\right)}}.\]  
The empirical classification risk has a close relationship with the classification loss of the reciprocal points. The parameter \(\mathcal{R}\) can be considered as a learnable margin. Based on the above assumptions and well-defined loss functions, the typical ARPL algorithm involves the following scheme:  
\[\left\{ \begin{array}{l}(1)\text{ Initialize the parameters }\theta,\left\{p^{k}\right\}, \mathcal{R}\text{ respectively; set}\\ \text{ the hyperparameters }\alpha,\gamma\text{ and the learning rate }\mu;\text{ the iteration number is }t;\\ (2)\text{ Do }t\to t+1;\\ (3)\text{ Calculate the loss by }\mathcal{L}^{t}=\mathcal{L}_{known}^{t}+\alpha\mathcal{L}_{o}^{t};\\ (4)\text{ Update the parameters }\left\{p^{k}\right\}\text{ by}\\ \left(p^{k}\right)^{t+1}=\left(p^{k}\right)^{t}-\mu\frac{\partial\mathcal{L}^ {t}}{\partial p^{k}}\left(\theta^{t},\left\{\left(p^{k}\right)^{t}\right\}, \mathcal{R}^{t}\right);\\ (5)\text{ Update the parameters }\mathcal{R}\text{ by}\\ \mathcal{R}^{t+1}=\mathcal{R}^{t}-\mu\frac{\partial\mathcal{L}^{t}}{\partial \mathcal{R}}\left(\theta^{t},\left\{\left(p^{k}\right)^{t}\right\},\mathcal{R} ^{t}\right);\\ (6)\text{ Update the parameters }\theta\text{ by}\\ \theta^{t+1}=\theta^{t}-\mu\frac{\partial\mathcal{L}^{t}}{\partial\theta} \left(\theta^{t},\left\{\left(p^{k}\right)^{t}\right\},\mathcal{R}^{t}\right).\end{array} \right.\]  
The scheme can be considered the key to the ARPL algorithm. The method proposed in this paper will also follow this general scheme. More modifications and improvements are discussed below, especially for the open-set signal recognition.