# Open-Set Specific Emitter Identification Based on Prototypical Networks and Extreme Value Theory
## 3 Recognition Model
### Classification Algorithm
#### 3.4.2 Testing and Recognition  
The entire process is shown in Algorithm 2. Firstly, the features \(f(x;\theta)\) are obtained, and the \(v_{i}(x)\) values of the test sample \(x\) are output using the trained prototypical networks. The output values \(v_{i}(x)\) are the probability that the sample belongs to the known classes after the distance measurement by the sample and prototypes, as shown in Equations (2) and (3). Then, the parameter \(\kappa\) is set, where the value of \(\kappa\) suggests the total number of \"top\" classes to revise. The distances \(d_{i}\) from the test samples to the mean feature of each known class are calculated.  
Furthermore, \(w_{i}=1\) is predetermined, and the network outputs are ranked in descending order. The revision of the Weibull CDF probability is only required for the top \(\kappa\) classes, because the other classes are far from the test samples and have a lesser impact on the classification. Then, the probability \(p_{h(t)}\) that the samples belong to outliers of the top \(\kappa\) classes is obtained from the distance calculated in the previous step and the Weibull model of each class. The probability can be expressed as:  
\[p_{h(t)}=\rho(d_{h(t)};\mathbf{\alpha}_{h(t)};\beta_{h(t)}) \tag{9}\]  
where \(p_{h(t)}\) is the probability that the test sample does not belong to a known class [28]. Then, decreasing weights are needed to scale \(p_{h(t)}\), and the revised probability is \(p^{\prime}_{h(t)}=\frac{\kappa-t+1}{\kappa}p_{h(t)}\). The probability of classes far away from the test sample is reduced, because these categories have less impact on the final output score. The revised probability of the test sample belonging to a known class is:  
\[\begin{array}{ll}w_{h(t)}(x)&=1-p^{\prime}_{h(t)}\\ &=1-\frac{\kappa-t+1}{\kappa}p_{h(t)}\end{array} \tag{10}\]  
The prototypical network outputs of the test samples are weighted with \(\mathbf{w}(x)\) to obtain the final outputs of the test samples belonging to the known classes, which represent the attribution of the test samples for each known class. In this step, the robustness of recognition is further enhanced by weighting the network output with revised probability. When the distance between a test sample and the prototype to which the sample belongs is greater than the distance from other prototypes, the sample is incorrectly identified. Adding probability weighting changes the attribution of the test sample, increasing the likelihood that the test sample is recognized as the correct class.  
In the following step, the network outputs of the test samples are weighted with \(1-w_{i}(x)\), which represents the probability that the test samples do not belong to a class, and then the weighted outputs are summed to obtain the final outputs of the test samples belonging to the unknown class. The probability of the classes with a large distance from the test samples is reduced, because those classes have a lesser impact on the classification results.  
Lastly, the final probability scores of the test samples belonging to the known and unknown class are obtained by the SoftMax function, and the test samples are classified as the class with the highest probability. In this paper, label 0 was set as the unknown class.