{'fraction_non_alphanumeric': 0.020935960591133004, 'fraction_numerical': 0.00935960591133005, 'mean_word_length': 4.644346617238184, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Spectrum Prediction in Cognitive Radio Network Using Machine Learning Techniques

Cognitive Radio (CR) aims to achieve efficient utilization of scarcely available radio spectrum. Spectrum sensing in CR is a basic process for identifying the existence or absence of primary users. In spectrum sensing, CR users suffer from deep fading effects and it requires additional sensing time to identify the primary user. To overcome these challenges, we frame Spectrum Prediction-Channel Allocation (SP-CA) algorithm which consists of three phases. First, clustering mechanisms to select the spectrum coordinator. Second, Eigenvalue based detection method to expand the sensing accuracy of the secondary user. Third, Bayesian inference approach to reduce the performance degradation of the secondary user. The Eigenvalue based detection method is compared with Energy detection method in terms of varying false alarm rates and samples. The Eigenvalue detection method achieves better performance than Energy detection method. The Simulation results show that our approach gives better performance in terms of reducing sensing time and increasing sensing accuracy.


Introduction
Nowadays, the abundant growth of wireless applications requires radio spectrum resources. The spectrum resources are very limited due to the fixed spectrum assignment policy. This spectrum scarcity can be solved by the CRN. CR is an eminent approach for spectrum prediction and spectrum allocation. It allows the secondary user to predict the idle spectrum and access it without disturbing the primary user stated as dynamic spectrum access. Thus, the secondary users in CRN continuously sense the channels to identify the spectrum holes, this process known as spectrum sensing. Spectrum sensing is an incredible component for measuring the spectral content and tries to avoid interference with the primary user. Several techniques have been proposed [1] for obtaining the best spectrum sensing performance such as Energy Detection (ED), Matched Filter Detection (MD), and Eigenvalue based detection. Eigenvalue based detection is created on the covariance matrix of the received signal and then observed for the presence of the primary user signal. To evaluate the performance of Eigen value based spectrum sensing, we consider Maximum to Minimum Eigen value based detection (MME). This detection technique is more effective when compared to the energy detection technique. Due to the channel fading, the detection of primary user signals with the individual sensing is not reliable. So cooperative spectrum sensing has been suggested for overcoming the problem of individual sensing [2].
The cooperative spectrum sensing can be broadly categorized into centralized and distributed schemes. For the centralized scheme, the central unit is responsible for collecting the sensing results from each secondary user. The centralized authority is equipped with cognitive capabilities that identify the idle spectrum band and allocates it to the secondary users in accordance with a pre-defined policy. It acts as a coordinator and the remaining secondary users act as members. The selection of the coordinator is done by using various clustering algorithms. The three main advantages of clustering in CR networks are scalability, stability and supporting cooperative tasks. For example, channel sensing and channel access are the essential functions of CR operations. The connectivity and the cooperativeness of CR users based on the improvement of the k-means algorithm is discussed in [3]. As clustering provides cooperative communication between secondary users. The information sharing between the coordinator and its members are spectrum sensing results, SNR (Signal to Noise Ratio) level and the present status of the secondary user. This type of network architecture is a suitable choice for effective dynamic spectrum management [4]. At the same time, the centralized architecture overcomes the challenges of the single node spectrum sensing, and also improves the detection performance and energy consumption.
Considering the challenges in spectrum sensing as well as to improve the spectrum utilization spectrum prediction has been proposed. Spectrum prediction is a key mechanism that aims to avoid the performance degradation of secondary users which consist of channel status prediction, primary user activity prediction and transmission rate prediction. In this article, the Bayes method is utilized to predict the spectrum and the channel is allocated to the secondary user.

Related Works
K-means algorithm is used to improve the connectivity and cooperativeness of cognitive radio nodes [5]. The main idea of this paper is to perform pre-processying task based on clustering. They showed the effect of k-means clustering in terms of exchange messages and execution time. Reyes et al. [6] proposed a method for spectrum sensing based on the autocorrelation of the received samples. They observe the probability of detection and false alarm at different signal-to-noise ratio. This method is compared with the value of the autocorrelation at the first lag and also based on the power of the signal. Two sensing algorithms are suggested in [7], first, the ratio of maximum eigenvalue to minimum eigen value and the ratio is average eigenvalue to minimum eigen value. Random matrix theory is used to calculate the ratio from the maximum eigenvalue to the minimum eigenvalue as the test to identify the presence of primary users in [8] based on signal detection in the Rician fading channel. Patil et al. [9] presented a comprehensive survey of evolutionary achievements of eigenvalue based spectrum sensing algorithm. To decrease sensing time, a multi-taper two stage spectrum sensing is used. Eigenvalue based detection for multiantenna cognitive radio system has been proposed in [10] to reduce noise uncertainty and achieve high detection probability. They transfer the weighting issue of eigenvalue to the energy based detection and originate the theoretical expressions of detection threshold. Charan et al. [11] have projected the optimum number of samples for given SNR and also presented the theoretical analysis and numerical formula for optimum samples. Random matrix theory is used in [12] to compute the Eigen ratio and threshold for the detection method depending on sample covariance matrix of received signal. Zeng et al. [13] have proposed a new method based on the statistical covariance on autocorrelation of the received signal. They used the sample covariance matrix of maximum eigenvalue as the test statistic. Jacob et al. [14] have proposed a simple approach to predict the presence of primary users with the help of Bayesian theorem. The performance of Bayes approach is compared with exponential weighted moving average based approach to predict the status of spectrum occupancy. Marquez et al. [15] have developed a channel availability predictive model to take the advantages of dynamic spectrum opportunity. Additionally, Naïve Bayes algorithm has been used to predict the presence of primary user in each available frequency band. The formulation of realistic control has been used [16] to give the guarantee protection for primary user. They proposed suboptimal scheme to achieve better spectrum utilization at lower complexity and has been constructed based on dynamic interference graph. The doctoral dissertation [17] has presented the spectrum sharing in CRN with security constraints. Particle swarm optimization algorithm is proposed in [18] to assign the channel in CRN. The repair process is used to improve the spectrum usage in CRN and remove the conflicts between secondary user. The existing literatures are referred to identify the presence of primary user by using different sensing methods. In this work, we proposed clustering algorithms to form the spectrum coordinator then the spectrum coordinator identifies the primary user with Eigenvalue based detection method. Finally, Bayesian approach is proposed to predict the spectrum. This will improve the performance of the secondary user.
The major contributions of the work as follows: Forming the spectrum coordinator with different types of clustering algorithms. Sensing the spectrum through Eigenvalue based detection method. Predicting spectrum by Bayesian inference method.

CRN Model Description
The CRN architecture has two components, namely primary network and secondary network. The primary network is a licensed network where the primary users has right to access this network. The secondary network does not have any license in a specific band. But it can access the licensed band without interfering primary users [17]. A simple cognitive radio network model is considered in Fig. 1. It is clear that, the same frequency band is shared between the primary user and the secondary user.
In this model, a denotes the channel power gain of the interference link between PU Tx and SU Tx , whereas b represents the channel power gain of the communication link between SU Tx and SU Rx . Here the PU Tx cause interference with SU Tx but not with SU Rx because it is far away from PU Tx . This model is assumed as single secondary user link. When more number of secondary users are present in a network the communication is difficult related to spectrum access. In a multiuser environment, all users must share the common resource effectively. Fig. 2 illustrates the multiuser environment. The spectrum sharing is classified into dynamic spectrum sharing and cooperative spectrum sharing. The challenges in dynamic spectrum sharing are, the interference between PU/SU and within secondary users. But in cooperative spectrum sensing, the interference between secondary users are reduced. Fig. 3 illustrates the cooperative spectrum sensing model.
Each secondary user is responsible for sensing the spectrum and identifying the free spaces of the spectrum. Now the Spectrum Coordinator (SC) collects all the sensed information from the secondary users and maintains the sensing history. Then SC sends the sensing history to Fusion Center (FC) and proceeds the process of predicting the primary user arrival in the channel. The end result of the spectrum access is directed to SC. Final result is shared between multiple secondary users.

K-Means Algorithm
An unsupervised learning algorithm named k-means is an iterative algorithm that tries to classify the dataset into a k number of clusters. Let N ¼ fn 1 ; n 2 ; n 3 ; . . . ; n n g be the set of secondary users and Y ¼ fy 1 ; y 2 ; y 3 ; . . . ; y k g be the clusters. First randomly select k cluster centers. Then calculate the distance . Assign the secondary user to the cluster center whose distance is minimum. Repeat this process until clusters do not move anymore.

K-Medoids Algorithm
K-medoids clustering is related to the k-means algorithm. Randomly select k users from the given n secondary users as a medoid. A medoid defined as the point in the cluster whose dissimilarities with all other users are minimum. The dissimilarity of medoid ðm n Þ and object ðo n Þ is calculated m n À o n j jand the cost of medoid is calculated as c ¼ P m n P o n em n m n À o n j j. While the cost is decreasing, each medoid m and each object o is swapped and the cost is recomputed. The swap has to be done only when the total cost is less than the previous cost otherwise detaches the swap.

Mean Shift Algorithm
The mean shift clustering is a centroid based algorithm that tries to find a center point of data points. It iteratively moves toward the centroid on each step until convergence. Given a set of k users, the algorithm iteratively assigns each user towards the closest cluster centroid. The continuous shift of the centroid is determined by where most of the data points are gathered. In every iteration each data point will move to closer to the cluster centroid. The main advantage of the mean shift clustering is it automatically discovers the clusters instead of selecting the number of clusters.

Eigenvalue Based Detection
Dynamic detection and effective use of an idle spectrum is termed as cognitive radio technology. The basic functions of CR are namely spectrum sensing, spectrum sharing, spectrum mobility, and spectrum decision. By using these four functions, CR users can employ the idle spectrum for their communications. Spectrum sensing is done by the Eigenvalue based detection method, it follows the concept of the covariance matrix of the received signal. The decision of spectrum sensing is defined between two states: the primary user is present or absent. The covariance of the received signal samples is to decide the same. The received signal is defined as where xðnÞ is received signal samples, sðnÞ are the primary user signal, gðnÞ is the noise and the argument n is the nth sample. The vectors x and s are defined in [6] xðnÞ ¼ ½xðnÞxðn À 1Þ…xð1Þ T sðnÞ ¼ ½sðnÞsðn À 1Þ…sð1Þ T The statistical covariance matrices of the vectors xðnÞ and sðnÞ are in [7] The matrix can be expressed as Suppose if the signal is absent, then R s it is zero and R x has non-diagonal elements. The assumption has led to defining the ratio between the sum of all elements R x : T 1 ¼ P n P m r nm j j and sum of all diagonal elements T 2 ¼ P n r nn j j, The assumption of primary user absence is referred to as T 1 T 2 ¼ 1 and the presence of a primary user is referred to as T 1 T 2 1 1. But sensing errors occur due to additive noise and limited observations. If the idle channel is predicted as busy that is referred to as false alarm. Missed detection refers to when the busy channel is detected as idle. The probability of missed detection (P md ) and the probability of false alarm (P fa ) is defined as In this method, CR users face non-negligible time delay in sensing and low efficiency in spectrum sharing. To overcome these problems prediction based techniques are used.

Spectrum Prediction
Spectrum prediction is a distinct approach to save the sensing time. In this work, the prediction of the spectrum is done by Bayesian inference approach. The prediction requisite is expressed as a Bayesian problem to find the solution through the Bayesian approach. The novelty of this method is that it utilizes the conditional probability of busy or idle previous states to predict the probability of the next idle state.
Bayes theorem is defined in [15] PðM =BÞ ¼ PðB=M ÞPðM Þ PðBÞ PðM =BÞ = is the posterior probability of class s PðB=M Þ = is the previous probability of class s PðM Þ = is the predictor probability of given class s PðBÞ = is the predictor probability In this approach, first prior knowledge is combined with observed data then the posterior probability is assigned to a class based on its prior probability and its likelihood of a given training data. The posterior probability is calculated with different number of hypothesis then the highest hypothesis with probability is selected. This is called a maximum of a posterior hypothesis.
Let assume P ¼ fp 1 ; p 2 ; p 3 ; p 4 ; p 5 g primary users are accessing the licensed spectrum. The secondary users N ¼ fn 1 ; n 2 ; . . . ; n 30 g are trying to access the licensed spectrum without interfering the primary users. Here, the centralized architecture is focused for spectrum sensing. So the head of the secondary users is selected by using k-means, k-medoids and mean shift clustering algorithms. The head is referred as spectrum coordinator which communicates the sensing information between FC and secondary users. The assigned spectrum coordinators are k ¼ fk 1 ; k 2 g.
For example, a channel is divided into 60 time slots. The presence and absence of the primary user is specified in binary states. Each secondary user sense the channel effectively and maintain the sensing history as

T ¼ f01011100011011010101g
We take the sensing history for 20 time slots. The secondary user sends this history to spectrum coordinator and it forwards to fusion center. Now the FC predicts the presence of primary user in future time slots.
First, we assign T as the total number of time slots, M be the number busy slots and N is number of idle slots. Assign B which is the number of times for both previous and current busy slots and I is the number of times for both previous and current idle slots.

Probability of a busy slot is defined as
Probability of idle slot is defined as Probability of future busy state for the given present busy state is where PðM=BÞ refers the probability of busy slots after observing B. PðBÞ is calculate as like where PðN=IÞ denotes the probability idle states after observing I. PðIÞ is considered as Probability of idle slots for current state is busy and future state is idle is stated as = 0.66 The above-said approach supports to predict the probability of future time slots that is calculated from the sensing history done by the FC. For this channel, the 20 th slot is busy but the possibility of idle for 21 st slot is 66%. The same process is followed for all channels. The final decision is forwards to the spectrum coordinator. The predicted probability of single channel is explained in Tab. 1.

Performance Evaluation
In this section, the performance of CRN is discussed with respect to channel sensing and channel allocation. For all simulation purposes, we have used MATLAB environment. The simulation parameters for spectrum sensing are shown in Tab. 2. Simulation results are taken by using BPSK modulated random primary signal. Self-sufficient and identically scattered noise samples with Gaussian distribution are used.
The two SNR ranges are considered in this paper. The first range is referred from [8], they used Rician fading channel for samples 100000. The same range and samples are specified in this paper for Nakagami fading channel and analyse the performance of the detection of the primary user. In paper [11], the author utilizes the second SNR range for Nakagami fading channel but the samples are 200 to 2000. At the same time, we anticipate the second SNR range for observing the probability of detection of primary user in high SNR.
Initially, we assumed that 100 secondary users are continuously monitor the spectrum for data transmission. The spectrum coordinator is selected by using k-means, k-medoids and mean shift clustering algorithms. Fig. 4 Depict the experimental result of k-means algorithm. Here we selected 3 spectrum coordinators out of 100 secondary users based on the distance. The spectrum coordinators are shown in black color. The execution of mean shift clustering is shown in Fig. 6. It is hierarchical in nature, which constructs hierarchy of clusters step by step. Starting on all data points, calculate the mean for which lies inside the window. And move to the window based on the location of the mean. Repeat this process until it reaches convergence.    The comparison of the above three algorithms is illustrated in Tab. 3. In this table, the secondary users vary from 50 to 350. The k-means algorithm provides better performance than other two algorithms. When the changes are made in the number of secondary users k-means algorithm takes minimum time for assigning spectrum coordinator than k-medoids and mean shift algorithms. But mean shift algorithm automatically assigns the clusters whereas k-means assigns the number of clusters in prior.
While using independent and identically distributed signal, the energy detection technique is optimal for detection. But it is not optimal for detecting correlated signal. So this paper focuses on eigenvalue based spectrum sensing. It is based on the eigenvalues of the covariance matrix of the received signal. It is shown that the ratio of the maximum eigenvalue to the minimum eigenvalue can be used to detect the presence of the signal.
First, the sample covariance matrix is calculated from the received signal. Then the ratio is determined between the maximum Eigen value to minimum Eigen value. The ratio is then compared with the threshold value to determine whether the signal exists or not. Fig. 7 shows the power spectrum in 1 to 100 bandwidth. Fig. 8 illustrates the presence of primary user signal in 1 to 1000 bandwidth. Here we identified three primary users in the entire bandwidth.   & 50000) respectively. It is clear that P d is higher for MME when compared to ED with various SNR levels from −25 to −16. The probability of detection for MME is 0.6780 but in (b) the probability of detection is 0.9970. It is showed that, when the number of samples is increase the detection is also increased.
Numerical evaluation of comparison of ED and MME is given in Tab. 4. Here we analyze the performance of detection probability in various false alarm rate for 10000 samples. The MME achieves better detection probability than ED. From the above ROC, it is proved that MME achieves good performance at higher number of samples. The changes in false alarm does not affect in the probability of detection of primary user. Fig. 10 give a picture of a ROC curve between ED and MME with P d vs. SNR. The samples used at this point are (10000 & 50000) but the SNR ratio is −20:3. It is substantiated that, the P d values of MME succeeds improving performance than ED after changing the SNR ratio level. The performance of P d for MME is achieved at −18 dB in Rician fading channel for 100000 samples [8]. But in Nakagami fading channel, the P d is achieved at −16 dB. The comparison of numerical analysis of ED and MME is shown in Tab. 5. Here we change the SNR level as −20:3, P fa = 0.1, 0.2, 0.8 and samples = 10000. The MME achieves better detection probability than ED at −11 dB itself. The comparison of various false alarm rate is calculated. It is clear that, the changes in false alarm does not affect the probability of detection.
Naive Bayes is a classification algorithm; it is easy to implement when the input values are described in a binary form. In this classification, our hypothesis (s) may be the class to assign for a new data (x). The probability of calculating each hypothesis are simplified to calculate the values of each attribute value Pðx 1 ; x 2 ; x 3 =sÞ. The assumption is, the target value is conditionally independent and it is calculated like as Pðx 1 =sÞ Ã Pðx 2 =sÞ Ã Pðx 3 =sÞ and so on.  After calculating the posterior probability for a number of different hypothesis, the maximum probable hypothesis is selected using First, we execute the Bayesian approach for sample datasets and finds the accuracy of training and validation. Fig. 11 refers to the accuracy of the probability of Bayes classification algorithm during training and validation for varying alpha value. It is perceived that; the direction of training is same as the validation. But the training peaks are slightly higher than the validation.  12 describes the comparison between actual probability and predicted probability of signal prediction. The actual probability is referring to traditional sensing of a channel. Due to channel switching and interference with primary user it achieves low probability. But the prediction is done in efficient way and it achieves 95% accuracy in 3 s. This procedure is repetitive for 25 times for one channel and it follows for all channels. The predicted channel is allocated to the secondary user through the spectrum coordinator.

Conclusion
An effective, centralized cooperative method is used to improve the spectrum utilization and to solve the spectrum scarcity problem. Eigen value based detection method is applied to reduce the sensing time and improves the detection performance. Bayes inference approach is utilized to predict the channel quality based on inferred channel idle duration and spectrum, sensing accuracy. The channel is selected based on the channel quality and allocated to the secondary user. The ED and MME are compared in terms of   Figure 11: Bayes classification various SNR levels and number of samples. The simulation results show that the MME gives better performance than ED method. In future, the mobility of secondary user and activity of primary user to be considered and compared with other existing algorithms.
Funding Statement: The authors received no specific funding for this study.
Conflicts of Interest: The authors declare that they have no conflicts of interest to report regarding the present study.