## 4 Open-Categorical Classification Based On GAN  
It is difficult to collect all possible sample classes in reality; here will be some unmarked categories, called unknown classes. The machine learning algorithm based on the statistical learning method cannot use the prior probability knowledge to identify an unknown class. Therefore, it is important to construct a more accurate model to deal with the unknown classes. In order to solve this problem, we propose the OCC model based on the generative adversarial networks (OCC-GAN), as shown in Figure 3.  
Many researchers have noticed this OCC problem and proposed many excellent solutions [35; 36; 46]. However, there are still some shortcomings while we make use of the similarity or the distance threshold as the inspection standard. All these methods require that the feature distribution space is all included in the hypersphere, but this is not the case in reality. Suppose the feature distribution of the sample is the shape of Figure 4 [47]; under this circumstance, there are errors when we take advantage of the distance threshold. Meanwhile, many researchers propose the Equation (5), which is used to measure the risk of the OCC model. The \(f(x)\) is the measurable space, \(O\) is the model discriminant area after training, and  
Figure 4: Feature distribution. Figure 3: Framework of the OCC-GAN. is the measurable space of the entire open set. If the discriminant region of the model can approach the boundary of the feature distribution of the known class, the risk of the model will be lower. \[R_{\mathrm{O}}=\frac{\int_{\mathrm{O}}f(x)dx}{\int_{\mathrm{S}}f(x)dx} \tag{5}\]  
According to Equation (5), suppose some negative samples can be obtained, whose feature space can tightly surround the feature distribution space of the known class. As shown in Figure 5, the red known samples are surrounded by the blue samples. Based on the feature distribution in Figure 5, it is easy to obtain a discriminative space by SVM or Deep Neural Networks (DNN) algorithms, so that the classifier can discriminate the sample in the space into a known class. Otherwise, it is an unknown one. The goal of the OCC is to find a distribution space similar to the surrounding gray area in the Figure 6 that the discriminative space is closer to the distribution of the known class. In fact, since the size of the open space is completely unknown, the negative samples as described above cannot be obtained. To solve this problem, we can generate the fake samples based on GAN surrounding with the known classes. However, it is difficult to generate the actual feature distribution as we want. As shown in Figure 7, the red points are the real samples and the blue points represent  
Figure 5: Feature distribution of the generated fake samples. Figure 6: Discriminating space based on the SVM model. the fake samples. It is obvious that the two types of feature distributions are overlapping rather than surrounding. Therefore, it is difficult to directly take samples generated by the GAN as negative classes. Thus, the solution lies in the improvement of the GAN model to generate the desired samples, as shown in Equations (6)-(14). The loss function of discriminative model D is:  
\[P_{D}(\hat{x})=avg((H(\hat{x})-label_{fake})^{2}) \tag{6}\]  
\[P_{D}(x)=avg((H(x)-label_{real})^{2}) \tag{7}\]  
\[L_{D}^{k}=\operatorname*{arg\,min}_{D}P_{D}(\hat{x})+P_{D}(x) \tag{8}\]  
The loss function of generative model G is:  
\[L_{1}(\hat{x},X_{k})=\max\{0,arg\underset{x\in X_{k}}{\min}dist(F(x,\hat{x}))- \mu_{1}\} \tag{9}\]  
Figure 4:0  
Figure 4:1  
Figure 4:2  
Figure 4:3  
Figure 4:4  
where \(x\) is the real training sample, \(\hat{x}\) is the fake sample. \(X_{k}\) is the space of the \(k\)th real class. Similarly, \(X_{k}^{-}\) means the space of the \(k\)th fake class. \(\mu_{1}\) and \(\mu_{2}\) is the average distance between the sample features of \(X_{k}\) or \(X_{k}^{-}\), while \(u_{3}\) is the maximum distance of the \(X_{k}\) samples and plus the standard deviation.