Long Short-Term Memory Based Spectrum Sensing Scheme for Cognitive Radio Using Primary Activity Statistics

The cognitive radio (CR) network consists of primary users (PUs) and secondary users (SUs). The SUs in the CR network senses the spectrum band to opportunistically access the white space. Exploiting the white spaces helps to improve the spectrum efficiency. Owing to the excellent learning ability of machine learning/deep learning framework, many works in the recent past have applied shallow/deep multi-layer perceptron approach for spectrum sensing. However, the multi-layer perceptron networks are not well suited for time-series data due to the absence of memory elements. On the other hand, long short-term memory (LSTM) network, an improved version of Recurrent neural network is well suited for time-series data. In this paper, we propose an LSTM based spectrum sensing (LSTM-SS), which learns the implicit features from the spectrum data, for instance, the temporal correlation (i.e., the correlation between the present and past timestamp).Moreover, the CR systems also exploits the PU activity statistics to improve the CR performance. In this context, we compute the PU activity statistics like on and off period duration, duty cycle and propose the PU activity statistics based spectrum sensing (PAS-SS) to enhance the sensing performance. The proposed sensing schemes are validated on the spectrum data of various radio technologies acquired using an experimental test-bed setup. The proposed LSTM-SS scheme is compared with the state of the art spectrum sensing techniques. Experimental results indicate that the proposed schemes has improved detection performance and classification accuracy at low signal to noise ratio regimes. We notice that the improvement achieved is at the cost of longer training time and a nominal increase in execution time.


I. INTRODUCTION
With the rapid advancement of wireless communication technologies and the advent of the 5G paradigm, spectrum resources have become highly scarce [1]. As per the spectrum occupancy campaign in [2], the overall usage of spectrum band varies from 7% to 34%, which demonstrates significant under-utilization of spectrum resources. Cognitive radio (CR) technology [3] has emerged as a potential solution to trade-off between spectrum availability and its demanding growth. It aims at reusing the temporarily unoccupied fre-The associate editor coordinating the review of this manuscript and approving it for publication was Zihuai Lin . quency bands, known as spectrum holes or white spaces, in an opportunistic manner ensuring that the licensed user does not face any interference [4]. The licensed user in the CR network is referred to as primary user (PU) while the unlicensed user as a secondary user (SU). The underlying principle of CR is to allow the SUs to access the temporarily unoccupied licensed bands in an opportunistic and non-interfering manner [5]. This calls for highly reliable and efficient spectrum sensing schemes [4].

A. CURRENT STATE OF THE ART AND MOTIVATION
Spectrum sensing algorithms can be broadly classified as parametric or non-parametric schemes. Parametric sensing VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ schemes take into account some prior information about the PU activity. However, in practice no prior information is available about the PU, and thus non-parametric sensing schemes are preferred over the parametric sensing schemes [6]. Energy detection, a non-parametric spectrum sensing technique, is widely used in literature due to its low computational complexity and ease of implementation with an experimental setup [7]. However, its performance mainly depends on two key assumptions, the stationarity of noise and the knowledge of its variance [8]. Imperfect knowledge of the noise variance leads to a concept called signal to noise ratio (SNR) wall [9]. Moreover, non-parametric goodness of fit (GoF) tests based sensing schemes like Anderson Darling test [10], Kolmogorov-Smirnov test [11], likelihood, and improved likelihood ratio based sensing [12], [13] among many others, are also proposed in the literature.
Although the main purpose of spectrum sensing is the instantaneous detection of opportunistic white spaces, the sequence of sensing decisions can be utilized to estimate the PU activity statistics and occupancy patterns [14]. PU activity statistics include idle/busy period duration, their minimum duration, mean, higher-order moments and distribution followed by the idle/busy periods [15]. This statistical information can be useful in the CR network to predict the future spectrum occupancy trends, schedule spectrum sensing, selection of appropriate spectrum band and channel of operation for CR system, optimize the system performance and improve the spectral efficiency, see ( [14] and references therein). The estimation of PU activity statistics and spectrum occupancy has received good attention from the research community in the recent past. For instance, the performance analysis of measurement of the duty cycle and channel occupancy rate was carried out in [16]. Authors in [17] proposed the deterministic and stochastic model for spectrum occupancy using a mixture of the beta distribution. Furthermore, the analysis of the estimation of idle/busy period considering exponential distribution was carried out in [18], while considering realistic approximations namely Pareto and generalized Pareto distribution was analysed in [19]. Analysis in the above works have considered the perfect spectrum sensing approach, an ideal scenario. Analysis of occupancy pattern and improving the PU activity statistics prediction based on imperfect spectrum sensing was investigated in [20] and [21] respectively. Additionally, few works also focused on studying the effect of PU activity statistics on spectrum sensing to a certain extent. For instance, the authors in [22] analysed the impact of PU traffic on the sensing performance. PU traffic was modeled as an independent and identically distributed (i.i.d.) two-state random process with an exponential holding times. Spectrum sensing with multiple status changes in PU traffic was analyzed in [23], while the spectrum sensing strategy for dynamic PUs in CR modeled using a two-state Markov chain was carried out in [24], [25]. Although the analytical model based above mentioned schemes performs well, they may be unsuitable for the real environment [26]. Owing to the excellent learning ability using data driven approach and with the rapid advancement in the learning based signal processing techniques [27], machine learning (ML) and deep learning (DL) algorithms have gained wide attention from industry and academia in the context of future wireless networks [28]- [31]. The key advantage of CR network is its cognitive ability, i.e, learning by itself from the radio environment. This is analogous to the ML/DL framework. Thus, ML/DL framework has been applied to CR networks as well [32]- [34].
The basic principle of spectrum sensing is to classify whether the PU is present or absent. Due to the advantages mentioned above, few works have leveraged ML/DL techniques treating spectrum sensing as a classification problem. For instance, Artificial neural network (ANN) based spectrum sensing was carried out in [35]. In [36], a novel ANN-based hybrid sensing scheme was proposed which used energy values and the Zhang statistic [37] as the training features. Recently, the sensing of the OFDM signal at a low SNR regime using a naive Bayes classifier was proposed in [38]. Furthermore, few works have also applied the DL approach for spectrum sensing. For instance, a convolutional neural network (CNN) based spectrum sensing was proposed in [39]- [41], CNN based cooperative sensing in [42] while stacked auto-encoder based spectrum sensing of OFDM signal was proposed in [43]. The above mentioned ML/DL frameworks have shallow/deep multilayer perceptron network.
One of the limitations of the shallow/deep multilayer perceptron network is its inability to store information due to the absence of memory elements [44], [45]. Hence, multilayer perceptron networks are not well suited for temporal modeling and time-series data [46]. Long short-term memory (LSTM) architecture, an improved version of Recurrent neural network (RNN), is preferable for time series related problems [47]. This is because LSTM consists of several gates in a single neuron to better coordinate the historical (past timestamps) and the current information (present timestamp) in a time series [46] and is thus extensively used for temporal data.
The wireless spectrum data being a time-series data [48], has an inherent temporal correlation (non-zero temporal autocorrelation) present in it [49]. LSTM networks being a DL model, are excellent in learning the temporal dependencies in sequential data [50]. Thus, LSTM implicitly learns all the important features in the spectrum series data resulting in enhanced performance, as will be revealed in the later sections.
There are few related studies in the literature that have used LSTM networks on wireless spectrum data. For instance, authors in [51] proposed a spectrum prediction algorithm using LSTM network while, authors in [52] addressed the modulation classification problem using LSTM network. In [53], the authors have used the Taguchi method for hyperparameter optimization of the LSTM network for spectrum prediction. Additionally, the authors in [54] carried out the mobile traffic prediction using the LSTM network. However, the above studies have addressed the spectrum prediction problem and have shown the comparison in terms of accuracy with other machine learning models. In contrast, we propose the LSTM based spectrum sensing (LSTM-SS) scheme for CR networks. We have utilized the detection probability as a key performance metric and have demonstrated the effect of SNR for different values of false alarm probability. These performance metrics are the key players while dealing with the design and dimensioning of CR networks, which the aforementioned works have not considered. Moreover, as mentioned above, CR users can significantly benefit from the knowledge of PU activity statistics obtained from the spectrum sensing decisions. To this extent, we also compute the PU activity statistics like on and off period duration, duty cycle and propose a non-parametric DL aided PU activity statistics based spectrum sensing (PAS-SS) scheme to improve the sensing performance, which to the best of the authors' knowledge is yet to be reported in the existing literature.

B. CONTRIBUTIONS
The main contributions of this paper can be summarized as below: • Firstly, we examine that the spectrum data is a time series data. This is demonstrated by the non zero autocorrelation in temporal domain. Moreover, LSTM learns the implicit features from the spectrum data, for instance, the temporal correlation (i.e., the correlation between the present and past timestamp). In this context, a novel LSTM-SS scheme is proposed in which the previous sensing event is fed along with the present sensing event. Results indicate remarkable performance improvements, in terms of detection probability and classification accuracy, even at a low SNR regime.
• Secondly, to make the proposed LSTM-SS model robust and unbiased towards high SNRs, the training data set is prepared to include data at very low SNRs in varying proportions. This ensures that the detection performance does not deteriorate at low SNRs.
• Thirdly, based on the spectrum sensing decisions, we compute the PU activity statistics like on and off period duration and duty cycle, utilize it as input feature and propose the PAS-SS scheme to further enhance the sensing performance.
• Lastly, the proposed LSTM-SS and PAS-SS schemes are experimentally validated with spectrum data of various radio technologies captured using empirical test-bed measurement setup. The proposed schemes outperform various ML/DL aided sensing schemes in terms of detection probability.

C. PAPER ORGANIZATION
The remainder of this paper is organized as follows. Section II describes the system model, LSTM preliminaries and briefly describes the spectrum data. The LSTM-SS is proposed in Section III. Section IV focuses on the proposed PU activity statistics aided LSTM based spectrum sensing. Section V describes the empirical measurement setup. Experimental results are discussed in Section VI. Section VII concludes this work.

II. SYSTEM MODEL AND LSTM PRELIMINARIES A. CONSIDERED SYSTEM MODEL
The problem of spectrum sensing can be formulated as a binary classification problem 1 : where y <t> is the received signal at t th time instant, x <t> denotes the PU signal and w <t> is additive white Gaussian noise with zero mean and variance σ 2 . H 0 , the null hypothesis indicates only noise samples while H 1 , the alternate hypothesis indicates the presence of PU signal along with noise at t th instant. In order to exploit the temporal dependencies, the previous sensing event of sample size / temporal length N is fed along with the current sensing event and thus the received signal, in general, can be expressed as: Previous sensing event where N isxthexsamplexsizexandx[·] T xdenotesxthe transpose of a vector.

B. LSTM PRELIMINARIES
The internal structure of LSTM cell is shown in Fig. 1 [46], where y <t> is the input to the cell, a <t> is the output of the LSTM cell, a <t−1> is the previous LSTM output, and c <t> and c <t−1> are the current and previous cell states, respectively. σ u , σ f , and σ o are the values of the update, forget 1 Notations in this paper are modified in order to have consistency with the LSTM notations. VOLUME 8, 2020 and output gates, respectively, is the Hadamard product, tanh is the activation function and ⊕ indicates element-wise addition. The LSTM cell has three prime elements as: 1) Update gate: Decides when to update the current cell state, denoted as the output of σ u . 2) Forget gate: Decides when to discard the current cell, denoted as the output of σ f . 3) Output gate: Controls the output, denoted as the output of σ o . Using the tanh activation function: a vector of candidate values, c <t> , is created in order to update the cell state: where b c denotes the bias term. The values for the update, forget and output gates are computed by applying a sigmoid activation : where W u , W f , and W o are the weight matrices and b u , b f , and b o are the bias terms. An element-wise product is taken between the forget gate ( f ) and the previous cell state c <t−1> , and between the update gate ( u ) and the candidate vector for updation c <t> . Output a <t> is the element-wise product between the output gate ( o ) and the hyperbolic tangent of candidate vector c <t> : C. ABOUT THE SPECTRUM DATA In this work, we have acquired the spectrum data using an empirical test-bed setup, the details of which is described in section V. The empirical test-bed consist of two measurement setup. Data acquisition using setup-I is through universal software radio peripheral (USRP) while setup-II contains digital spectrum analyzer (DSA). The radio technologies measured using setup-I includes FM broadcasting, UHF TV band, GSM-900 DL, and DCS-1800 DL. For each channels, a sequence of 8 · 10 6 samples were captured. This data is utilized in the proposed LSTM-SS scheme. In the setup-II, the DSA was tuned according to the parameters described in Table 4. GSM-900 DL radio technology was selected and the data was captured. The acquired data using DSA can be represented as a two dimensional matrix with columns representing the frequency bins, rows representing the time instants, while the corresponding entry in the matrix represents the power spectral density (PSD). The sweep period of one second was selected i.e., data was recorded every second. Thus, the number of rows (data-points) per day is 86,400 (24 hours × 3600 seconds). However, as we tuned to a single channel in the GSM band, the number of frequency bin was one i.e, one column. In all our experiments, we used one day data for the evaluation of the proposed model. For proposed PAS-SS scheme, setup-II was a more convenient choice. This is because the sampling rate of USRP (in setup-I) is very high and thus the activity patterns of a PU channel are difficult and tedious to capture [55].

III. PROPOSED LSTM BASED SPECTRUM SENSING
Traditional ANNs described in [35] have no memory elements and hence lack the ability to store data. Therefore, it is necessary to modify the structure of neural networks to have feedbacks between successive timestamps [44], [45]. Fig. 2 shows the proposed LSTM model comprising of LSTM cells (as described in Section II) and an output cell which goes through the sigmoid activation. Sigmoid activation facilitates the conversion from continuous value output to binary output. The physical meaning of the output of LSTM cell in simple words is the identification of PU's presence.

A. DATASET CONSTRUCTION
In this subsection, the model for proposed LSTM-SS scheme is trained and validated based on spectrum data. The data is captured through an empirical setup, a detailed discussion of which is provided in Section V. From the data captured using measurement setup-I, the clean PU signal is acquired and its power σ 2 x is measured. In order to achieve a given SNR γ , the required power of noise to be added is calculated using the relation σ 2 w = σ 2 x /γ [7]. Additive white Gaussian noise (AWGN) sequence of the power level is generated and added to the signal. For sample of size N , the signal will thus be a vector with 2N timestamps, as shown below.
Each signal vector with sample size N is considered as a sensing event and hence is taken as a training sample for the In order to have the proposed LSTM-SS scheme robust and unbiased towards high SNRs, the training data set includes data at very low SNRs. Algorithm 1 and Fig. 3 shows the dataset construction process from the raw data acquired using empirical measurement setup-I. The generated data are divided into three classes, training (60%), validation (20%) and test (20%) datasets. noisy_signal ← Data + AWGN {SNR is achieved} 6: for i ← 1 to size do 7: signal ← (i) th N samples from noisy_signal As shown in Fig. 4, the training dataset which comprise of 60% of the total samples are fed in batches to different LSTM models, the error is backpropagated during the training procedure, the gradients are calculated and the parameters are updated, as indicated in Algorithm 2. Accuracies of these models on the training and validation sets are evaluated as indicated in Table 1. The training set performance of a given model does not always generalize to other datasets as big models may tend to overfit the training data. Thus, validation set accuracies are considered for choosing the best model. In this subsection, we evaluate the proposed LSTM-SS scheme. The detection probability (P d ) and false alarm probability (P f ) for evaluating the proposed LSTM-SS scheme is computed using the procedure adapted in Algorithm 3. Signal data from the test dataset are fed one by one to the LSTM network and P d , P f are calculated. First, the PU signal vectors at each SNR are forwarded to the LSTM network. The number of times it correctly classifies the signal, VOLUME 8, 2020  In this subsection, we analyse of effect of varying the temporal length (N ) for the proposed LSTM-SS scheme. As depicted in Fig. 2, the length of previous and current sensing events are kept the same. To determine the optimal value of N , we varied N and observed the performance of the proposed LSTM-SS scheme. We observe that there is a trade-off between the temporal length, sensing performance and execution time. For the optimum value of performance and execution time, we have considered N =100 to be a convenient choice in all our simulations, the detailed discussion of which is provided in Section VI.

IV. PROPOSED PRIMARY ACTIVITY STATISTICS AIDED LSTM BASED SPECTRUM SENSING
In this section, we compute the PU activity statistics like on period duration, off period duration, and duty cycle and propose a PAS-SS scheme to improve the sensing performance.

A. HYPERPARAMETER SELECTION AND MODEL TRAINING
The schematic diagram of proposed PU activity statistics aided sensing scheme is as shown in Fig. 5 It comprises of two models. Model 1 consists of LSTM used for the prediction while model 2 consists of ANN used for classification. LSTM in model 1 takes the power levels (in dBm) as input. The input power level is compared to a decision threshold (as discussed in Section VI) and a ground truth is assigned. As shown in Fig. 5, model 1 performs a single step prediction while model 2 performs classification. The model 1 is build with iterative experiments and the final hyperparameters chosen are listed in Table 2. The plot of loss v/s epoch in results section confirms that the designed model is a neither underfit nor overfit. Model 2 is trained iteratively and consist of one hidden layer. Model 2 takes predicted output from model  1 along with the PU activity statistics as an input features and provides PU presence or absence as an output. The proposed PAS-SS can be summarised as below: 1) Provide the raw empirical data to the LSTM model for single step prediction 2) Read the data and convert it to binary format (indicating the presence or absence of PU) by comparing it with the decision threshold as described in the results section 3) Compute the features like T on , T off and Duty cycle (DC) from the above step-2 4) Thus following the step-3, we would have four column vectors representing four features as predicted LSTM output, T on , T off and DC respectively. 5) Iterate the above steps for different values of look back values and for different feature combinations (as depicted in the Fig. 16) Notice that the empirical data in our work are not a streaming data. Thus, step-1 and step-2 need not be executed in parallel. However, it is important that we have the four features i.e, predicted output, on period duration, on and off period duration, and duty cycle before feeding to the ANN (model-2) for classification as indicated in step-4 above. The computation of PU activity statistics is discussed in the next subsection.

B. COMPUTATION OF PRIMARY USER ACTIVITY STATISTICS
For the computation of PU activity statistics like on period duration, off period duration and duty cycle, we consider only one frequency bin for one day data. 60% is utilized as training data-set while remaining 40% as testing data-set.
Once the data is acquired, we set the noise threshold by the method comprehensively described in section VI. By comparing with the threshold, we set the ground truth. If the measured power level is greater than the threshold, we label it one otherwise zero. After labelling the data and depending on the the value of lookback window time used in LSTM, the number of label one counts in the window provides the on period duration (T on ). In similar way, the number of zero label counts indicate the off period duration (T off ). In addition, duty cycle is defined as the fraction of time that the spectrum band is occupied. It can be given as: Once on and off period durations are obtained, duty cycle can be computed as per (10).

V. EMPIRICAL MEASUREMENT TEST-BED SETUP
We deployed an empirical test-bed setup on the roof-top of the School of Engineering and Applied Science, Ahmedabad University for spectrum data acquisition. The empirical measurement setup is shown in Fig. 6. The spectrum data acquired from setup-I is used in the experimental validation of proposed LSTM-SS scheme while the data acquired from setup-II is utilized in the validation of proposed PAS-SS scheme.

A. SPECTRUM DATA ACQUISITION USING USRP-N210
The measurement setup-I is as shown in Fig. 6(a). The hardware consists of a USRP-N210 with a WBX daughterboard, discone antenna (DiamondD-3000N) and a computer system to interface the hardware and software. The software includes GNU Radio and MATLAB. Table 3 shows the different radio technologies (measured channels) and the USRP configuration. With the help of spectrum analyzer, channels with high SNR were identified for various radio technologies (refer Table 4), which were later used to capture PU signal data using the USRP. To ensure that the extreme points of the VOLUME 8, 2020   selected frequency bins are not missed, the frequency bins selected in the spectrum analyzer were kepts lightly wider than those selected in USRP. The data captured using GNU-Radio are further processed offline in MATLAB and then the validation of the proposed LSTM-SS scheme is carried out.

B. SPECTRUM DATA ACQUISITION USING SPECTRUM ANALYZER
The measurement setup-II is as shown in Fig. 6(b). The hardware consists of a digital spectrum analyzer Rigol DSA-875, discone antenna and a computer system to interface the hardware and software. Table 4 shows the tuning parameters of the spectrum analyzer. The spectrum analyzer in setup-II was tuned to the GSM band.

VI. EXPERIMENTAL RESULTS AND DISCUSSION
In this section, the experimental results for the proposed scheme are presented. In our implementations, we have utilized the Keras library with TensorFlow backend to create and train models. Fig. 7 shows the autocorrelation plot of the GSM signal captured using USRP from the empirical setup-I for different values of SNR. The number of lag samples is 10 in each case. Non zero autocorrelation demonstrates that the data samples are temporally correlated. This is because the autocorrelation value does not reduce to zero instantly. This temporal correlation is exploited in this work using LSTM based sensing framework. The training data (from setup-I) was divided into two classes: high SNR class and low SNR class. −4 dB to +4 dB were categorized in the high SNR class, while −20 dB to   LSTM-SS are evaluated using Algorithm 3 and P d , P f are determined.
It is evident from Table 5 and Fig. 8 that the composition of training set has a significant impact on P d and P f . As the percentage of examples in low SNR range is increased, P f and P d also increase. At low SNRs, the magnitudes of the PU signal are similar to that of noise. The LSTM network, therefore, finds it difficult to differentiate between the PU signal and noise.
The proposed LSTM-SS scheme was validated on various radio technologies like FM Broadcasting, UHF Television, E-GSM 900 DL, and DCS 1800 DL, as mentioned in Table 3. Fig. 9 analyses the effect of N on the detection probability of the proposed LSTM-SS scheme for a DCS band data. Fig. 9 (a) depicts the plot of P d v/s SNR for different values of N . The value of N for previous and current sensing events is considered to be the same. We can notice that as N increases, the detection probability increases. A similar trend is observed in Fig. 9 (b). However, as N increases, the execution time increases substantially, and thus we have selected N =100 for all the simulations. Fig. 10 shows a comparison of N for the detection probability of LSTM-SS, CNN, and ANN. Fig. 10 (a) shows the plot of P d v/s SNR for the three schemes. We can observe that the detection performance is highest for the LSTM-SS scheme, followed by CNN and ANN. This is because LSTM exploits the temporal dependency while CNN and ANN fail to do so. Fig. 10 (b) shows the bar graph comparison at SNR = −12dB. As depicted, LSTM-SS outperforms the other schemes for all values of N .
The plot of P d versus SNR for N = 100 comparing the detection performance of different sensing schemes across different radio technologies is as shown in Fig. 11. To have a fair comparison with the results of [36], the P f close to three decimal places was chosen from Table 5. The results show that although the performance of the proposed LSTM-SS scheme at high SNRs is almost the same, it significantly outperforms the ANN-based sensing [36], improved energy detection based sensing [56] and classical energy detection at low SNRs. Fig. 12 provides the comparison of receiver operating characteristics for different spectrum sensing methods. The VOLUME 8, 2020  figure is plotted for N =100 and SNR = −14 dB. The datasets used are FM broadcasting and UHF television. To have a fair comparison of the proposed LSTM based sensing with other schemes like CNN [40], ANN [36] and CED, the data was kept same for all sensing schemes, and the model was designed and trained accordingly. Due to the single column data structure, we adopted the 1D-CNN model while keeping the CNN architecture similar as proposed in [40]. The model was built, trained and tested in Keras library. The first layer was the convolutional layer with ReLu activation function. It was followed by the pooling layer of order 2. The above sequence was repeated as mentioned in the paper followed by the fully connected layer. The dataset was prepared at SNR = −14 dB. Once the model was trained, it was tested on the test dataset. Similarly, for ANN-based sensing, we constructed and utilized the model as mentioned in [36]. We can infer from the plot that the proposed LSTM-SS scheme outperforms other sensing schemes at a very low SNR of −14 dB. The improvement in the sensing performance is because LSTM cells exploit the temporal dependencies present in the signal, which the other models do not consider.
The fundamental reason that why the proposed LSTM-SS scheme outperforms the other sensing schemes like ANN and CNN is the architecture of LSTM. ANN has a simple shallow neural network structure, while CNN has a deep neural network structure. However, LSTM's are designed in a way such that the information persists due to the looping FIGURE 11. Comparison of detection probability for the considered spectrum sensing schemes: proposed LSTM-SS, ANN-based sensing [36], Improved Energy Detection (IED) [56], and Classical Energy Detection (CED) for N=100. structure or (chain-like structure when repeating elements are unrolled), as opposed to ANN and CNN architectures where the looping is absent. In addition, the information flow in LSTM is regulated by the Gate structure (i.e., Update, Forget, and Output gates) such that it performs well on the temporal data. Since the spectrum data in our case are temporal, the LSTM learned all the hidden features well from the data, which inevitably ANN, and CNN failed to do so. Thus, proposed LSTM-SS and PAS-SS schemes perform better than ANN and CNN. Fig. 13 shows the 3D visualization of the spectrum data captured using the empirical setup-II. It can be noticed that rows contain the time instants, columns indicate the frequency bin while the numeric value at some time instant and frequency bin consists of power level in dBm. Once the data is acquired, it is labeled to the ground truth based on the selection of the noise threshold. There are many methods in the literature for selecting noise threshold like computing the mean or choosing minimum/maximum value of noise level and so on. However, these methods are inappropriate, causing the erroneous labeling of data and thus the derived inferences [57]. Therefore, we adopted the probability of false alarm criterion method of noise threshold selection as comprehensively described in [57].
Fig. 14 depicts the method for selecting the noise threshold based on the probability of a false alarm criterion. We plot empirical cumulative distribution function (CDF) of the noise only samples collected after removing the antenna from the spectrum analyzer. This ensures that we are receiving noise only samples. To mimic the inconsistencies of the real world, we allow the false alarm of 1% and project the corresponding value on the x-axis. For our experiments, the noise threshold obtained is −95 dBm. After finding the noise threshold, the proposed model is trained for different values of hyperparameters, as indicated in Table 2. Fig. 15 shows the plot of train and test loss versus the number of epochs. We can notice that the train loss and test loss vary closely with each other and stabilize after certain epochs. This indicates that the model 1 in PAS-SS scheme is neither overfit nor underfit. Moreover, since the model 1 in the proposed scheme (in Fig. 5) is used for prediction, the loss function used is MSE. Fig. 16 indicates the overall accuracy of the proposed PAS-SS scheme. The experiments were performed for different values of lookback times. Moreover, the values of on and off period duration will vary with the lookback time. Different  combinations of PU statistics were fed to the model 2 of the proposed scheme in Fig. 5.
The PU activity statistics are computed by the method described in Section IV-B. Training the ANN with this features primarily means that instead of only learning the predicted output of LSTM (power in dBm), ANN also learns well from the past behavior of PU (i.e., on and off period duration, duty cycle) thus, ANN has improved ability to classify the PU well. We can notice that the overall accuracy was highest for inputs with the predicted output of model 1 and DC. This is because DC inherits the values of on and off period duration as per (10). Notice that training the model 2 only with on period duration also provided a reasonably good accuracy. Moreover, it is interesting to note that when DC, along with on and off period duration was given as an input to model 2, it was reported to not perform well as compared to the previous cases. This may be because ANN may get confused due to feeding the on and off period duration along with DC. We can notice another important observation that as we increase the lookback time, the classification accuracy decreases. This is  due to the fact that data may not be much correlated after the timestep of 10 seconds. In addition, we can also observe that the overall classification accuracy remains constant when no PU activity statistics are utilized. From the LSTM network architecture's view, it means that the learned weights and biases are more accurate as compared to training without the PU activity features. This indicates that the classification accuracy increases when the PU activity statistics are utilized for improving the sensing performance.
The proposed LSTM-SS scheme is also compared with other machine learning algorithms like ANN, Random forest, and Gaussian Naive Bayes in terms of training and execution time. The ANN-based sensing scheme [36] was trained on 50 epochs. For the random forest classifier, the minimum number of samples required to split an internal node was two, and the tree was split until either the leaves had one sample each or all the samples in the leaves were pure. The Naive Bayes classifier was trained with variance smoothing of 10 −9 . It can be observed from Table 6 that the Naive Bayes algorithm has the lowest training and execution time.   Fig. 17 shows the comparison of classification accuracies of the proposed LSTM-SS scheme with other machine learning models. We can notice that at lower SNR, the proposed LSTM-SS scheme provides a significantly improved classification accuracy as compared to different algorithms; however, at the expense of longer training and execution times. We can notice that execution time for the proposed LSTM-SS scheme is 0.788 ms and that for the proposed PAS-SS scheme is 0.802 ms. Although the offline training time is high, it is required only once. The delay is reasonably small such that it can be operated in a real-time manner.

VII. CONCLUSION
In this work, a deep learning aided LSTM-SS scheme was proposed that hat implicitly learns all the important features in the time series spectrum data i.e., it exploits the temporal dependency in the spectrum data. Furthermore, we also compute the PU activity statistics like on and off period duration, duty cycle, and propose a PAS-SS scheme to enhance the sensing performance. The proposed LSTM-SS and PAS-SS schemes are evaluated and validated on empirical data of different wireless technologies captured using two test-bed setups. Results indicate that the proposed LSTM-SS has an improved detection performance and classification accuracy as compared to the ANN-based hybrid sensing scheme, IED, and CED, even under the low SNR regime. In addition, it is also observed from experimental results that significant per-formance improvement is obtained when PU activity statistics are used for sensing. However, the improved performance is at the expense of longer training time and a nominal increase in execution time. Notice that this work considered only a single PU and a single SU. However, the study of multiple PU and multiple SU, which is a generic scenario is an interesting topic of further research.