1 Introduction

The advancement of 5G technologies and modern wireless communication systems had led to the scarcity of spectrum resources [1]. From different studies, it has been reported that there is a variation of spectrum usage from 7% to 34%. So, to overcome the scarcity of the limited spectrum resources, Cognitive radio (CR) appeared as a potent approach that can balance the trade-off of demand and availability of spectrum resources [2, 3]. The main concept of CR is to reuse the available unused frequency bands. These are also termed white spaces or spectrum holes. This method also ensures that there is no interference in the spectrum of licensed users [4]. The licensed user is technically termed a primary user (PU) whereas unlicensed users are termed as a secondary user (SU) (Fig. 1). The CR technology allows SU to access the available unused spectrum frequency bands in a non-interfering way to PU [5]. This makes spectrum sensing highly robust and efficient. An intelligent, multi-dimensional, adaptive, and wireless communication device that learns from its experience, plans, and determines future behavior to meet customer needs, can be described simply as a cognitive radio [6]. Cognitive radio has two major characteristics. One is the cognitive capacity that collects the information from its radio environment is the skill of cognitive radio technology. The second is reconfigurability that makes it possible to dynamically program the cognitive radio according to the radio environment necessary.

Fig. 1
figure 1

An Example of Cognitive Radio Network

The four key functions of Cognitive Radio [7] are spectrum sensing, management, sharing, and mobility. Radio is continually looking for the unused bandwidth known as the void in the spectrum. This cognitive radio property is known as spectrum sensing. Once the spectrum holes are located, the available hole or channel is chosen by the cognitive antenna. This cognitive radio property is referred to as spectrum management. As long as the primary user does not require it, the property of cognitive radio to delegate the spectrum holes to secondary users is called spectrum sharing. It is the property where, when a licensed (primary) user is identified, the cognitive radio (CR) vacates the channel.

One of the aspects of 5G transmission is spectrum sensing for fast data transmission and utilization of limited spectrum band. Empty spectrum was utilized for the elimination of congestion created due to traffic of a large amount of data. An efficient spectrum sensing algorithm is integrated with current 5G technologies. There is no way for disruption or delay of communication. Radio frequencies only can obtain spectrum sensing in cognitive radio [8]. To make the idea of cognitive radio performance, witnessing a licensed user’s unused spectrum is important. Thus, the primary user is sensed to enable the mobility of the SU’s channel in another part of the spectrum; if the primary user initiates the transmission. Efficient hardware is needed with minimal error. The detection threshold is the key. The intervention in the worst-case scenario should be considered. Future study of the spectrum and decisions rely on the right sensing of the primary consumer. This is known as the dynamic management of the spectrum.

Parametric and non-parametric schemes are two categories for spectrum sensing (SS). In the condition of parametric sensing, there is a need for prior PU activity information. Whereas in non-parametric schemes there is no need for any prior information. Therefore, non-parametric SS is preferred over parametric SS [9]. There are some conventional non-parametric (SS) techniques, for example, matched filter, cyclostationary, and energy detection are commonly used to their low computational complexity [10]. The matched-filter detection is used when the CR has previous information about PU. In this condition, a matched-filter can be considered to be the best detection technique. It’s precise since the signal-to-noise ratio (SNR) is maximized. The matched filter coincides with the time version of the received signal. The primary user presence is calculated by a contrast between the final output of the corresponding filter and the specified threshold. Therefore, the matched filter will work weakly if this information is not correct. Similarly, a spectrum sensing technique that can distinguish the modulated signal from the additive noise is the implementation of a Cyclostationary function detector. Cyclostationary is a signal, provided it has a normal mean and autocorrelation. The identification of cyclostationary features will differentiate PU signal from noise and use the information present in the PU signal that is not present in the noise at a very low Signal to Noise Ratio (SNR). Due to its low computational and application complexity, energy detection is the most common means of spectrum sensing. No prior information about the primary users is required by the receivers. An energy detector (ED) essentially considers the primary signal as noise and, depending on the energy of the signal detected, determines the presence or absence of the primary signal. Even though these conventional SS methods have low computational complexity but these low detection rate with increasing communication advancements.

With the advancement of communication technologies from 5G to 6G, it is needed not only to adapt to the changing environment but also to adapt its hardware [11]. The current spectrum sensing techniques for cognitive radio network (CRN) requires the adoption of artificial intelligence or machine learning features. The journey of the communication system towards 6G needs deep learning trained transmission control because the traditional approaches consume a large amount of time and need prior information about PU and spectrum. So, to resolve issues of the traditional approach in CRN, this paper presented an application of computational intelligence algorithms (machine learning or deep learning) due to their learning ability so that they can learn the features of spectrum data and predict the spectrum availability at base transceiver stations in 5G.

1.1 Scope of the research

This paper is focused to design a blind spectrum sensing algorithm with the application of deep learning for cognitive radio (CR) system. The main scope of this paper is to mitigate the limitations of existing spectrum sensing algorithms for PU misdetection and to allow interference-free sensing of the spectrum. Based on the properties of the input data covariance matrix, this paper formulates the application of deep learning for spectrum sensing techniques. This paper employs the approach to detect PU activities in a blind state in which the sensing unit doesn’t have prior knowledge about the PU activities or channel state. To overcome the limitations of practical spectrum sensing, aggregation of the most advanced method is expected. The data covariance matrix has different descriptive features such as energy, eigenvalues, etc.

It can be noted that the CNN model can learn the 2-D structured input data matrix. It has the powerful capability to extract correlation features from input covariance matrices. Whereas at the same time RNN can extract temporal features and can find time-shifted correlation features from the covariance matrix. In this paper, we propose the hybrid ensemble approach of CNN and RNN to extract energy correlation as well as temporal correlation to learn the PU’s activities and pattern for spectrum sensing.

1.2 Key contributions of research

The key contributions of this paper are as follows:

In this paper, a state-of-the-art about spectrum sensing in cognitive radio is discussed along with detection techniques and associated challenges. Related works of researchers are also focused in this paper to explore their advantages and limitations for further improvement.

  • We have proposed an ensemble deep learning model that supports a non-linear function termed ensemble CNN and RNN (ECRNN) to test the presence of PU in data samples.

  • Further, we have also conducted simulation analysis under different test conditions to prove the efficiency of the proposed model concerning existing models.

1.3 Organization of Paper

The remaining section of this paper are illustrated to be as follows: Section 2 describes related works about spectrum sensing or detection in cognitive radio networks. In Section 3 paper illustrates the problem statement summarized from existing works. Section 4 gives a descriptive overview of the system model. Section 5 gives information about the performance parameters used. Finally, in Section 6 conclusion, limitations and future research scope are discussed.

2 Related work

In CRN, one of the major research topics for industrial application is spectrum sensing as the demand for high-speed data transmission is increasing day by day. The major function of spectrum sensing technologies is to sense the availability of spectrum. In the last few years, there is the development of different techniques for spectrum sensing for different scenarios such as blind, semi-blind, and non-blind. One of the approaches for the blind scenario was proposed by [9] termed as maximum to average eigenvalue ratio detector (MAER) and arithmetic to the geometric mean detector (AGM) [10] in which there is no need for known noise power. Similarly, in [12], a maximum eigenvalue detector (MED) and generalized likelihood ratio test-based signal subspace eigenvalues detector (GLRT-SSE) [13] was developed for the semi-blind scenario. This is termed semi-blind because there is a need for known noise power. Whereas in the condition of non-blind network scenario, sensing samples are needed for the detection process of PU. It has been reported in [14] that in non-blind conditions, there is the transition of PU from the silent state to transmission state and remains in the same period for the entire process. The Hidden Markov Model [15], had resolved the issues related to PU for such activities. In the current research area, machine learning or deep learning is also proposed for spectrum sensing. The local spectrum sensing quality can be improved by introducing the concept of cooperative spectrum sensing (CSS) whose function is to combine the local sensing information. In [16], the application of deep reinforcement learning (DRL) was adopted to classify the SU signals and resolved the CSS issues by reducing the signaling of SUs. Another deep learning approach such as long short-term memory (LSTM) [17] and convolutional neural networks (CNNs) [18] was proposed to detect available spectrum by learning the correlation between the energy of PU signals. In [19] hierarchical CNN model was proposed to learn co-relation between the energy of PU signals as well as the pattern of PU activities recorded from previous sensing data to enhance future sensing performance. It should be noted that CNN has shown up its capabilities to learn spatial features extracted from signals. At the same time, LSTM had shown up their capabilities for extraction of temporal features from energy correlation samples.

In [20] a combined CNN-LSTM detector was used. The energy correlation features are extracted from multiple sensing inputs and PU activity pattern was learned. The detection probability was increased by analyzing PU activities. The limitation of CNN-LSTM is that its computational complexity is somehow dependent on its input. In [21] spectrum sensing was proposed using LSTM which established the temporal correlation from spectrum data. The PU activity is also exploited to improve the performance of CR. The PU activities such as off period and the duty cycle is used as statistics to train the LSTM network. The detection process and classification accuracy were improved in terms of training time and execution time. The drawback of [21] was observed that it doesn’t support multiple PU and SU scenarios which are considered to be a generic scenario. In [22] efficiency of DL is presented for spectrum sensing. But still in these DL algorithms learning process is generally based on a single feature that degrades performance in the noisy scenario. Furthermore, in [23] spectrum sensing is performed using two-autoencoder for OFDM scenario that gives better performance over traditional OFDM. In [24] CNN model is used for cooperative spectrum sensing (CSS) for multiple secondary users in a cognitive radio network (CRN) by using spectral and spatial correlation of each sense. In [25] deep reinforcement learning was used to explore the spectrum sensing issues in CRN. Even though these existing deep learning algorithms improve the detection performance that needs prior statistical knowledge. These methods are vulnerable to noise uncertainty.

3 Problem statement

The main working principle of spectrum sensing techniques to sense the available spectrum at base transceiver stations and to check whether the primary user is present or not. So, this arises an issue to track all channel statistics, spectrum characteristics to predict the available spectrum with high probability. During the last decade, there are much research presented, the most used statistic is the covariance matrix that contains different discriminative detection features. The key problem associated with spectrum sensing traditional techniques there is a requirement of prior knowledge about both PU signal and noise then only optimal performance is achieved. In traditional non-cooperative detection methods such as energy detection or cyclostationary detection algorithm there arise the problem of hidden terminal that generally occurs when cognitive radio is shadowed due to very low SNR values and detection methods cannot SNR sense the PU’s presence. Designing an effective and robust spectrum sensing technique is a quite challenging task due to the level of complexity, accuracy, computational cost, error rate, etc. These performance parameters create a trade-off between the spectrum sensing technique and its requirements. Therefore, to resolve these issue that arises a need for prior knowledge about primary users, computational intelligence algorithms showed up their efficiency. But still, there is a need to improvise their performance in terms of probability and accuracy of detection with reduced complexity. So, this paper had adopted a deep learning approach for detection and classification of statistics as PU and SU.

4 Methodology

4.1 System model

In this model, we have considered a multi-antenna scenario of cognitive radio, as shown in Fig. 2. This figure illustrates multi-antenna (Am) with observation vector (Vn) for spectrum sensing. The spectrum sensing problem is formulated on the following hypothesis, Eqn (1):

$$ {\displaystyle \begin{array}{c}{H}_0:{Y}_n={U}_n\\ {}{H}_1:{Y}_n={h}_n{X}_n+{U}_n\end{array}} $$
(1)

Where, H0 represents the hypothesis of absence of PU i.e., PU is silent whereas H1 represents the hypothesis of the presence of PU i.e., PU is in an active state. Xn and Yn represents the PU transmitted signal vector as well as the received signal vector. hn∈Cm, that represents the channel index between PU and SU. Un represents the received noise. In some scenarios, it may suffer some path loss or fading. As per the signal vector, we can design the decision statistics that detect PU state to be H1 in test statistics (T) based on decision threshold (Ds). If the T > Ds then it will represent the presence of PUs otherwise, the PUs are absent. As illustrated in Fig. 2, the conventional framework for spectrum sensing in which transmitted signals are sampled together and the further test statistic is calculated for decision making. The CR will collect all signal vectors from multiple SUs system and further features associated with a signal vector such as energy, covariance matrix, co-relation, etc. to design the decision statistics methods such as ED [7, 26], MED [12], CM-CNN [18], CAV [26], etc. Based on a threshold value, test statistics will compare and finally decide the presence of PU. Hence, it can be stated that test statistics have importance for detection performance improvement. So, in this paper, we have focused on the deep learning model to design decision statistics to show its efficiency over existing techniques.

Fig. 2
figure 2

Conventional framework for spectrum sensing

4.2 CNN-based framework for Spectrum sensing

We have adopted the deep learning approach and termed it as ensemble CNN and RNN (ECRNN). As compared to machine learning, deep learning showed up its proficiency of great learning capacity. Another issue with the machine learning problem is the overfitting problem that is resolved by deep learning. Therefore, we have adopted deep learning for PU presence from previous signal statistics. While training there is a requirement of labeled data, even for the deep learning (DL) approach. In this paper, we have taken Y = {(x1,l1), (x2,l2), (x3,l3), ………,(xN,lN)} where Y is termed as a training set having training data of size ‘N’ with input data, xN and lN represents the labeled data. The PU presence is represented by Y. As it is observed that with the increased size of training input, the computational complexity increases. For PU sensing, sampling statistics may contain redundant data, because it may be from the same distribution source. Therefore, there is a requirement to pre-processing the input data before the start of the training process. The energy correlation and cyclostationary correlation are the two most important features that are applied in this paper.

In this paper, we have proposed an ensemble deep learning approach using CNN, as illustrated in Fig. 3. In this, two inputs, sample covariance matrix (⊙n) are fed into two CNN layers and one RNN layer respectively, as covariance matrix is considered to be the complex mathematical problem that contains real and imaginary parts. CNN and RNN layers are illustrated in Figs. 4 and 5 respectively. Here RNN is used for time-shifted correlation feature extraction because it can work effectively in time series data. In the case of the H0 hypothesis, the feature information such as energy is given in diagonal elements of the real part of the matrix whereas, in the case of the H1 hypothesis, feature information is scattered. The difference between features of H0 and H1 is enough for the learning process of CNN. The training covariance matrices (⊙n) of both hypotheses are fed into three layers of CNN. Then each layer works on three different feature vectors out of the input covariance matrix. In this architecture, three features are considered, energy, correlation, and time-shift signal correlation, individually and lastly their decisions are ensembled together to make a final decision of either presence of PU, \( {D}_{H_1}\left({\odot}_n\right) \) or absence of PU, \( {D}_{H_0}\left({\odot}_n\right) \), such that \( {D}_{H_0}\left({\odot}_n\right) \)+\( {D}_{H_1}\left({\odot}_n\right) \)=1 where D stands for decision parameters of CNN.

Fig. 3
figure 3

The network structure of ensemble CNN

Fig. 4
figure 4

CNN Architecture

Fig. 5
figure 5

RNN Architecture

The convolution component in our spectrum sensing structure consists of three sub-blocks. Each sub-block also consists of a convolution layer a leaky rectified linear unit (LReLU) layer, which is also linked together in tandem. The retrieved spatial features of input data are fed into a 2D convolution layer. Each filter is set to 3 × 3 in the convolution layer. The convolution layer depth for the basic ith sub-block is set to Ci. To keep the result as same as that of the input set the stride to one and use the zero paddings. The LReLU layer activation layer complements non-linearity to the CNN. The convolution layer is linear that cannot classify non-linear data without the presence of LReLU. The fully connected layer classifies the function by obtaining the results of extraction of the function. At last, a fully connected (FC) layer is applied that performs classification process taking input from the output of the previous convolution layer. The performance of the FC layers is then integrated into the ensemble classification system. By applying the ensembling approach final decision about the presence of PU or absence of PU is taken with the boosting function. Indexes 1 and 0 will present the presence and absence of PU respectively. The performance of CNN can be decreased there is no information about the presence of SU that makes the learning process difficult. Here, many CNN models with multiple SU permutations can be trained simultaneously that can achieve the highest accuracy. A permutation operation is performed for the correct order of the SU index that can be found in a data array to boost SS efficiency such that the sensing result of neighboring SU is located close to one another. The trained model can then be used to evaluate H1 state or H0 state based on different detecting outcomes. While preparation for the spectrum sensing process can lead to computational overhead, the conclusion of the final sensing result can, as shown later in the performance assessment, be carried out with relatively low overhead so that the operation of our proposed system in real-time is feasible.

4.3 Network training and complexity analysis

4.3.1 Network training

When dealing with the offline based training modules the unlabelled samples are accumulated and constructed to bring about the formation of training data set, (X,L) = {(x1,l1), (x2,l2), (x3,l3),.…,(xN,lN)}.The (X, l) is the training sample in the equation and the value of the example persisting in it. While taking into account only a single example in this set, (x,l) then they in it is indicative of the input value provided to the neural network for the training purpose. The value y as an input can be a raw observation vector or can also be utilized in the form of the test statistic that has been derived from the observational vector. The X and L are indicative of the collections comprising the data associated with x and data associated with l respectively. The architectural design for the training has been done by utilizing the ensembling of CNN and RNN architecture to extract the features from the training set. The study concludes the ECRNN training requires to be dealing with the classification problems as the spectrum identification and sensing is a binary testing challenge. Therefore, the (xN,lN) being a single part of the set, the label for it can be encoded as one vector, Eqn (2):

$$ {l}_N=\left\{\begin{array}{cc}{\left[1\right]}^N,& {H}_1\\ {}{\left[0\right]}^N,& {H}_0\end{array}\right\} $$
(2)

The Training process of ECRNN shall maximize the likelihood, L(⊙), based on Eqn (3).

$$ L\left(\odot \right)=P\left(L|X;\odot \right)=\prod \limits_{k=1}^k{\left(D{\left(\odot \right)}_{H_1}\left({x}_N\right)\right)}^{l_N}\kern0.5em {\left(D{\left(\odot \right)}_{H_o}\left({x}_N\right)\right)}^{1-{l}_N} $$
(3)

In terms of log-likelihood:

$$ {\displaystyle \begin{array}{c}l\left(\odot \right)=\log L\left(\odot \right)\\ {}=\sum \limits_{n=1}^N{l}_N\log D\left(\odot \right)\left({x}_N\right)+\left(1-{l}_N\right)\log \left(1-D\left(\odot \right)\left({x}_N\right)\right)\end{array}} $$
(4)

This can be used for maximizing the cost function, Cf. The posterior probability enhancement P(L|X), can only be achieved by the optimal evaluation that forms the key objective for the proposed model training process.

$$ {C}_f=\max \left(\mathrm{P}\left(\mathrm{L}|\mathrm{X}\right),\odot \right) $$
(5)

The derivation of a well-trained ECRNN model is achieved by continuously updating the ECRNN network parameters via another backpropagation algorithm of calculation that is dependent on the cost function achieved the well-trained network is represented as Eqn (6):

$$ {D}_{\odot}^{\ast }(x)=\left[\begin{array}{c}D{\left(\odot \right)}_{\mid {H}_1}^{\ast }(x)\\ {}D{\left(\odot \right)}_{\mid {H}_0}^{\ast }(x)\end{array}\right] $$
(6)

The expression comprises of the well-trained CNN network having input as x which is indicated by \( {D}_{\odot}^{\ast }(x) \). The expression \( D{\left(\odot \right)}_{\mid {H}_1}^{\ast }(x) \) depicts the class score for H1 or H0. These can be used to derive the posterior probabilities associated with two hypotheses, Eqn (7):

$$ {\displaystyle \begin{array}{c}{H}_1:P\ \left({H}_1|x\right)=D{\left(\odot \right)}_{\mid {H}_1}^{\ast }(x)\\ {}{H}_0:P\ \left({H}_0|x\right)=D{\left(\odot \right)}_{\mid {H}_0}^{\ast }(x)\end{array}} $$
(7)

When the system if completely and efficiently trained with respective parameters, we can say that the training process is converged as well as “well trained”. On referring to the Bayes theorem Eqn (8) [28]:

$$ {\displaystyle \begin{array}{c}P\left(x|{H}_1\right)=\frac{P\left({H}_1|x\right).\kern0.5em P(x)}{P\left({H}_1\right)}=\frac{D{\left(\odot \right)}_{\mid {H}_1}^{\ast }(x).\kern0.5em P(x)}{P\left({H}_1\right)}\\ {}P\left(x|{H}_0\right)=\frac{P\left({H}_0|x\right).\kern0.5em P(x)}{P\left({H}_0\right)}=\frac{D{\left(\odot \right)}_{\mid {H}_0}^{\ast }(x).\kern0.5em P(x)}{P\left({H}_0\right)}\end{array}} $$
(8)

Where, P(x| H1) = conditional probability, P(Hi) = prior probability of Hi, and P(x)= marginal probability. P(x| H1) and P(x| H0) are calculated and the conclusion is drawn that the NP is indicative of the optimum statistic for the test which is the likelihood ratio (LR).

4.3.2 Neyman Pearson detection

To maximize the probability of detection (Pd) for a given PFA, we decide H1 if

$$ {P}_d=\frac{P\left(x|{H}_1\right)}{P\left(x|{H}_0\right)}>{D}_s $$
(9)

The derivation of the ECRNN has been made as Eqn (10), x utilizing the above equations.

$$ {L}_{ECRNN}(x)=\frac{D{\left(\odot \right)}_{\mid {H}_1}^{\ast }(x)}{D{\left(\odot \right)}_{\mid {H}_0}^{\ast }(x)}\kern0.5em .\kern0.5em \frac{P\left({H}_0\right)}{P\left({H}_1\right)}=\frac{D{\left(\odot \right)}_{\mid {H}_1}^{\ast }(x)}{D{\left(\odot \right)}_{\mid {H}_0}^{\ast }(x)}\kern0.5em \geqslant {D}_s $$
(10)

The Ds is the threshold value selected that is derived by the false alarm constraint and the LECRNN(x) is the test statistic framework indicating the ECRNN. The ECRNN testing framework helps in acquiring posterior probabilities for two distinct hypotheses by training the data set of (X,L). However, it has been found that the training process generates posterior probabilities associated expressions that were not suitable for testing the samples that command the requirement of the conditional probability-based derivation of the ECRNN during the detection process. To achieve this P(x| H1) and P(x| H0) are being derived as the conditional probability that utilizes the Bayes’ hypothesis for derivation. The process follows the attaining ECRNN that lays on the NP theorem. Further, the decision-making process shall inculcate comparison with a detection threshold (Ds). The threshold value can even be determined with a method referred to as the Monte Carlo process that aids in achieving the Pd required. The training process is performed using Algorithm as shown below:

figure e

4.3.3 Testing process

The test data that is to be utilized during the detection based on the test framework is represented as \( \overset{\sim }{X} \) for a single as well as multi SU system that aims at achieving this data as a set of unlabelled samples. The ECRNN is trained for \( \overset{\sim }{X} \)samples of the collected data and further the ECRNN steps are processed for the test samples, this is denoted by the Eqn (11):

$$ {L}_{ECRNN}\left(\overset{\sim }{X}\right)=\frac{D{\left(\odot \right)}_{\mid {H}_1}^{\ast }(x)}{D{\left(\odot \right)}_{\mid {H}_0}^{\ast }(x)}\geqslant {D}_s $$
(11)

The inherent comparison with the threshold value that has been preset previously, can bring about the decision-making process after achieving the test statistic. It has also been found that currently, an existing algorithm such as DL-based sensing of the spectrum has the capability of completely replacing the system with the neural network for end-to-end analysis and detection. The work in this process shall not comprise of the provision to define the threshold for attaining the Pd. The ECRNN based schemes for spectral identification hold within itself the framework for determining the current practical threshold value during the function other than other frameworks, whose objective of to keep updating the threshold value to achieve the desired Pd. The complete algorithm of ECRNN (called Specturum Sensing algorithm using ECRNN) is given below :

figure f

4.3.4 Complexity analysis

While training any network, the complexity of CNN for processing one data sample is evaluated to be as in Eqn (12) [29]:

$$ \mathrm{O}\left({\sum}_{p=1}^P{N}_{k,p-1}{S}_{k,p}^2{n}_{c,p}{O}_{k,p}^2\right) $$
(12)

where P = Number of convolution layer with Nk, p − 1 to be the number of input channels. With Nk, p as number of convolutional kernels for pth kernel with the spatial size of \( {S}_{k,p}^2 \) that generates \( {O}_{k,p}^2 \) of the output feature map. We have designed the CNN layer of ECRNN with two convolution layers and taken the input of real and imaginary data of size (S × S × 1). The CNN stride is set to 1 to reduce the computational complexity. While for the RNN network, the computational complexity is dependent on the number of neurons and internal parameters of the network. This can be illustrated in Eqn (13):

$$ \mathrm{O}\left({n}_i\right) $$
(13)

Where ni is the number of neurons present in hidden layers. Therefore, the complexity of ECRNN for one data sample is represented as in Eqn (14):

$$ \mathrm{O}\left({\sum}_{p=1}^P{N}_{k,p-1}{S}_{k,p}^2{n}_{c,p}{O}_{k,p}^2{n}_i\right) $$
(14)

4.3.5 Dataset preparation

In this subsection, the dataset required for training the proposed ECRNN model is prepared. The spectrum data is used for training and test validation purposes. The data is captured through a simulation setup (Fig. 6). The clean PU signal is generated from the generator and its spectrum power is measured as \( {\sigma}_x^2. \)

Fig. 6
figure 6

Dataset Preparation for ECRNN

The Additive white Gaussian noise (AWGN), n, is added to achieve a required signal-to-noise ratio (SNR). This noise is added to PU signal for timestamp t.

$$ \mathrm{X}={\left[{x}_1,{x}_2,\dots .{x}_t\right]}^T $$
(15)

For this study, approx. 5000 data samples are generated in the SNR range − 15 dB to +5 d B having equal number of PU signal and AWGN signals. The generated dataset is divided into 2 sets 70% training and 30% testing samples.

5 Results and discussions

In this section, the simulation setup of ECRNN is presented. In our implementations, we have utilized the MATLAB platform for training and testing scenarios. The training is performed with different data samples having two classes i.e. H1 and H0. The individual CNN or RNN are trained on different signal features and their results are ensembled together to generate the final result.

For training, the model simulation was performed with 10,000 data samples in which 7000 data samples are used for training and 3000 data samples are used for testing. The learning rate was set to be 0.0003 and 64 sample patches are used. The performance metrics are used to show the relationship between the probability of false alarm rate (Pf), probability of detection (Pd), and probability of misdetection (Pm). The variation of Pd concerning Pf is also observed. The training process is performed using Algorithm 1. While Algorithm 2 is used to test the data samples for the presence of PU.

5.1 Relation between Pf and Ds

Theorem 1

In spectrum sensing, theoretically, the probability of false alarm (Pf) is related to decision threshold (Ds) value as following in Eqn (16):

$$ {\mathrm{P}}_{\mathrm{f}}={\left(1-{\mathrm{D}}_{\mathrm{s}}\right)}^{\mathrm{M}-1} $$
(16)

Proof

When there is the presence of noise in the channel, the Cumulative Distribution Function (CDF) of Ds is evaluated as Eqn (17):

$$ {F}_d=1-{\left(1-d\right)}^{M-1},0\le d\le 1 $$
(17)

Where Pf is represented as Eqn (18):

$$ {P}_f={P}_r\left[d\ge {D}_s|{H}_o\right]=1-{F}_d $$
(18)

Where Ho represents the absence of PU.

By substituting the value of Fd into Eqn (19), it has been proved the relationship between a false alarm and decision threshold. So, the threshold can be computed as:

$$ {D}_s={P}_f^{\frac{1}{M-1}} $$
(19)

5.2 Relation Pm and Pd

Theorem 2

For t cyclostationary detection, the Probability of misdetection (Pm) is calculated as in Eqn (20):

$$ {P}_m=1-{P}_d $$
(20)

Proof: Probability of detection (Pd) is calculated as in Eqn (21):

$$ {P}_d={P}_r\Big[\left[d\ge {D}_s|{H}_1\right] $$
(21)

Where,

Q(.) = q-function.

d = signal-to-noise ratio (SNR) at the receiver and H1 represents the presence of PU.

The probability of misdetection(Pm) is calculated as in Eqn (22):

$$ {P}_m=1-{P}_d $$
(22)

Figure 7 represents the graph of Probability of detection (Pd) concerning SNR whereas Fig. 8 represents the graph of Pf concerning the probability of detection Pd. The figure shows that with an increasing number of samples (NoS) the Pd increases. Similarly, Fig. 9 represents the probability of misdetection (Pm) with respect Pf. The figure concludes that with increasing samples the Pm decreases.

Fig. 7
figure 7

Pd versus SNR

Fig. 8
figure 8

Pf versus Pd

Fig. 9
figure 9

Pf versus Pm

5.3 Performance parameters

While simulating the proposed ECRNN model, the performance parameters used here are Receiver Operating Characteristics (ROC) for Pd against Pf for single and multiple PU. The ROC curve represents the area to show the relationship between Pd and Pf. The area increases with increased model performance. Three scenarios are created 1st is to observe at fixed SNR, the second with variable SNR, and the third is variable NoS. The performance of ECRNN is compared with CNN [19] and ED. Another parameter used to evaluate the performance of the proposed ECRNN are computational time and error rate. The time represents the total execution time for performing training as well as testing simulation. The error rate represents the mean square error (MSE) that occurred during training. This is evaluated by finding the mean of the squared difference between target and reconstructed value. MSE is calculated as in Eqn (23).

$$ {loss}_{mse}=\frac{\sum_{i=1}^N\Big({\left({x}_t-{x}_r\right)}^2}{N} $$
(23)

Where, xt = target value, Xr = reconstructed value, N = Number of samples.

5.4 Result analysis

Figure 10 illustrates the comparative ROC curve for different spectrum sensing methods. The figure is plotted for SNR = -15 dB. For comparison, the NoS taken is 20. In the comparison of ECRNN with other techniques such as ED [7] and CNN [30] the training data and scenario are kept the same. This simulation was performed for single PU and single SU and trained accordingly. As each module contains different features and input to CNN is single column so, we have taken a 1-D CNN network. The model was created, trained, and tested on the MATLAB platform using the deep learning library. We can analyze from the graph plot that ECRNN gives a better result as compared to other sensing techniques even at SNR of −15 dB. Due to the ensembled architecture of ECRNN, it gives better performance because it combines the combined results from different features while other existing techniques give results on a single feature such as energy correlation. Figure 9 represents the ROC for the probability of detection (Pd) concerning false alarm (Pf) as well as ROC for the probability of misdetection (Pm) concerning Pf. Figure 11 represents the ROC curve for the Pd concerning Pf as well as the ROC curve of Pm concerning Pf. In this scenario, a comparison was performed with varying SNR values from 0 dB to -15db. The graph illustrates that with increasing SNR the Pd decreases and Pm increases. Figure 12 represents the ROC curve for the Pd concerning Pf as well as the ROC curve of Pm concerning Pf. In this scenario, the comparison was performed with varying data samples with -15 dB SNR. The graph illustrates that with an increasing sample the Pd increases and Pm decreases. Figure 13 illustrates the comparative receiver operating characteristics (ROC) curve for different spectrum sensing methods. The figure is plotted for SNR = -15 dB for multiple SUs scenarios and the NoS taken is 20. The graph represents the ROC for the probability of detection (Pd) concerning false alarm (Pf) as well as ROC for the probability of misdetection (Pm) concerning Pf. Figure 14 represents the ROC curve for the Pd concerning Pf as well as the ROC curve of Pm concerning Pf. In this scenario, a comparison was performed with a varying number of SU, and the values of SNR are -15db. The graph illustrates that with an increasing number of SU the Pd decreases and Pm increases. Figure 15 represents the ROC curve for the Pd concerning Pf as well as the ROC curve of Pm concerning Pf. In this scenario, a comparison was performed with varying data samples with -15 dB SNR under multiple SUs scenario. The graph illustrates that with an increasing sample the Pd increases and Pm decreases.

Fig. 10
figure 10

ROC Curve for single SU

Fig. 11
figure 11

ROC Curve varying SNR for single SU

Fig. 12
figure 12

ROC Curve varying NoS for single SU

Fig. 13
figure 13

ROC Curve for multiple SUs

Fig. 14
figure 14

ROC Curve varying SNR for multiple SUs

Fig. 15
figure 15

ROC Curve varying NoS for multiple SUs

Similarly, Table 1 represents the computational time evaluated in seconds for training and testing samples using the ECRNN algorithm. The algorithm is implemented in MATLAB and executed on a PC with an Intel Core i5 3.71GHz CPU and 2 GB Nvidia graphics with 8GB RAM. In summary of existing work, the proposed method achieves the optimal solution concerning detection. Even though the ECRNN had achieved optimal solution but still there is needed to reduce the computational complexities. If this model is parallelly executed on GPU, then it would be very much helpful to reduce computational complexity. Similarly, in Table 2 error rate is evaluated for the detection process and it can be inferred that ECRNN achieved less training error as compared to the CNN model.

Table 1 Computational Time Analysis (in seconds)
Table 2 Error Evaluation

6 Conclusion

This paper is dedicated to spectrum sensing problems using the application of CNN models. For this ensemble, CNN and RNN technique is developed and termed as ECRNN and presented over single and multiple user scenarios. In the first scenario, a single SU is considered under a varying NoS and varying SNR. Whereas in the second scenario, multiple SUs was considered with varying number of samples, SU and SNR. For training energy, correlation and time-shifted correlation was considered to be as a feature vector and individual DL model was trained and their results are ensembled together to give the final result. The detection of test data samples was performed using an ensemble approach which results in the optimal solution. The simulation results were performed and performance was evaluated by ROC curve analysis as well as time complexity and error rate. The result analysis showed better performance concerning the CNN model as well as the traditional ED model.

In this paper, we provide a theoretical analysis of the advantages of ECRNN over other methods. Then simulation experiments are performed for the probability of detection concerning variable SNR and showed up its robustness as well as scalability. The results have shown that the proposed CM-CNN method could achieve almost the same performance as that of the optimal E-C detector whether the PU signals are independent or correlated.

The limitation of this work is that with increasing SU there is a decrease in detection performance which needed to be optimized. These limitations can be improved in the future by deciding the optimal number of SU that can be handled. In the future, this work will also be enhanced with a path fading channel scenario along with noise.