Spectrum Sensing in Cognitive Radio Networks: Threshold Value Optimization and Analysis

Cognitive radio is a technology developed for the effective use of radio spectrum sources. The spectrum sensing function plays a key role in the performance of cognitive radio networks. In this study, we propose an online learning algorithm for the energy detection scheme, which aims to maximizing spectrum detection performance. Optimal threshold value, which is critical for the determination of the absence or the presence of a licensed user, was mathematically expressed in accordance with the balance between probability of detection and probability of false alarm. Performance of the proposed algorithm was tested on non-fading and different fading channels for low signal-to-noise ratio (SNR) regime with noise uncertainty. In conclusion of the simulation studies, improvement in spectrum detection performance according to optimal threshold value selection was observed. study, the between missed detection probability false alarm new mathematical expressions obtained for the threshold value and various wireless fading channels. detection error distributions are analyzed and derived from mathematical expressions for decision threshold. A novel analytical expression is used to calculate the probability of detection in different fading channels. We compare the theoretical results of detection probability of AWGN, Rayleigh, Rician, Nakagami- m and Weibull fading channels with the simulation results using an online learning algorithm based spectrum sensing.


Introduction
Wireless communication systems are undergoing rapid development in order to meet the changing demands and needs of people. The increase in wireless applications and services made it essential to address spectrum scarcity problem. Measurements made by the Federal Communications Commission (FCC) of the United States telecommunications authority have shown that licensed bands are not used at a rate up to 90%. The results of the measurement were published by the FCC Spectrum Policy Task Force group in the report entitled "FCC Report of the Spectrum Efficiency Working Group" [1], [2].
In recent years, a lot of research has been done on the effective use of these spectrum bands which are either empty or are not used at full capacities. One of the notable concepts in these researches is the cognitive radio concept, introduced by Mitola in 1999 [3]. Cognitive radio is a software-based technology that detects the electromagnetic environment in which it operates, detects unused frequency bands and adapts the radio working parameters to broadcast in these bands [4]. Cognitive radio systems enable the detection of unused spectrum bands, and allow secondary users to employ unused spectrum bands without the need of primary systems intervention.
Spectrum sensing is a critical issue of cognitive radio technology because of shadowing, fading, and time-varying natures of wireless channels. Some of the techniques used for spectrum sensing are matched filter detection, cyclostationary feature detection, eigenvalue detection and energy detection [5], [6]. Matched filtering detection methods with shorter detection periods are preferred if certain signal information is known, such as bandwidth, operating frequency, modulation type and grade, pulse shape and frame structure of the primary user [7], [8]. The detection performance of this method is largely depends on the channel response. To overcome this, it requires perfect timing and synchronization in both physical and medium access control layers. This situation increases the complexity of calculation [9]- [11]. Cyclostationary detection is a method for detecting primary user transmissions by exploiting the cyclostationarity features of the received signals [12], [13]. It exploits the periodicity in the received primary signal to identify the presence of primary users. In this way, the detector can distinguish primary user signals, secondary user signals or interference. However, the performance of this detection method depends on a sufficient number of samples, which increases the computational complexity. If there is no prior information about the noise signal or the primary user signal, the eigenvalue detection method is used [14], [15]. In the eigenvalue-based methods utilizes the eigenvalues of the covariance matrix of the received signal to detect the absence or the presence of the primary signal [16], [17].
Nevertheless, having a high operational complexity is a disadvantage of this method. Similarly, if the information of the primary users are not known precisely, energy detection based methods with low mathematical and hardware complexities are preferred [18], [19].
Energy detection is a spectrum sensing technique where measuring the received signal energy and deciding on the presence or absence of the primary user, by comparing the received energy level with a threshold.
Threshold function calculation is based on noise power. Numerous studies have been carried out in the literature to obtain the optimal threshold value expression, and to improve spectrum sensing performance [20]- [25]. In [20], the authors proposed a new method for adaptive threshold selection in multiband detection.
Estimating the threshold value is performed by using the functions of the first and second statistics of the received signal. In [21], the Wigner-Ville distribution is used to improve detection performance at a low SNR.
In this case, a better decision threshold is defined by reducing the effects of the cross-correlation terms. In [22], using Gauss-Hettite integration, analytical expressions of detection and mean field probabilities on compound Nakagami-m and log-normal fading channels were obtained, and detection performance was investigated. In addition, an optimized threshold value expression was obtained to increase the spectrum detection performance.
In [23], an energy detector, using an adaptive dual threshold, is proposed for solving the detection problem. In [24], the authors proposed an adaptive threshold detection algorithm based on an image binarization technique.
Here, the dynamic threshold value is estimated based on previous repetition decision statistics, parameters such as SNR, number of instances, and detection probabilities. In [25], a dynamic threshold detection scheme was proposed depending on the noise level present in the received signal. For the measurement of the noise level, a blind technique based was used on the sample covariance matrix values of the received signal.
The disadvantage of the energy sensing method is that it is dependent on noise power. Little change in power of noise can result in large decline in the performance of energy detector due to SNR thresholds. In order to minimize the negative effects caused by noise uncertainty, cooperative spectrum sensing model is defined in the literature [26], [27]. In [26], the researchers proposed a fuzzy logic-based perception format for collaborative energy detection, based on the new reliability factors for local spectrum sensing. The fuzzy logic process consists of three stages. These are the ordering of blurring, the run-in motor and the clearing phase. The performance of the nodes is compared with the performance of the other nodes to try to make the most accurate predictions. When these processes are performed, the reliability factor is defined by using the SNR, detection differences and threshold values, and the detection performance is measured. In [27], energy detector parameters are optimized for the best detection performance. Simulation studies have been carried out on fading channels in relation to the optimal threshold, number of cognitive radio users and number of antennas.
In recent years, it seems that there is a serious increase in working with artificial intelligence and machine learning algorithms (MSA). In [28], the authors proposed a sensing method based on machine learning for solving the spectrum sensing problem. This method is dependent on signal characteristics and the clustering algorithm that is used for classification. The received signals are classified by using the k-means clustering algorithm. Class parameters, eigenvalues and covariance were determined, and the performance of the proposed algorithm was investigated. Using the MSA, it is stated that the error probability decreased and the detection performance increased. In [29], the researchers proposed an online learning algorithm-based energy detection for the solution of the spectrum sensing issue. In the study, the balance between missed detection probability and false alarm probability was observed, and new mathematical expressions were obtained for the threshold value expression. In this paper, the work presented in [29] has been expanded and developed by considering various wireless fading channels. More specifically, spectrum detection error distributions are analyzed and derived from mathematical expressions for decision threshold. A novel analytical expression is used to calculate the probability of detection in different fading channels. We compare the theoretical results of detection probability of AWGN, Rayleigh, Rician, Nakagami-m and Weibull fading channels with the simulation results using an online learning algorithm based spectrum sensing.

of 20
The rest of this paper is organized as follows: Section 2 considers theoretical aspects of energy based spectrum sensing. Optimal thresholds are presented with a sufficient optimality condition in Section 3. Section 4, the optimal threshold value expression is redefined and formulated by using the proposed online learning algorithm. Simulation results are discussed in Section 5 and finally the paper is concluded in Section 6.

System Model
Spectrum detection is one of the most important components of cognitive radio networks. Among spectrum sensing techniques, energy detection is the most widely used method since it is low complexity and it does not require prior information about of the primary signals. In the energy detection process, the spectrum occupancy decision is based only on the threshold value obtained depending on the noise. To decision the presence or absence of the primary user, the threshold value is compared to the perceived energy. It aims essentially to decide between two states: primary user signal is absent, denoted by 0 , or primary user signal is present, denoted by 1 . The decision of energy detector is the test of the following hypothesis: where ( ) is the signal received by secondary user and ( ) is primary user's transmitted signal, ( ) is the Additive White Gaussian Noise (AWGN) with zero mean. Fig. 1 shows the basic block diagram of the energy detection. where = 0,1,2,3, … … , , which represents the number of samples (detection period). If sample numbers are sufficient, the T statistic distribution, according to the central limit theorem, is Gaussian distribution [30].
The binary hypothesis test is redefined as follows, where 2 and 2 are the noise variance and signal variance, respectively.
Test statistic is greater than threshold, ( ≥ ), it can be concluded that the primary user is present and hypothesis 1 will be declared. Contrary to that, if the test statistic is less than threshold, ( < ), it can be concluded that the primary user is absent and hypothesis 0 will be declared. According to [31], the probabilities of detection and false alarm are given by, where Q-function ( ) is expressed as follows.

Threshold Detection
The performance of energy sensing-based medots is largely dependent on the previously defined threshold value expression [32], [33]. A threshold is required to decide whether the target signal is absent or present. This threshold determines all spectrum sensing performance metrics. The sensing performance of the energy detector is measured according to two metrics. The performance metrics and over AWGN channels will then be given as [34], [35]: Probability of miss detection would be given as, The balance between and should be considered when determining the threshold value for the energy detector.
should be maximized, while should be minimized. This is called the constant false alarm rate (CFAR) detection scheme.
can be set to a minimum value, or can be reduced to a minimum by fixing to a maximum value. In practice, the threshold is normally chosen so as to meet a certain , in situations where only the noise power needs to be known. Depending on the balance between and , for a certain value is derived as: Due to this threshold at low SNR, the detection performance is greatly reduced. What is important here is to improve the low SNR perception performance. For this reason, the optimal threshold value is defined by using the total error probability, , which is dependent on and . If a priori information of the spectrum occupancy is available and given by 1 , 0 , which represent the probabilities of primary user presence and absence respectively, where 1 + 0 =1. The total error probability is the sum of and weights.
can be given as the threshold can be obtained by satisfying following conditions given below [35].

Proposed Adaptive Threshold Optimization
In cognitive radio systems, the detection performance of the energy detector depends on the threshold value selection. When developing spectrum detection models, it is aimed that the noise and primary user signals are fully distinguished. Developed models are generally evaluated based on parameters such as accuracy and correct positive rate. However, the actual performance can be analyzed by using backwardly artificially generated estimates in the measurements. The performance of the energy detection method, which is used to solve the spectrum sensing problem, is dependent on the threshold value that is defined according to the noise power.
The fundamental nature of spectrum sensing is a binary hypothesis-testing problem that is dependent on the threshold value expression. This relationship is illustrated in Figure 2. This shows the expected distribution of a difference between two groups under 0 and 1 . It should be clear that, if we increase the type I error rate (false positive (FP) or false alarm), we reduce the type II error rate (false negative (FN) or missed detection), and vice versa. This results in a change in the accuracy of the 0 (true negative (TN)) and 1 (true positive (TP)) hypotheses, depending on the change in total error probability. In this study, the relationship between the probability of false alarm and the probability of missed-detection is investigated by using an online learning algorithm. Two classes are constructed by classifying the negative and positive data, as shown in Fig. 2. Type I and II error parameters and correct perception parameters are analyzed. Critical thresholds are determined for these classes, creating a gray area.

Fig. 2 Statistical Distribution Curves Related to Classes
The process steps for obtaining the optimal threshold value with the aid of the online learning algorithm are given below.

Stage 1: Data collection and Pre-processing
The gauss distribution curves of 1 (signal present) and 0 (signal absent) are obtained by using the threshold value expression in Equation 22. Two classes are constructed by classifying the negative and positive data, as shown in Fig. 2. Type I and II error parameters and correct perception parameters are analyzed. Critical thresholds are determined for these classes, creating a gray area.
i. Each ( , ) values are determined and classes are created.
ii. Critical thresholds value expressions of the two classes are defined ( , ).
The data in the gray area, defined as R in Figure 2, is divided into subclasses using the k-means algorithm( = 4). Generated classes are graded in terms of performance levels, taking into account the type I and II errors. In order to increase the success levels of the successful classes, error analysis and error coefficients and weight sequences were obtained. An improvement is defined with the aid of weight sequences.

Stage 2. Computation on the data set
The data obtained during the data collection and pre-processing phase are defined as weight and error statements to be used in the model. These expressions respectively; i. Weights are defined for each subclass.

Stage 3: Training Phase
We are provided with a training data set ( , ), = 1,2,3, … … . . , where represents an n-dimensional continuous valued vector and {0,1}represents the corresponding class label with "0" for normal and "1" for anomaly. The proposed method has two steps: 1) training and 2) testing. During training, the k-means-based anomaly detection method are first applied to partition the training space into k disjoint clusters subdivided phases 1) Selection Phase and 2) Classification Phase. In selection phase, compute the Euclidean distance for every testing instance and find the closest cluster. Compute the decision tree for the closest cluster.
In classification phase, the data are separated according to the detection successes. Finally in this phase, threshold will learn from the best learner in class. Learner modification is expressed as,

Stage 4: Learner Phase
In this phase, through comparing the advantages and disadvantages between other two learners, the learners will learn from their advantages which draw on the idea of differential evolution algorithm. Randomly select two learners and , where ≠ . Learner modification is expressed as where ( ) is a uniformly distributed random number between "0" and "1". Accept if it gives a optimum threshold.

Simulation Results
In this section, numerical results are presented to verify the effectiveness of our proposed algorithms. The performance of the energy detector may be characterized by using the receiver operating characteristic (ROC) curve in cognitive radio networks. ROC curves are generated by plotting either detection probability versus false alarm probability or missed detection probability versus false alarm probability Detection probability and false alarm probability depend on the threshold, number of samples, fading parameters, number of diversity branches, and average SNR. In fig.3fig.7, simulation results are provided to compare our (online learning algorithm) threshold selection with a conventional (dynamic) threshold selection (calculated from = 0.1).
ROC curves are plotted for different SNR values. Learning Threshold (-10dB): =0.3439. Fig.4 -fig.7 illustrate the ROC curves for Rayleigh, Nakagami-m, Rician and Weibull channels, respectively. When the graphs are examined, it is clearly seen that the detection performance of cognitive radio increases with the proposed method. In addition, detection probability is less in Rayleigh fading channel when compared to AWGN channel and other fading channels. This situation is clearly seen in fig. 4 and table 1. In fig.6, we can see that the performance of energy detector in Rician fading channel is better than in the other channels (Rician factor K=5).

Fig. 3
The ROC curve over the AWGN channel for different SNRs  The threshold and detection probabilities for different fading channels are given in table 1. It is found that for = 0.1, there is improvement in detection probability in the spectrum sensing, in the complete low SNR region, which is of great significance. According to the table, detection probability is the highest in Rician fading channel when compared to Rayleigh, Nakagami-m, Weibull fading channels and AWGN channel. It has been observed that the online learning algorithm has extremely good performance compared to other traditional methods. This is because conventional methods offer a solid threshold value model. The proposed method in this study has made the threshold value expression flexible. Furthermore, with the proposed online learning algorithm, the spectrum detection performance has been made more sensitive to the changes in the communication channels.

Conclusions
In this paper, we have analyzed the performance of energy detection in low SNR, deriving new threshold expression. In the first instance, the new threshold value expression was formulated using the online learning algorithm to minimize the total error rate due to limited false alarm and miss-detection probabilities.
Subsequently, the detection performance is analyzed theoretically over AWGN and different fading channels (Rayleigh, Nakagami-m, Rician, Weibull). The simulation results show that a significant improvement in spectrum detection efficiency compared to conventional detection schemes.

Declarations
Abbreviations SNR: Signal-to-noise ratio