1 Introduction

The available CR spectrum assets are currently not utilized to the maximum extent possible. Certainly, the CR system can meet this opportunity. The CR system enables unlicensed clients to utilize the channel when the channels are not occupied by licensed clients. The effective use of the CR system requires the assurance that those unlicensed clients do not pose a significant obstruction to licensed clients. There are four critical functional aspects in CR systems: sense the stated spectrum, manage the system, monitor the sharing period and finally hand off the spectrum [3]. The present work is about handing over a spectrum in the CR system. The stated handing over in the CR system occurs when licensed clients enter into a channel that is used by unlicensed clients [1]. The spectrum handoff enables an unlicensed client to abandon its present channel when a licensed client needs to start another transmission in that channel. Then, the SU accesses yet another channel for continuing the incomplete transmission.

In the CR system, two types of spectrum handoffs exist. The first type is the reactive spectrum handoff. In this method, an SU searches for an objective channel that it desires. The spectrum sensing determines whether such a channel is available [7]. If such a channel is unavailable, the SU that is already in the channel is maintained to complete its transmission. Since there are detection and reconfiguration delays, this plan causes additional delays in the system, and it impacts both licensed and unlicensed client transmissions. The second type of spectrum handoff is a proactive spectrum handoff [17, 23]. In this plan, unlicensed clients anticipate the presence of licensed clients in the present channel that is allocated to them and settle on the choice for executing a proactive spectrum handoff. At that point, the unlicensed client changes to another channel before a licensed client possesses the channel. In this manner, this plan’s impacts on the unlicensed and licensed clients diminish. This plan utilizes the past channel usage history data to anticipate future channel utilization [6,7,8].

In [23], in the proactive spectrum handoff, the licensed clients use the greedy channel selection (GCS) strategy. In this plan, a channel is chosen based on the channel utilization data and the expected duration of the administration on each channel. The plan considers just a single match of unlicensed clients in the system, which causes exorbitant impacts between the licensed clients in multi-client arrangements [12]. In [25], a particular conventional proactive spectrum handoff instant, considering the required handoff time, reduces the correspondence interruption, but it increases channel usage. In this system a single unlicensed client is considered. In [12], a proactive spectrum handoff utilizes the meet coordination conspire to conduct forecasting. Therefore, a common control channel is not required [3].

In the GCS, a proactive spectrum handoff strategy for multi-client CR systems is proposed. Performance of the spectrum handoff at a channel due to the greedy channel choice increases the normal throughput of the unlicensed clients, as this plan reduces the impact between the unlicensed and licensed clients. In addition, the channel choice causes the least administration time for the bundle transmission. The unlicensed clients who try to perform a spectrum handoff or begin the correspondence must coordinate with each other to enter the channel. Hence, in multi-client systems, the crash among the unlicensed clients is maintained at a strategic distance [19].

2 Related Works

The spectrum handoff is divided into two strategies. The reactive spectrum handoff [23] searches to find a free channel based on demand. In this plan, an undesirable extra delay in the system can occur due to the detection and reconfiguration delays. Additionally, rare transmission crashes can occur among the licensed and unlicensed clients. The proactive spectrum handoff that is mentioned in [11] requires a spectrum handoff by the unlicensed clients according to the expected utility of the licensed clients. Unlicensed clients change to another channel before a licensed client can enter the channel. The plan aims to reduce the impacts between the unlicensed and licensed clients [23, 24].

In [24], which studies the responsive spectrum handoff, a proactive spectrum handoff is introduced. In [12, 24], unlicensed clients use a proactive spectrum handoff scheme in view of the GCS strategy to choose a channel. In this plan, the channel is chosen using the channel utilization data and the forecast of the administration by noting the start and end times of the sent bundle for every chosen channel. A noteworthy issue of this plan is that it considers it as a combination of the unlicensed clients in the system. In a multi-client organization, this plan creates the largest impacts on the unlicensed clients [12].

Lertsinsrubtavee et al. [12] propose estimating the time utilizing a conventional proactive spectrum handoff. This approach can decrease the correspondence interruption and increase the channel use. This proposal is for a system with a single match of unlicensed clients. This system is a disentangled case and is not helpful in genuine systems. In [12], in the transmission or spectrum handoff, a total likelihood is proposed that measures the channel availability. The past channel usage is also required. The aim is to choose to stay at a channel or to perform a spectrum handoff. Thus, the unwanted spectrum handoff is reduced. There is an increase in the unlicensed client’s utility.

Mo et al. [14] explain the usage of the normal bouncing of a coordinating plot in a conventional proactive spectrum handoff. The parameters of a channel are used to perform a spectrum handoff. This approach reduces the clashes between licensed and unlicensed clients, which increases the throughput of the unlicensed clients. The authors in [5] consider the principle of the proactive spectrum handoff, as suggested by the authors of [14], and then present the scheme of the CRN’s basic multi-client coordinating plot for normal bouncing.

Additionally, by coordinating the basic bouncing, the execution is improved. Additionally, a proper channel determination plot is also provided. The proposed techniques in [5, 14] are further improved by the authors of [12]. Unlicensed clients in different sets may compete to access channels during various “meet coordinating cases,” and this is also presented by the authors.

The CR basically senses or observes the details of the gaps in the entire spectrum to possibly support the SUs. After sensing the spectrum, the next step makes decisions. Based on users’ needs, the optimal channel selection is performed [27]. Based on the spectrum mobility, vacant channel selection is performed, provided that PU is absent [2]. The spectrum handoff occurs when the SU vacates the channel when a PU arrives, and then the SU searches another channel [10].

A computation device is trained using machine learning algorithms to learn from its usage and become more efficient. In CR, machine learning is primarily used to help decision making algorithms utilize known data to select the best channel for SUs. These algorithms must recognize patterns and make the best possible decision by accessing the knowledge base and learning from previous actions [9]. Machine learning algorithms can be generally categorized as follows [26].

  • Supervised learning algorithms This algorithm is a machine learning technique in which the information is a known dataset or labeled training data. The dataset contains training set examples. Each training set can be split into the input and the desired output. In this paper, the focus is on machine learning techniques. Thus, the focus of this paper is limited to the ANN, SVM and logistic regression.

  • Unsupervised learning algorithms In the previous case, the dataset is known, but the data that are used are unlabeled, i.e., they are unfamiliar (no previous knowledge of the dataset).

  • Semi-supervised learning The data are not limited to labeled training, and so it is a supervised classification. Usually, this approach uses unlabeled and large data.

3 Conventional Spectrum Handoff Protocol

3.1 Handoff Triggering

As shown in Fig. 1, the SU communicates in a channel when the PU is absent. When a PU enters, a spectrum handoff must take place. The following steps occur.

Fig. 1
figure 1

Handoff triggering event

  1. 1.

    The SU shall vacate or wait in a high-priority queue. This process occurs when the handoff trigger takes place based on the condition that is given in Sect. 3.2.

  2. 2.

    The SU vacates to a PU using a spectrum handoff [13].

  3. 3.

    Section 3.2 states the condition for the SU to obtain the target channel using the PRP M/M/1 queue model from switch S block.

  4. 4.

    The SU utilizes the SVM algorithm to find a suitable channel to communicate through.

  5. 5.

    The SU resumes the data transmission on the available channel. Such a process will repeat during multiple handoffs.

When a licensed client wants a channel in a conventional spectrum handoff scheme, the unlicensed clients must perform a spectrum handoff. The usage history helps the SU to foresee the PU’s need, and it performs a handoff, thus avoiding a crash. The proposed machine learning algorithm (SVM) scheme is used by the unlicensed clients when they try to access a channel. When k contending unlicensed clients access the principal k number of channels, the system throughput becomes high. Many clients popularly utilize this plan according to the suggested criteria.

Figure 2 displays an illustration of the spectrum handoff for choosing the best possible channel, which is obvious.

Fig. 2
figure 2

Transmission of the primary and secondary users in different channels

3.2 Proposed System Model

The modeled channel accepts a client using the ON and OFF processes. The rectangles represent ON procedures and represent bundle transmissions by licensed clients. In Fig. 2, the PUs are represented by rectangles that are labeled PU. The OFF procedures are the rest of the zones in Fig. 2 and indicate that no information is there for licensed clients to transmit. The preemptive resume priority (PRP) M/M/1 frameworks reflect licensed and unlicensed clients [4, 21].

In this division, some of our model assumptions are introduced. First, a time-slotted system is assumed. Here, at the beginning of each time slot, the SU senses a PU if it is present in the current channel. The SRV split phase coordination protocol function is divided into two phases. These phases are the control and data slots. The control slots help all SUs wishing to start transmissions or to perform a spectrum handoff to synchronize with the control channel. Before starting a transmission, the RTS and CTS handshake signals are exchanged between the SUs. In a data slot, either the PU or SU performs a data transmission [3]. The SU transmits data only if the channel is sensed to be idle. Perfect sensing occurs when the missed detection and false alarm sensing errors are neglected, as in [11, 12, 16].

Any channel can be modeled using a preemptive resume priority (PRP) M/M/1 queuing model. This phenomenon is observed through previous works that address proactive target channel selection approaches, as found in [11,12,13,14,15,16, 19, 25]. We propose the extension of these concepts with a better optimization algorithm. This algorithm is used for a more generalized case of identical channels where the service rates remain the same among all the concerned channels. We assume the inter-arrival rates λ(kt)se, and the service rates μ(kt)se are independent. However, these rates are found to exponentially change with the rates for secondary user. λ(kt)is and μ(kt)is are the rates for the interrupted SU user at channel 1 ≤ kt ≤ Mt, where Mt is the total number of channels. Furthermore, the channels are assumed to be identical to each other following the same service rates. The PUs obviously receive top priority. Imagine that a PU interrupts an SU and performs a transmission. However, the SU determines whether its service time is smaller than the changing time. If so, then the interrupted SU waits at the same channel. The SU resumes the transmission after the PU leaves the channel [15]. Next, the concept of the preemptive resume priority is carried out. Here, two queues are assumed: a higher-priority queue for the interrupted SU and a lower-priority queue for the rest of the SUs that are waiting. This approach facilitates a better transmission without data loss [20].

In our work, the (PRP) M/M/1 queuing network model is employed, as in Fig. 3. The M/M/1 (here, 1 symbolizes the analysis of a single queue) is a basic mathematical model [26] in which the users arrive according to a Poisson process. Furthermore, the processing times or service times of the users are independent and identically distributed, which is also exponential. The interrupted SU can stay in its current channel and wait for the PU to complete its transmission, or it will be taken to a higher-priority queue. It is such that the mentioned SU is given the first opportunity to perform the dispatch while the other SUs wait in the lower-priority queue in the same channel. Of course, the last choice for performing a spectrum handoff and moving to another channel is also possible. The distribution offers the ability to flexibly model customer inter-arrival times or service times. The Poisson distribution is used to determine the probability of a certain number of arrivals in a given time period. The tasks are carried out and processed in the order of their arrival (FCFS). A definite and necessary condition is as follows:

Fig. 3
figure 3

Preemptive resume priority (PRP) M/M/1 queuing model

$$ \rho = \frac{\lambda }{\mu } < 1 . $$

Otherwise, the queue length will explode. These assumptions enable the description of the state of the system spectrum by simplifying the number of jobs in the system at an arbitrary point in time. The reason is that, for an exponential inter-arrival, the processing, the distribution, the next arrival and the service completion times are not affected by the elapsed time due to the last arrival and last service completion times [22]. This observation is due to the memoryless property of the exponential distribution. Further, the FCFS order of the processing means that the past provides no information about the users waiting in the queue. The (PRP) M/M/1 queuing network model is chosen instead of the queuing models, since there is no buffer or population size limitations. In addition, only the mean arrival rate and mean service rate for the implementation are known, which suitably fits our domain [18]. The switching block S is used in the PRP M/M/1 queue model by the SU to determine the staying policy or changing policy. The above section includes the switching block S that helps the SU to determine the service time and the time that is required for changing.

In the next case where the service time of an SU is relatively large, a switching block “S” is employed, which takes over the decision of selecting the target channel based on the following parameters:

  • Maximum vacancy time,

  • SUpower: the power that was transmitted by the PU and received by the SU,

  • PUpower: the power that was transmitted by the PU, and

  • SUdatarate: the data rate that was experienced by the SU in a particular candidate channel.

This process results in lower service times, higher throughput and better training accuracy.

In a single radio remote hub, it is impractical to promptly identify the impacts and transmitting aspects since the receiving side flag receives less energy compared to the transmitted flag. Hence, it is expected that in the projected scheme the two radio units are given to each unlicensed client. The primary function of the transmitting radio is to control and transmit information. The second radio examines and filters the channel and gathers data about the channel use. In addition, the second radio detects the chosen channel and ensures that no SU is there.

3.3 Channel Selection Scheme

The proposed proactive spectrum handoff is conducted in the segment by utilizing the machine learning algorithm. In this plan, each SU will know every channel usage data in advance. These four criteria help the SUs to choose the best possible channel and initiate spectrum handoff. One criterion is the lowest service time, and the next criterion is a channel that has the most empty space. Though the benefit is small, the throughput will be high. Figure 2 illustrates a plot containing the SUs in a CRN model that uses the machine learning algorithm. The above two criteria help the transmitting unit of the SUs to choose the best possible channel.

Figure 2 shows channel number 3 in slot number 1, and SU-1 begins transmitting toward SU-2. This process continues until slot 12 when PU-3 enters the same channel 3 and wishes to transmit. Subsequently, the SU will choose another channel and try to perform a spectrum handoff. Alternatively, using the early criteria, the SU can wait for the licensed client to complete and leave the channel, and then the SU can continue transmitting. The chart shows that the SU continues its transmission in channel number 4 using the channel switch S since it is empty most of the time and requires the least administration time. Again, at schedule vacancy 20, a PU enters channel 4, and again the SU chooses one of the two options that were mentioned earlier.

Next, the CRN in a multi-client framework is considered with N unlicensed clients in M channels. The unlicensed clients compare the time periods in the respective channel and the changing times.

$$ {\text{ST}}_{i} = \left\{ {\begin{array}{*{20}c} {S_{j} \quad {\text{if}} \quad S_{j} < C_{q} + t_{n} } \\ {C_{q} \quad {\text{if}}\quad S_{j} \ge C_{q} + t_{n} } \\ \end{array} } \right. $$
(2)

where Sj is the staying time of the unlicensed clients in the present channel. Cq denotes the channel changing time that is chosen by the SU (j stands for the present channel number referring to the ith unlicensed client, while q denotes the channel change for the same ith unlicensed client). tn is the handoff delay due to the channel switching over. Let the ith unlicensed client proceed to transmitting on the chosen channel with the base time STi. If the staying time is not as long as the changing time, based on the earlier four criteria, the unlicensed client decides either to remain in the same channel or to switch over to the most suitable channel.

4 Proposed Spectrum Handoff Decision Making Scheme Using Machine Learning Algorithm

In this method, as mentioned earlier, there are four attributes for determining the spectrum handoff decision among the set of candidate channels. Using these attributes, the SU that is concerned can perform the spectrum handoff when the PU returns to reclaim its licensed channel. For ready reference, the attributes are again restated. The attributes that are used in the proposed scheme are as follows:

  • Maximum vacancy time,

  • SUpower: the power that was transmitted by the PU and received by the SU,

  • PUpower: the power that was transmitted by the PU, and

  • SUdatarate: the data rate that was experienced by the SU in a particular candidate channel.

According to the set of metrics that were stated above, a choice must be made for selecting the channel that has the longest time period among all channels with zero changing time.

$$ {\text{VT}}_{x} = {\text{sort}}\left( {T_{x} } \right) \;\;{\text{for}}\quad m = 1, 2 \ldots \ldots \ldots , X $$
(3)

where Tx is the channel empty time with a changing time of zero. This time span starts at the moment when the SUs perform a spectrum handoff until the PUs are in the channel. In (3), the vacancy times of the SUs are organized in descending order. VTx denotes the vacancy time of every channel that gets organized in decreasing order. Taking all the criteria into account, unlicensed clients will choose the most suitable channel for their transmission.

We consider PUpower in the range of − 84 to 43 dBm and SUpower in the range of − 123 to 30 dBm for an SU. These ranges are defined with the help of the transmission and reception ranges of the subscriber station (SS) of IEEE 802.22 [3, 13]. The four attributes form an input matrix, as shown in (4). We used five channels and one thousand training examples for each of these attributes.

$$ X = \left[ {\begin{array}{*{20}c} {X_{11} } & \cdots & {X_{1m} } \\ \vdots & \ddots & \vdots \\ {X_{n1} } & \cdots & {X_{nm} } \\ \end{array} } \right] $$
(4)

where m = 15 (4 attributes and 5 channels) and n = 1000 training examples.

Additionally, in addition to the input matrix X, a corresponding output matrix Y (a matrix containing channels that are selected based on the four attributes) is also trained. This output matrix that is shown in (5) is formed to predict a channel for a secondary user test input, which is defined in (6).

$$ Y = \left[ {\begin{array}{*{20}c} {y_{1} } \\ \vdots \\ {y_{n} } \\ \end{array} } \right] $$
(5)

where {y1, y2….yn} are the channels of the corresponding input attributes in X. That is, the channel that is selected for X11….X1m is y1 and so on for the 1000 examples. Hence, as the number of training examples increases, the handoff prediction accuracy increases.

$$ {\text{Test}} = \left[ {\begin{array}{*{20}c} {t_{11} } & \cdots & {t_{1m} } \\ \end{array} } \right] $$
(6)

The test matrix is a \( 1Xm \) matrix containing the attributes of an SU for which a channel is predicted. The X, Y and test matrices are uniformly utilized throughout this paper, and the results are compared in Sect. 5.

The logistic regression is a predictive analysis tool that is used to solve a classification problem. The logistic regression generalizes to two or more discrete outputs yn. This algorithm relates a categorically distributed dependent variable to the independent variables. For the test input in (6), we predict the corresponding probability that “y” is a member of one of our classes, where \( y \in \left\{ {1,2,3,4,5} \right\} \). The conditional probabilities for each of these classes are given as (7), (8) and (9) and finally generalized as (10). These probabilities are derived later in this section.

$$ h_{\alpha }^{1} \left( x \right) = p\left( {y = 1 |x;\alpha } \right) $$
(7)
$$ h_{\alpha }^{2} \left( x \right) = p\left( {y = 2 |x;\alpha } \right) $$
(8)
$$ . \ldots . $$
$$ h_{\alpha }^{5} \left( x \right) = p(y = 5|x;\alpha ) $$
(9)
$$ h_{\alpha }^{n} \left( x \right) = p\left( {y = n |x;\alpha } \right) $$
(10)

Our hypothesis function is selected such that

$$ {\text{prediction}} = \max_{i} \left( {h_{\alpha }^{i} \left( x \right)} \right) $$
(11)

The hypothesis function is formed on the basis of conditional distribution functions. Assume that the training set \( \left\{ {\left( {x1,y1} \right), \ldots ,\left( {xm,ym} \right)} \right\} \) is drawn from the above-mentioned distribution. The input attributes are denoted by \( \alpha . \) The negative likelihood probability function is

$$ - \log p\left( {\alpha |X,Y} \right) = - \mathop \sum \limits_{j = 1}^{m} \log p\left( {y_{j} |x_{j} ,\alpha } \right) - \log p\left( \alpha \right) + {\text{constant}} $$
(12)

Since we assumed that \( p\left( {y_{j} |x_{j} ,\alpha } \right) \) is formed on the basis of the conditional exponential family of distribution,

$$ p\left( {y|x,\alpha } \right) = \exp \left( {\alpha \left( {x,y} \right),\alpha - g\left( {\alpha |x} \right)} \right) $$
(13)

where (14) is the log partition function.

$$ g\left( {\alpha |x} \right) = \log \mathop \sum \limits_{y\varepsilon Y} \exp \left( {\alpha \left( {x,y} \right),\alpha } \right) $$
(14)

4.1 Spectrum Handoff Decision Making Based On Multi-class Support Vector Machine (SVM)

The SVM is a machine learning model that represents training examples as points in space such that the separated classes are as far away as possible. Unlike the logistic regression, the training examples are mapped only to one of the classes, thus making it a non-probabilistic classifier. In our paper, we used a 5-class SVM and the inputs are the same as those of Sect. 4. As previously mentioned in the one-versus-all approach, we trained 5 two-class problems. That is, we trained the examples of one class that was labeled as 0 and the other class was labeled as 1 and so on for each class. We then calculate the \( \max_{i} \left( {h_{\alpha }^{i} \left( x \right)} \right). \) However, a one-versus-one approach is used here with \( K\left( {K - 1} \right)/2 \) pairwise classifiers, i.e., 1 and 0 pairwise classifiers. For each hypothesis, the examples of one class are labeled 0 and those of the other are labeled 1, while they are not associated with the rest of the examples of the other classes. Thus, the cost function involving all classes is calculated using (18).

From (12), (13) and (14), the negative likelihood of logistic regression takes the following form:

$$ - \log p\left( {\alpha |X,Y} \right) = \log (1 + {\text{e}}^{ - fy} ) $$
(15)

where \( f = w^{T} + w_{0} \) is the log odds ratio and the assumed labels are y ϵ {0, 1}.

For a support vector machine, we use the negative likelihood as the hinge loss, which is given by

$$ L_{\text{hinge}} = \hbox{max} \left( {0,1 - yf} \right) $$
(16)

The cost Function J minimization is

$$ J = \hbox{min} \frac{1}{2}\left| {\left| w \right|} \right|^{2} + C\mathop \sum \limits_{i = 1}^{N} \left( {1 - y_{i} f_{i} } \right) $$
(17)

A variable \( \mu \) is introduced for Eq. (17) to render it solvable. Equation (18) shows the same approach.

$$ J = \hbox{min} \frac{1}{2}\left| {\left| w \right|} \right|^{2} + C\mathop \sum \limits_{i = 1}^{N} \mu_{i} $$
(18)

such that \( \mu_{i} \ge 0, 1 - \mu_{i} \le y_{i} (x^{T} w + w_{0} ) \). C is a regularization parameter that controls the number of errors that can be allowed on the training set and \( \left| {\left| w \right|} \right|^{2} \) is the Euclidian distance between the origin and the hyperplane.

For a two-class problem, as shown in Fig. 4, the examples of the classes are dots and plus signs, the continuous line is the hyperplane, and the dashed lines form the limits of both classes on either side of the hyperplane. The hyperplane can be considered as a threshold based on which the examples are classified. The highlighted examples are the support vectors that lie the closest to the hyperplane. It is not only that we want the instances to be on either side of the hyperplane (decision boundary), but also that we want them to be some distance apart for better generalization. The distance from the hyperplane to the examples closest to it is called the margin, as shown in Fig. 4. Hence, our goal is to maximize the margin. The separating hyperplane is chosen such that it results in the maximum margin for both classes. This is the large margin principle that is used in the SVM, which is unlike the logistic regression where the decision boundary is randomly selected to classify the training examples.

Fig. 4
figure 4

Example of a two-class SVM

Equation (20) is the equation for the hyperplane. Equation (21) is the distance between the closest example (support vectors) and the hyperplane, all of which is depicted in Fig. 5.

Fig. 5
figure 5

Classification of an example and the distance of its separation from the hyperplane

$$ g\left( {\vec{x}} \right) = \vec{w}^{\text{T}} x + \vec{w}_{0} $$
(19)

To calculate the shortest distance between a support vector and a hyperplane, we first find \( \vec{w}, \) which is the perpendicular distance from the origin to the hyperplane, as shown in Fig. 5. The margin is normalized as

$$ z = \frac{{\vec{w}^{\text{T}} x + \vec{w}_{0} }}{{\left| {\left| {\vec{w}} \right|} \right|}} $$
(20)

Consider a point x that is to be classified, as shown in Fig. 5. This point belongs to the decision region R1 if \( w^{\text{T}} x + w_{0} > 1 \), and otherwise, it belongs to the decision region R2. This is generalized in (21).

$$ \begin{aligned} & g\left( {\vec{x}} \right) \ge 1 , \quad \forall \vec{x} \in {\text{class}}\; 1 \\ & g\left( {\vec{x}} \right) \le 1 , \quad \forall \vec{x} \in {\text{class }}\;0 \\ \end{aligned} $$
(21)

The decision boundary is formed by the equation \( g\left( {\vec{x}} \right) \), which is set to 1. Therefore, the margin value becomes

$$ z = \frac{1}{{\left| {\left| {\vec{w}} \right|} \right|}} $$
(22)

Thus, the total margin for either side is

$$ \frac{1}{{\left| {\left| {\vec{w}} \right|} \right|}} + \frac{1}{{\left| {\left| {\vec{w}} \right|} \right|}} = \frac{2}{{\left| {\left| {\vec{w}} \right|} \right|}} $$
(23)

\( \left| {\left| {\vec{w}} \right|} \right| \) is minimized to maximize the margin z. Minimizing \( \vec{w} \) is a nonlinear optimization problem, which is solved using the Karush–Kuhn–Tucker (KKT) method. According to this, the value of \( \vec{w} \) is the summation equation in (24).

$$ \vec{w} = \mathop \sum \limits_{i = 0}^{N} \lambda_{i} y_{i} \vec{x}_{i} $$
(24)

where \( \lambda_{i} \) is the Lagrangian multiplier. Then, to minimize \( \vec{w} \), our goal is to use (25) to maximize the margin.

$$ \mathop \sum \limits_{i = 0}^{N} \lambda_{i} y_{i} = 0 $$
(25)

Hence, for our case in which we have 1 and 0 pairwise classifiers for selecting a channel out of five available channels, the above equations are applied \( K\left( {K - 1} \right)/2 \) times, i.e., 10 times, for each classifier. This approach is clearly implemented in Sect. 4 where the 5-class SVM is trained using the one-versus-one approach. Additionally, for each case, the hinge loss (negative conditional probability) is found, and the maximum value is selected using (16). Then, (16) is substituted in (17) to further minimize the cost function. This minimization is performed in (25) by reducing \( \left| {\left| {\vec{w}} \right|} \right| \) (KKT), thereby maximizing the margin.

5 Results and discussion

In this section, the simulation results (NS-2) of the proposed method, i.e., the proactive spectrum handoff method based on GCS and SVM, are presented. The evaluated throughput is compared with the changes in the different parameters that can affect the throughput of the secondary users. The simulation of the cognitive radio for the primary user and the secondary user nodes is shown in Fig. 6 (Table 1).

Fig. 6
figure 6

Simulation of the cognitive radio for the primary user and secondary user nodes

Table 1 Practical analysis parameters

In Fig. 7, the secondary user average throughput is plotted by varying the primary user traffic. The simulation result shows that by decreasing the primary user traffic load, the secondary user average throughput will increase. With the primary user’s transmission rate of 5 (packet/s), the proposed SVM algorithm results in a 68.7% and 91.1% improvement compared to the probability-based and conventional types, respectively.

Fig. 7
figure 7

Secondary clients’ average throughput with different traffic loads for the primary clients

In Fig. 8, the average throughput is plotted with the different primary user channel utilizations. As the simulation result in NS-2 shows, for the low utilization of the channel by primary users, the aggregate throughput of the secondary users will increase. In fact, secondary users’ packet generation probability λs increases, resulting in extra packets being produced for transmitting. In turn, this phenomenon leads to high competition for the transmissions. Therefore, SUs seek to use the maximum number of unused channels, and ultimately, the aggregate throughput increases. The graph shows the different values of λs, namely 0.05, 0.5 and 0.25.

Fig. 8
figure 8

Secondary clients’ average channel utilization throughput primary clients

In Fig. 9, the average throughput is plotted by varying the number of channels. The proposed SVM spectrum handoff performs better as the throughput of the secondary users increases, and the number of channels is 5 and 10. When the number of channels increases, the secondary users’ average throughput increases due to an increase in the vacant channels. This process continues until the average throughput reaches saturation, as a further increase in the number of channels does not result in any additional opportunities for secondary users to access the channels.

Fig. 9
figure 9

Average throughput of the secondary users with the increase in the total number of channels

In Fig. 10, the average secondary user’s throughput is plotted by varying the number of secondary users. The illustrated graph sets the number of channels at 20. The simulation results show that when the number of secondary users is small, the probability of a secondary user accessing the channel will increase in the proposed SVM method.

Fig. 10
figure 10

Average throughput of the secondary users versus the number of secondary users

In Fig. 11, the average throughput is plotted by varying the total length of the transmission phase. The result shows that by increasing the transmission phase length, the aggregate throughput of secondary user decreases, since the access channel remains unoccupied. The graphs are plotted for three different values of γ with respect to the channel utilization of the primary users.

Fig. 11
figure 11

Average throughput of the secondary users versus the length of the transmission phase

In Fig. 12, the average throughput is plotted by varying the packet generation of secondary users under different channel utilization rates for primary users, where γ is 0.05, 0.2 and 0.5. The simulation results show that with a high packet generation rate for secondary users, the probability of secondary users accessing the channel will increase.

Fig. 12
figure 12

Secondary clients and the average throughput with the secondary clients’ packet generation rate

In Fig. 13, the number of handoffs is plotted by varying the number of channels. The proposed SVM spectrum handoff outperforms the other algorithms that are included in the graph with respect to the decrease in the number of handoffs by secondary users.

Fig. 13
figure 13

Number of SU handoffs vs number of channels

The channel posterior probabilities with the five channels are plotted in Fig. 14. The channel probability refers to the conditional probability in the context of a known likelihood. In the proposed SVM method, channel 1 is chosen with maximum posterior probability since its training accuracy is 97.6%.

Fig. 14
figure 14

Posterior probabilities of the candidate channels

Figure 15 shows that the training accuracy of the proposed SVM algorithm is better than those of the existing ANN and logistic regression methods. The SVM method’s training accuracy is 30% higher than that of the logistic regression and 20% higher than that of the ANN.

Fig. 15
figure 15

Comparison of the SVM algorithm with the existing algorithm based on the training accuracy

6 Conclusion

The projected proactive spectrum handoff algorithm uses four parameters to arrive at the best possible channel selection for the secondary user. Those four parameters include the transmitted and received power, the service time, the data rate and the maximum vacancy time. This method successfully generates the preference order of channels for the secondary users to perform the CR spectrum handoff and effectively calculates unlicensed clients’ aggregate throughput. This method prevents the PU and SU from competing with each other. Additionally, this method ensures that SUs do not hinder each other. The PRP/M/M/1 scheme minimizes the number of handoffs. The validations are carried out using the NS-2. By comparing our projected method with the existing spectrum handoff protocol, we can conclude that the stated method is far more efficient at offering an enhanced spectrum allocation than the existing handoff protocol. We have presented an improved throughput that is better than most of the prevailing spectrum handoff protocols.

In the future, this work can be extended for non-identical channels with different service rates by employing other optimizing algorithms. In addition, a new method can be discovered to address an increased number of SUs.