# PUE Attack Detection by Using DNN and Entropy in Cooperative Mobile Cognitive Radio Networks
## 3 Deep Neural Network and Entropy to Multiple PUE Detection in Cooperative MCRN
### Detector Based on Entropy  
An entropy-based detector is used for the detection; the energy detection results are the inputs for the system. The MCRN has \(n\) SUs, which transmit the individual results to the FC with the calculated entropy in one frequency channel. These entropy results are the input for the DNN learning algorithm, which detects if there is a _PUE attack_ in the frequency and communicates it to the FC, which decides for everyone under an established rule and in the presence of a _PUE attack_. If a _PUE attack_ is detected, SU continues using the frequency, but if there is a _PU_, it must release the channel and use another one, and if there are no more available frequency channels in the range, service cannot be provided. Energy detection is used for the spectrum sensing scheme in the SUs, but it is combined with the entropy detector for better results, as we worked out in [7]. \(N\) is the number of samples; then the test statistic is given in Equation (1) [20], where \(p(n)\) is the power of the signal received at the SU:  
\[T(p)=\frac{1}{N}\sum_{n=1}^{N}\left|p(n)\right|^{2} \tag{1}\]  
In the traditional energy detector, a hypothesis test is used, a threshold is defined, and it is analyzed if it is above or below the threshold to detect if a _PU_/_PUE_ is present. Our proposal uses the averaged energy as an input for the entropy detector. The _PU_/_PUE_ signal is described in Equation (2) [7]. \[p(t)=\left\{ \begin{matrix}n(t)&noise\\ h(t)*o(t)+n(t)&PUI/PUE\end{matrix} \right. \tag{2}\]  
where \(n(t)\) is the noise and \(h(t)\) is the channel impulse response of the system, which is the response of the communication channel when an impulse is applied to the system. It can be seen as the correlation of the received signal against the transmitted signal, where \(o(t)\) is the measured data from a _PU_/_PUE_ signal and \(p(t)\) is the received signal. To detect a PU or _PUE attack_ signal, it is necessary to protect the authentic PU by changing the frequency channel to another one. In contrast, the _PUE attack_ is detected or discarded. For this purpose, a binary hypothesis test is used: \(H_{0}\) is noise, and \(H_{1}\) indicates a _PU_/_PUE_ signal  
Figure 1: System model for cooperative spectrum sensing. and noise; this is defined in Equation (3) [7]. The entropy is calculated using a discrete Fourier transform (DFT), obtaining Equation (3) [7]. \[\overline{P}(k)=\left\{ \begin{matrix}\overline{J}(k)&H_{0}\\ \overline{L}(k)+\overline{J}(k)&H_{1}\end{matrix} \right. \tag{3}\]  
where \(\overline{P}(k)\) is the complex spectrum of the received signal, \(\overline{L}(k)\) is the _PUI/PUE_ signal, \(\overline{J}(k)\) is the noise, and the size for the DFT is \(k=N\), where \(N\) is the sample size. \(H_{0}\) implies the presence of a _PUI/PUE_ signal, and \(H_{1}\) its absence [21]. The results of the entropy calculation on each SU of the CSS using Equation (4) are used as an input for the DNN algorithm in the learning and detecting processes; the binary results of the detection are sent to the FC as we worked it out in [8]. For a given number of bins \(X\), using the histogram method, the statistic test is calculated in Equation (4). \[T(P)=\frac{1}{1-\alpha}\times log\left(\sum_{i=1}^{X}\frac{k_{i}}{N}^{\alpha} \right) \begin{cases}\leq\lambda:H_{1}\\ >\lambda:H_{0}\end{cases}  \tag{4}\]  
where \(N\) is the number of samples and \(\lambda\) is the entropy threshold calculated with the entropy \(H_{X}\) for X bins and described in Equation (5). The probability of a false alarm is \(P_{FA}\) and \(\sigma_{e}\) is the standard deviation [8]. \[\lambda=H_{X}+Q^{-1}(1-P_{FA})\times\sigma_{e} \tag{5}\]  
The cooperative results are measured for the probability of detection (\(Qd\)) and the probability of false alarm (\(Qfa\)) measured at FC and are calculated by Equations (6) and (7) [20]. \[Q_{d} =1-\prod_{i=1}^{Z}(1-P_{d,i}) \tag{6}\] \[Q_{fa} =1-\prod_{i=1}^{Z}(1-P_{fa,i}) \tag{7}\]  
where \(Z\) is the number of SUs in the CSS.