# Improvement and Application of Fractional Particle Swarm Optimization Algorithm

Authors: Jing Li; Chunna Zhao
Journal: Mathematical Problems in Engineering
 (2022)

---

## Abstract

The convergence performance of existing fractional particle swarm optimization algorithm directly depends on a single fractional-order operator. When its value increases, the convergence speed of particles gets slower. When its value decreases, the probability of the particle swarm trapping into the local optimum increases. In order to solve this problem, an improved fractional particle swarm optimization (IFPSO) algorithm is proposed in this paper. New variables are introduced in this paper to redefine the formula. The fractional-order operator is added to the velocity update formula and the position update formula. The IFPSO algorithm has linearly decreasing inertia weights. Then the proposed IFPSO algorithm is used to optimize the parameters of support vector machine (SVM) and the clustering center of the K-means classifier is selected. Experimental results show that the IFPSO algorithm can effectively avoid falling into the local optimal solution. It has a faster convergence rate and better stability than the original algorithm, which proves the effectiveness of the algorithm. Examples verify that the IFPSO algorithm can improve the classification accuracy of SVM in practical application. The IFPSO algorithm effectively solves the problem that K-means algorithm is overly dependent on the initial center and may have empty classes.


---

## Body

## 1. Introduction

Particle swarm optimization (PSO) algorithm originated from the simulation of the foraging behavior of birds. It is widely used to solve multiobjective optimization problems because of simple concept, easy implementation, and fast convergence. However, the PSO algorithm still faces many problems such as slow local convergence speed, trapping into a local optimum in the multimodal function, and uneven distribution of the obtained solutions. Therefore, many scholars are committed to improving the performance of the PSO algorithm. Krohling [1] introduced the Gaussian function into the PSO algorithm and proposed the Gaussian particle swarm optimization (GPSO) algorithm. GPSO does not require inertial weight, and the acceleration factor is generated by a random number that obeys the Gaussian distribution. It can overcome the problem that the searchability and convergence performance of the traditional PSO algorithm depends on a large extent on the acceleration factor and inertial weight setting. Tillett et al. [2] proposed an algorithm that uses the evolutionary ideas of natural selection, called Darwinian particle swarm optimization (DPSO), which dynamically divides the population into several subgroups, and each subgroup searches independently to increase the diversity of particles. It can enhance the global optimization capability of the algorithm. Solteiro Pires et al. [3] introduced fractional calculus into PSO and proposed a fractional order particle swarm optimization (FOPSO) algorithm, which controls the convergence speed of the algorithm by introducing fractional operators to the velocity formula of the particle swarm. On this basis, Couceiro et al. [4] proposed a fractional order Darwinian particle swarm optimization (FODPSO) algorithm to control the convergence speed of the DPSO algorithm. Experiments showed that the FODPSO algorithm is superior to the basic PSO, DPSO, and FOPSO algorithms in terms of calculation accuracy and convergence speed. But, like the FOPSO algorithm, the convergence performance of the FODPSO algorithm also directly depends on the fractional operators α.In response to this shortcoming, based on the FOPSO algorithm, an improved fractional particle swarm optimization (IFPSO) algorithm is proposed in this paper. First, a new fractional operator is introduced into the velocity formula, and a linearly decreasing strategy is adopted for the inertia weight factor. Based on this, a new update formula of particle swarm optimization is constructed, and the comparison results of multiple sets of test functions show that the new optimization algorithm enhances the particle diversity. The improved algorithm shows the controllability of local convergence and the efficiency of global convergence and improves the ability of the algorithm to capture the global optimal solution. In this paper, the IFPSO algorithm is applied to the parameter optimization of support vector machines and K-means. The effectiveness and stability of the IFPSO algorithm are verified by simulation experiments.Inspired optimization algorithms have been used in a variety of fields (such as image detection [5–7], image segmentation [8, 9], parameter optimization [10–13], PID control [8, 14], feature selection [15], scheduling problem [16, 17], K-means (KM) [18, 19], and clustering [20, 21]). The improved PSO algorithms are also used in classification, such as adaptive particle swarm optimization for parameter optimization in classification models [22] and multiobjective particle swarm optimization approach for feature selection in classification [23]. At the same time, the medical decision support system based on machine learning has a good development prospect as described in the articles in [24, 25]. In particular the support vector machine (SVM) training results are stable, and the number of samples required is relatively small. However, its prediction accuracy is not high enough; the improved fractional particle swarm optimization algorithm is applied into optimizing the parameters of SVM in this paper. The IFPSO-SVM is constructed in heart disease prediction model and the red wine classification prediction model. Simulation experiments verify the superiority of the model based on IFPSO-SVM in terms of diagnosis efficiency and accuracy. Diagnosis error is reduced significantly and prediction results have certain practical significance.The IFPSO algorithm is used to optimize the clustering center of the KM clustering. It effectively improves the K-means algorithm’s problems about excessive dependence on the selection of the initial center and sensitivity to noise data. Simulation experiments also confirm that the classification effect of the IFPSO-KM algorithm is more accurate and stable than K-means and PSOK-means, and there is no empty class phenomenon, the classification accuracy is higher, and the clustering effect is relatively stable.The rest of this paper is organized as follows. In Section2, firstly the definition and properties of particle swarm optimization algorithm with a linearly decreasing inertia weight are introduced. Then fractional calculus is given briefly. Lastly, the IFPSO algorithm is derived in this part. Section 3 describes the application examples of IFPSO-SVM. Classification method based on IFPSO-KM algorithm is described in Section 4. Experiments are illustrated and analyzed in Section 5. The conclusions are illustrated in Section 6.


## 2. Improved Fractional Particle Swarm Optimization Algorithm

This section briefly introduces the inertial weighted particle swarm optimization algorithm and fractional calculus, and then the IFPSO algorithm is derived in this part.


### 2.1. Weight Particle Swarm Optimization (WPSO) Algorithm

The standard integer-order PSO is inspired by the swarm’s behavior, where the particles have a synchronized motion during maneuvers such as for searching food and for defense. Thek+1−th iteration of the velocity of the id−th particle Vid can be determined as(1)Vidk+1=w×Vidk+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk,where Pidk is its best position found so far in k−th iteration, Pgdk is the best position found by neighbourhoods of the current particle, and the random values r1 and r2 are between [0, 1]. c1 and c2 are the cognitive and social coefficients that are used to determine the effects of individual and group experience on the particle trajectory. w is the inertia weight factor.After calculating the velocity, the new position of each particle can be computed as(2)Xidk+1=Xidk+Vidk+1.If the inertia weightw in PSO algorithm is set to a fixed value, oscillations are likely to occur around the global optimal solution in the later stage of convergence. To solve this phenomenon, the paper in [26] uses the method of linearly decreasing inertia weight in the PSO algorithm to control the velocity from exploding, and the formula of the WPSO algorithm is expressed as(3)wk=wmax−wmax−wmin∗kkmax,where k is the current iteration number, kmax is the maximum iteration number, wmax is the initial inertia weight value, and wmin is the final inertia weight value.


### 2.2. Fractional Calculus

Fractional calculus is the theory of any order of differentiation and integration, which is derived from the generalization of integer-order calculus. It is closer to the actual situation of the application background. The fractional differential operator is a nonlocality overall operator [27]. The integer differential is only related to the current sampling point and the sampling value of the previous sampling point at the current moment, while the fractional differential is related to the values of all previous sampling points related. The fractional derivative of order α (α∈R), also known as the Grunwald-Letnikov (G-L) definition, defined by the series, can be expressed as(4)Dαfx=limh⟶01ha∑k=0+∞−1kΓα+1fx−khΓk+1Γα−k+1.In the formulation of fractional PSO, the discrete-time approximation is utilized in equation (4); we have(5)Dαfx=1Ta∑k=0r−1kΓα+1fx−khΓk+1Γα−k+1,where T is the sampling period, while r is the truncation order. Γ• represents the standard Euler gamma function, which is mathematically defined by the following relation for a convergent improper integral: Γz=∫0∞e−ttz−1dt.According to the definition of GL, it can be found that the integer-order differential is only a special case of the fractional-order differential. For the fractional calculus of a continuous function at a certain point, not only is it to find the limit at that point but also it is related to the value of the function at all times from the initial moment to the point, so the fractional calculus has memory.


### 2.3. Improved Fractional Particle Swarm Optimization (IFPSO) Algorithm

Since the particle swarm algorithm is based on the long-term dynamic evolution of individual biological populations, the inherent long memory characteristic of the fractional-order model is suitable to describe the optimization process of particle swarms. Solteiro Pires et al. [3] proposed the FOPSO algorithm. The algorithm corrects the order of the velocity derivative by rearranging the original velocity of the particle swarm to control the convergence speed of the algorithm. However, the algorithm does not consider the influence caused by the fixed value of the inertia weight factor. The convergence performance of the existing fractional particle swarm optimization directly depends on the fractional-order α. When the value α increases, the convergence speed of particles becomes slower, and when the value α decreases, the probability of the particle swarm trapping into the local optimum becomes higher. In this paper, new variables are added, and fractional derivation is considered for both velocity and position formulas at the same time to reduce the dependence of the update formula on α, and the inertia weight factor w uses the principle of linear decrease. This method reduces the oscillation while increasing the randomness of the particles and also reduces the probability of the articles falling into a local optimum solution.According to equation (1), the following can be obtained by transforming left and right:(6)Vidk+1−Vidk=w−1×Vidk+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk,where Vidk+1−Vidk is the fractional derivative of the discrete state and, assuming that the sampling period T=1, equation (6) can be extended to the fractional-order derivative:(7)DaVidk+1=w−1×Vidk+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk.Due to the memory characteristics of fractional calculus and considering that the relationship between the particles in the current iteration and the particles of the first few generations has gradually faded, we choose to keep the vector in the current 4 generations (the truncation orderr=4) and let T=1. Using the G-L derivative (equation (5)) to extend the speed formula of the particle swarm algorithm from the first order to any order, one has(8)DaVidk+1=Vidk+1−aVidk−12a1−aVidk−1−16a1−a2−aVidk−2−124a1−a2−a3−aVidk−3.Combining equations (7) and (8), we obtain the speed formula of the fractional-order particle swarm algorithm with linearly decreasing weight factors:(9)Vidk+1=w−1+aVidk+12a1−aVidk−1+16a1−a2−aVidk−2+124a1−a2−a3−aVidk−3+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk.Through the introduction of the fractional differential operator, the current particles are connected with the velocity of the particles of the previous stage, which makes the algorithm have memory. Next, the position formula is also improved in fractional order, and the term of equation (2) can be shifted to obtain(10)Xidk+1−Xidk=Vidk+1.Using the G-L definition to extend it to the fractional differential, we get(11)DβXidk+1=Vidk+1.Whenβ≠1，choose to keep the current 4 generation vectors and take T=1; using the G-L definition (equation (5)) to extend the position formula of the particle swarm algorithm from the first order to any order, we have(12)DβXidk+1=Xidk+1−βXidk−12β1−βXidk−1−16β1−β2−βXidk−2−124β1−β2−β3−βXidk−3.Combining equations (11) and (12) can get the position update formula of the fractional particle swarm algorithm:(13)Xidk+1=Vidk+1+βXidk+12β1−βXidk−1+16β1−β2−βXidk−2+124β1−β2−β3−βXidk−3=w−1+aVidk+12a1−aVidk−1+16a1−a2−aVidk−2+124a1−a2−a3−aVidk−3+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk+βXidk+12β1−βXidk−1+16β1−β2−βXidk−2+124β1−β2−β3−βXidk−3.It can be seen from equation (13) that the position of the particle is no longer only affected by the fractional-order α. The introduction of the fractional-order β makes the updated position also have memory and related to the previous position, and due to the inertia weight factor w uses a linearly decreasing strategy, which protects the diversity of particles.


## 2.1. Weight Particle Swarm Optimization (WPSO) Algorithm

The standard integer-order PSO is inspired by the swarm’s behavior, where the particles have a synchronized motion during maneuvers such as for searching food and for defense. Thek+1−th iteration of the velocity of the id−th particle Vid can be determined as(1)Vidk+1=w×Vidk+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk,where Pidk is its best position found so far in k−th iteration, Pgdk is the best position found by neighbourhoods of the current particle, and the random values r1 and r2 are between [0, 1]. c1 and c2 are the cognitive and social coefficients that are used to determine the effects of individual and group experience on the particle trajectory. w is the inertia weight factor.After calculating the velocity, the new position of each particle can be computed as(2)Xidk+1=Xidk+Vidk+1.If the inertia weightw in PSO algorithm is set to a fixed value, oscillations are likely to occur around the global optimal solution in the later stage of convergence. To solve this phenomenon, the paper in [26] uses the method of linearly decreasing inertia weight in the PSO algorithm to control the velocity from exploding, and the formula of the WPSO algorithm is expressed as(3)wk=wmax−wmax−wmin∗kkmax,where k is the current iteration number, kmax is the maximum iteration number, wmax is the initial inertia weight value, and wmin is the final inertia weight value.


## 2.2. Fractional Calculus

Fractional calculus is the theory of any order of differentiation and integration, which is derived from the generalization of integer-order calculus. It is closer to the actual situation of the application background. The fractional differential operator is a nonlocality overall operator [27]. The integer differential is only related to the current sampling point and the sampling value of the previous sampling point at the current moment, while the fractional differential is related to the values of all previous sampling points related. The fractional derivative of order α (α∈R), also known as the Grunwald-Letnikov (G-L) definition, defined by the series, can be expressed as(4)Dαfx=limh⟶01ha∑k=0+∞−1kΓα+1fx−khΓk+1Γα−k+1.In the formulation of fractional PSO, the discrete-time approximation is utilized in equation (4); we have(5)Dαfx=1Ta∑k=0r−1kΓα+1fx−khΓk+1Γα−k+1,where T is the sampling period, while r is the truncation order. Γ• represents the standard Euler gamma function, which is mathematically defined by the following relation for a convergent improper integral: Γz=∫0∞e−ttz−1dt.According to the definition of GL, it can be found that the integer-order differential is only a special case of the fractional-order differential. For the fractional calculus of a continuous function at a certain point, not only is it to find the limit at that point but also it is related to the value of the function at all times from the initial moment to the point, so the fractional calculus has memory.


## 2.3. Improved Fractional Particle Swarm Optimization (IFPSO) Algorithm

Since the particle swarm algorithm is based on the long-term dynamic evolution of individual biological populations, the inherent long memory characteristic of the fractional-order model is suitable to describe the optimization process of particle swarms. Solteiro Pires et al. [3] proposed the FOPSO algorithm. The algorithm corrects the order of the velocity derivative by rearranging the original velocity of the particle swarm to control the convergence speed of the algorithm. However, the algorithm does not consider the influence caused by the fixed value of the inertia weight factor. The convergence performance of the existing fractional particle swarm optimization directly depends on the fractional-order α. When the value α increases, the convergence speed of particles becomes slower, and when the value α decreases, the probability of the particle swarm trapping into the local optimum becomes higher. In this paper, new variables are added, and fractional derivation is considered for both velocity and position formulas at the same time to reduce the dependence of the update formula on α, and the inertia weight factor w uses the principle of linear decrease. This method reduces the oscillation while increasing the randomness of the particles and also reduces the probability of the articles falling into a local optimum solution.According to equation (1), the following can be obtained by transforming left and right:(6)Vidk+1−Vidk=w−1×Vidk+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk,where Vidk+1−Vidk is the fractional derivative of the discrete state and, assuming that the sampling period T=1, equation (6) can be extended to the fractional-order derivative:(7)DaVidk+1=w−1×Vidk+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk.Due to the memory characteristics of fractional calculus and considering that the relationship between the particles in the current iteration and the particles of the first few generations has gradually faded, we choose to keep the vector in the current 4 generations (the truncation orderr=4) and let T=1. Using the G-L derivative (equation (5)) to extend the speed formula of the particle swarm algorithm from the first order to any order, one has(8)DaVidk+1=Vidk+1−aVidk−12a1−aVidk−1−16a1−a2−aVidk−2−124a1−a2−a3−aVidk−3.Combining equations (7) and (8), we obtain the speed formula of the fractional-order particle swarm algorithm with linearly decreasing weight factors:(9)Vidk+1=w−1+aVidk+12a1−aVidk−1+16a1−a2−aVidk−2+124a1−a2−a3−aVidk−3+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk.Through the introduction of the fractional differential operator, the current particles are connected with the velocity of the particles of the previous stage, which makes the algorithm have memory. Next, the position formula is also improved in fractional order, and the term of equation (2) can be shifted to obtain(10)Xidk+1−Xidk=Vidk+1.Using the G-L definition to extend it to the fractional differential, we get(11)DβXidk+1=Vidk+1.Whenβ≠1，choose to keep the current 4 generation vectors and take T=1; using the G-L definition (equation (5)) to extend the position formula of the particle swarm algorithm from the first order to any order, we have(12)DβXidk+1=Xidk+1−βXidk−12β1−βXidk−1−16β1−β2−βXidk−2−124β1−β2−β3−βXidk−3.Combining equations (11) and (12) can get the position update formula of the fractional particle swarm algorithm:(13)Xidk+1=Vidk+1+βXidk+12β1−βXidk−1+16β1−β2−βXidk−2+124β1−β2−β3−βXidk−3=w−1+aVidk+12a1−aVidk−1+16a1−a2−aVidk−2+124a1−a2−a3−aVidk−3+c1×r1×Pidk−Xidk+c2×r2×Pgdk−Xidk+βXidk+12β1−βXidk−1+16β1−β2−βXidk−2+124β1−β2−β3−βXidk−3.It can be seen from equation (13) that the position of the particle is no longer only affected by the fractional-order α. The introduction of the fractional-order β makes the updated position also have memory and related to the previous position, and due to the inertia weight factor w uses a linearly decreasing strategy, which protects the diversity of particles.


## 3. Prediction Model Based on IFPSO-SVM

In this section, the improved fractional particle swarm optimization algorithm is applied to the parameter optimization of SVM, and the radial basis function (RBF) is used as the kernel function. The improved fractional particle swarm optimization algorithm is used to determine the appropriate error penalty factor and the parameters of the kernel function.


### 3.1. Parameter Optimization of SVM

SVM is a unified framework constructed based on the principle of structural risk minimization to solve the problem of small sample learning. It can learn the optimal prediction results under limited information conditions and can better solve the classification problems of nonlinearity, overlearning, high latitude, and so forth and has good generalization ability. The main point of SVM is to map data to a high-dimensional space with a kernel function. Its classification performance depends on the selection of kernel function type, the setting of kernel function parameters, and the error penalty factor. The setting of the error penalty factorC adjusts the ratio of the confidence range of the learning machine to the nuclear experience risk and ensures that the trained SVM has a better generalization ability. Therefore, choosing the appropriate parameters (C and σ) affected the precision of the SVM significantly. However, there is no mature theory to guide the parameter optimization of SVM. The parameter optimization problem limits the classification effect of SVM in practical applications. Traditional SVM parameter optimization methods mainly include experimental methods, grid search methods, and gradient descent methods [28, 29]. These methods involve a large number of calculations and are easy to fall into local optimal solutions and can no longer meet the current requirements in terms of solving speed and accuracy. In recent years, with the rise of artificial intelligence algorithms, many scholars have applied a variety of metaheuristic algorithms to the parameter optimization problem of SVM, such as the genetic algorithm and the PSO algorithm [30]. However, these optimization methods also have defects such as being easy to fall into local optimum solutions, slow convergence speed, and insufficient accuracy. Therefore, this paper considers using the IFPSO algorithm to encapsulate SVM to build a prediction model, aiming to improve the prediction accuracy and stability of the model.The RBF is as follows:(14)Kxi,yi=exp−xi−yi2σ2,σis the nuclear parameter.The value of the parameter affects its learning ability and generalization ability. From equation (14), it can be found that the radial basis function only needs to determine one parameter, which is beneficial to parameter optimization. The paper in [31] also believes that RBF is a more suitable kernel function. Therefore, this paper selects RBF as the kernel function and then uses the IFPSO algorithm to find the best parameter combination σ,C for SVM.


### 3.2. Predictive Model Algorithm

In this model, the SVM uses RBF as the kernel function, uses the IFPSO algorithm to optimize the parameters of the SVM, determines the appropriate error penalty factorC and kernel function parameter σ, and then builds a complete prediction model. The steps of the algorithm are as follows:Step 1: Set the individual extremum of each particle as the current position, use the fitness function to calculate the fitness value, and take the individual extremum with the best fitness value as the global extremum.Step 2: Calculate and update the current inertia weight factor according to the weight update formula (equation (3)).Step 3: Calculate according to the velocity formula (equation (9)) and position update formula (equation (13)) of the improved particle swarm algorithm to update the velocity and position of the particles.Step 4: Use the fitness function of the particles to calculate the fitness value of each particle after each iteration. Compare the fitness value of each particle with its individual extreme valuepbest; if the fitness value is better, update the individual extreme value; otherwise, keep the original value; compare the updated individual extreme value of each particle with the global extreme value gbest; if the updated individual extreme value is better, update the global extreme value; otherwise, keep the original value.Step 5: Judge whether the iteration value and accuracy range match the optimization conditions. If they are satisfied, this iteration ends, and the next iteration is performed; otherwise, go back to step 3.Step 6: After the iteration, use the best optimized parameters (σ,C) to establish IFPSO-SVM prediction model.The algorithm flow chart of the IFPSO-SVM prediction model is shown in Figure1.Figure 1
Algorithm flow chart of the IFPSO-SVM prediction model.In the particle update process, the inertia weight factor decreases linearly. The new fractional-order update formula is used when updating the velocity and position of the particle. In subsequent experiments, the genetic algorithm mutation operations were added to the particles to increase the randomness and diversity of the particles. The improved fractional particle swarm optimization algorithm is used to optimize the SVM parameters to improve the prediction accuracy of the model.


## 3.1. Parameter Optimization of SVM

SVM is a unified framework constructed based on the principle of structural risk minimization to solve the problem of small sample learning. It can learn the optimal prediction results under limited information conditions and can better solve the classification problems of nonlinearity, overlearning, high latitude, and so forth and has good generalization ability. The main point of SVM is to map data to a high-dimensional space with a kernel function. Its classification performance depends on the selection of kernel function type, the setting of kernel function parameters, and the error penalty factor. The setting of the error penalty factorC adjusts the ratio of the confidence range of the learning machine to the nuclear experience risk and ensures that the trained SVM has a better generalization ability. Therefore, choosing the appropriate parameters (C and σ) affected the precision of the SVM significantly. However, there is no mature theory to guide the parameter optimization of SVM. The parameter optimization problem limits the classification effect of SVM in practical applications. Traditional SVM parameter optimization methods mainly include experimental methods, grid search methods, and gradient descent methods [28, 29]. These methods involve a large number of calculations and are easy to fall into local optimal solutions and can no longer meet the current requirements in terms of solving speed and accuracy. In recent years, with the rise of artificial intelligence algorithms, many scholars have applied a variety of metaheuristic algorithms to the parameter optimization problem of SVM, such as the genetic algorithm and the PSO algorithm [30]. However, these optimization methods also have defects such as being easy to fall into local optimum solutions, slow convergence speed, and insufficient accuracy. Therefore, this paper considers using the IFPSO algorithm to encapsulate SVM to build a prediction model, aiming to improve the prediction accuracy and stability of the model.The RBF is as follows:(14)Kxi,yi=exp−xi−yi2σ2,σis the nuclear parameter.The value of the parameter affects its learning ability and generalization ability. From equation (14), it can be found that the radial basis function only needs to determine one parameter, which is beneficial to parameter optimization. The paper in [31] also believes that RBF is a more suitable kernel function. Therefore, this paper selects RBF as the kernel function and then uses the IFPSO algorithm to find the best parameter combination σ,C for SVM.


## 3.2. Predictive Model Algorithm

In this model, the SVM uses RBF as the kernel function, uses the IFPSO algorithm to optimize the parameters of the SVM, determines the appropriate error penalty factorC and kernel function parameter σ, and then builds a complete prediction model. The steps of the algorithm are as follows:Step 1: Set the individual extremum of each particle as the current position, use the fitness function to calculate the fitness value, and take the individual extremum with the best fitness value as the global extremum.Step 2: Calculate and update the current inertia weight factor according to the weight update formula (equation (3)).Step 3: Calculate according to the velocity formula (equation (9)) and position update formula (equation (13)) of the improved particle swarm algorithm to update the velocity and position of the particles.Step 4: Use the fitness function of the particles to calculate the fitness value of each particle after each iteration. Compare the fitness value of each particle with its individual extreme valuepbest; if the fitness value is better, update the individual extreme value; otherwise, keep the original value; compare the updated individual extreme value of each particle with the global extreme value gbest; if the updated individual extreme value is better, update the global extreme value; otherwise, keep the original value.Step 5: Judge whether the iteration value and accuracy range match the optimization conditions. If they are satisfied, this iteration ends, and the next iteration is performed; otherwise, go back to step 3.Step 6: After the iteration, use the best optimized parameters (σ,C) to establish IFPSO-SVM prediction model.The algorithm flow chart of the IFPSO-SVM prediction model is shown in Figure1.Figure 1
Algorithm flow chart of the IFPSO-SVM prediction model.In the particle update process, the inertia weight factor decreases linearly. The new fractional-order update formula is used when updating the velocity and position of the particle. In subsequent experiments, the genetic algorithm mutation operations were added to the particles to increase the randomness and diversity of the particles. The improved fractional particle swarm optimization algorithm is used to optimize the SVM parameters to improve the prediction accuracy of the model.


## 4. Clustering Model Based on IFPSO-KM

This section uses the improved fractional particle swarm algorithm to select the clustering centers of the KM algorithm. The model effectively solves the excessive dependence of the KM algorithm on the selection of the initial clustering centers.


### 4.1. Improvement Idea of K-Means Clustering

The basic principle of the KM algorithm is a clustering algorithm based on partition. Given a datasetX and the total number of data samples n, first randomly select k initial clustering centers (cluster points), and assign each object to the nearest cluster point to get a set of clusters. Then calculate the average value of each cluster as the new cluster point, and redistribute each data sample to the nearest aggregation point. This process is performed in a loop until the termination condition is met and the algorithm ends. In the KM algorithm, the Euclidean distance formula is used to measure the distance, which is the square root of the sum of the squares of the difference of each attribute. The most commonly used objective function is f=∑j=1k∑xi∈Cjdxi,zj，where xi is the i-th object and zj is the center of the j-th cluster. The purpose of clustering is to find a set of cluster centers which minimizes the above objective function value. However, due to the existence of local extreme points and the greedy nature of the heuristic algorithm, the traditional KM algorithm has the shortcomings of being sensitive to the initial clustering center and easily converging to the local extreme value. In this paper, the IFPSO algorithm is used to find cluster centers, and mutation operation is added in the particle update process, which increases the diversity of particles and dynamically adjusts particles. It avoids the phenomenon of premature convergence of particles in the PSO algorithm and has strong global search capabilities. It also eliminates the dependence of the KM algorithm on the selection of the initial cluster centers. Through the algorithm, the global optimal N cluster centers are obtained and then used as the initial cluster centers to implement the improved algorithm to obtain the ideal cluster division.


### 4.2. Principle of IFPSO-KM Algorithm

Given a sample setX, the total number of data samples is n, which is divided into k clusters to form a partition C=C,1C,2…,Ck. For each cluster center, calculation formula and sample set are obtained. The total cumulative dispersion and formula are as follows:(15)zrj=1nj∑xi∈Cjxi.(16)fZr=∑j=1k∑xi∈Cjdxi,zrj.The fitness value of the particle is calculated according to equation (16), where Zr is the r-th particle (1≤r≤N), N is the number of particles, and zrj is the cluster center position of the j-th class of the r-th particle. dxi,zrj is the distance from the i-th sample data to the corresponding cluster center. The clustering criterion function fZr is the sum of the distances from various samples to the corresponding cluster centers and is also the fitness function of the particles. The particle velocity and position update formula are as follows:(17)Vrt+1=w−1+aVrt+12a1−aVrt−1+16a1−a2−aVrt−2+124a1−a2−a3−aVrt−3+c1×r1×Prt−Zrt+c2×r2×Pgt−Zrt+c3×r3×Pgt−Prt.(18)Zrt+1=Vrt+1+βZrt+12β1−βZrt−1+16β1−β2−βZrt−2+124β1−β2−β3−βZrt−3.Based on the standard particle swarm optimization algorithm, in the process of updating the particle speed, we consider increasing the connection between the global optimum and the local optimum and adding thec3×r3×Pgt−Prt variable on the basis of the previous algorithm (Algorithm 1).Algorithm 1: IFPSO-KM algorithm.
Input: data setXOutput: dividedk cluster center solution setsStep 1: Initialize the population and parameters, determine thek value according to the SSE and Silhouette Coefficient, randomly select k data sample points as the initial center point, and calculate the fitness value of each particle according to the formula.Step 2: Compare the fitness value of each particle with its individual extreme valuePr, and update Pr if the new value is better.Step 3: Compare the fitness value of each particle with the population extreme valuePg, and update Pg if the new value is better.Step 4: According to the velocity formula (equation (17) and position formula (equation (18)) the velocity and position of the particles are updated respectively. At the same time, the experiment uses the basic idea of GA to randomly perform mutation operations on some particles, randomly encode particles within the set number of dimensions and perform single-point mutation operations to generate new groups. Then recalculate the fitness value of the particles, and update the fitness value according to equtaion (16).Step 5: According to the update process of the above algorithm, the optimal cluster center point is generated.Step 6: Using the nearest neighbor rule in the KM algorithm, reclassify each sample to obtain a new cluster division.Step 7: Determine whether the termination conditions are met. If it is satisfied, output the optimal solution; otherwise, return Step 2. The termination condition is that the cluster centers obtained within a given number of iterations do not change, or the maximum number of iterations is reached.


### 4.3. Improved Clustering Model Algorithm

The steps involved in improved clustering model algorithm are given below.


## 4.1. Improvement Idea of K-Means Clustering

The basic principle of the KM algorithm is a clustering algorithm based on partition. Given a datasetX and the total number of data samples n, first randomly select k initial clustering centers (cluster points), and assign each object to the nearest cluster point to get a set of clusters. Then calculate the average value of each cluster as the new cluster point, and redistribute each data sample to the nearest aggregation point. This process is performed in a loop until the termination condition is met and the algorithm ends. In the KM algorithm, the Euclidean distance formula is used to measure the distance, which is the square root of the sum of the squares of the difference of each attribute. The most commonly used objective function is f=∑j=1k∑xi∈Cjdxi,zj，where xi is the i-th object and zj is the center of the j-th cluster. The purpose of clustering is to find a set of cluster centers which minimizes the above objective function value. However, due to the existence of local extreme points and the greedy nature of the heuristic algorithm, the traditional KM algorithm has the shortcomings of being sensitive to the initial clustering center and easily converging to the local extreme value. In this paper, the IFPSO algorithm is used to find cluster centers, and mutation operation is added in the particle update process, which increases the diversity of particles and dynamically adjusts particles. It avoids the phenomenon of premature convergence of particles in the PSO algorithm and has strong global search capabilities. It also eliminates the dependence of the KM algorithm on the selection of the initial cluster centers. Through the algorithm, the global optimal N cluster centers are obtained and then used as the initial cluster centers to implement the improved algorithm to obtain the ideal cluster division.


## 4.2. Principle of IFPSO-KM Algorithm

Given a sample setX, the total number of data samples is n, which is divided into k clusters to form a partition C=C,1C,2…,Ck. For each cluster center, calculation formula and sample set are obtained. The total cumulative dispersion and formula are as follows:(15)zrj=1nj∑xi∈Cjxi.(16)fZr=∑j=1k∑xi∈Cjdxi,zrj.The fitness value of the particle is calculated according to equation (16), where Zr is the r-th particle (1≤r≤N), N is the number of particles, and zrj is the cluster center position of the j-th class of the r-th particle. dxi,zrj is the distance from the i-th sample data to the corresponding cluster center. The clustering criterion function fZr is the sum of the distances from various samples to the corresponding cluster centers and is also the fitness function of the particles. The particle velocity and position update formula are as follows:(17)Vrt+1=w−1+aVrt+12a1−aVrt−1+16a1−a2−aVrt−2+124a1−a2−a3−aVrt−3+c1×r1×Prt−Zrt+c2×r2×Pgt−Zrt+c3×r3×Pgt−Prt.(18)Zrt+1=Vrt+1+βZrt+12β1−βZrt−1+16β1−β2−βZrt−2+124β1−β2−β3−βZrt−3.Based on the standard particle swarm optimization algorithm, in the process of updating the particle speed, we consider increasing the connection between the global optimum and the local optimum and adding thec3×r3×Pgt−Prt variable on the basis of the previous algorithm (Algorithm 1).Algorithm 1: IFPSO-KM algorithm.
Input: data setXOutput: dividedk cluster center solution setsStep 1: Initialize the population and parameters, determine thek value according to the SSE and Silhouette Coefficient, randomly select k data sample points as the initial center point, and calculate the fitness value of each particle according to the formula.Step 2: Compare the fitness value of each particle with its individual extreme valuePr, and update Pr if the new value is better.Step 3: Compare the fitness value of each particle with the population extreme valuePg, and update Pg if the new value is better.Step 4: According to the velocity formula (equation (17) and position formula (equation (18)) the velocity and position of the particles are updated respectively. At the same time, the experiment uses the basic idea of GA to randomly perform mutation operations on some particles, randomly encode particles within the set number of dimensions and perform single-point mutation operations to generate new groups. Then recalculate the fitness value of the particles, and update the fitness value according to equtaion (16).Step 5: According to the update process of the above algorithm, the optimal cluster center point is generated.Step 6: Using the nearest neighbor rule in the KM algorithm, reclassify each sample to obtain a new cluster division.Step 7: Determine whether the termination conditions are met. If it is satisfied, output the optimal solution; otherwise, return Step 2. The termination condition is that the cluster centers obtained within a given number of iterations do not change, or the maximum number of iterations is reached.


## 4.3. Improved Clustering Model Algorithm

The steps involved in improved clustering model algorithm are given below.


## 5. Analysis of the Experiment

This part is mainly divided into three parts of simulation experiments, which are as follows: (1) The contrast experiment of the convergence characteristics of the IFPSO algorithm and the FOPSO algorithm is to test whether the efficiency of the algorithm is effectively improved. (2) Use the IFPSO algorithm and support vector machine to optimize parameters to construct two-category and multicategory prediction models. Analyze and evaluate the classification effect of the model. (3) Combine the IFPSO algorithm with K-means clustering to obtain the best combination of cluster centers. Then analyze and evaluate the clustering effect of the algorithm.


### 5.1. Convergence Analysis of IFPSO Algorithm

#### 5.1.1. Introduction to Test Functions

To verify the performance of the IFPSO algorithm given in this paper, we compare the IFPSO algorithm and the FOPSO algorithm through several commonly used unimodal and multimodal test functions. Analyze whether the IFPSO algorithm effectively improves the convergence performance through the solution of the test functions. The characteristics of the four selected test functions are as follows:Holder function is as follows:(19)fx=−sinx1cosx2exp1−x12+x22π.Inputting domain isxi∈−10,10,i=1,2.Global minimum isfx∗=−19.2085. There are four minimum points, namely, x∗=8.05502,9.66459,8.05502,−9.66459,−8.05502,9.66459,−8.05502,−9.66459. This function has many local minima and four global minimums. It is a multimodal function.Generalized Rastrigin function is(20)fx=10d+∑i=1dxi2−10cos2πxi.Inputting domain isxi∈−5.12,5.12,i=1,…,d.Global minimum isfx∗=0, x∗=0,…,0.The Rastrigin function has multiple local minima, but the positions of the minima are regularly distributed. It is a highly multimodal function, so it is not easy to search for the global best solution.Schaffer function is(21)fx=0.5−sinx12+x22−0.51+0.001×x12+x222.Inputting domain isxi∈−4,4,i=1,2.Global maximum isfx∗=1, x∗=0,…,0.This function has a global maximum point, and there are infinite subglobal maximum points within a range of 3.14 from the global maximum point. In the simulation experiment, if the opposite value is taken, the extreme point should be −1.Sphere function is(22)fx=∑idxi2.Inputting domain isxi∈−5.12,5.12,i=1,…,d.Global minimum isfx∗=0, x∗=0,…,0.This function has a unique global minimum point. It is a continuous, convex, unimodal function.


#### 5.1.2. Analysis of Convergence Results

In this paper, the IFPSO algorithm and FOPSO algorithm are simulated in Python, and the parameters of the comparison algorithm involved in this paper are given in Table1.Table 1
Algorithm parameter settings.
AlgorithmParameter settingsReferencePSOω∈0.4,0.9;c1=c2=2.0[32]FOPSOω:0.9;a=0.632;c1=c2=1.5;r1d=r2d=0,1[3]IFPSOω∈0.4,0.8;a=0.4;β=0.7In the experiment, the parameter settings of the IFPSO algorithm are maintained as the combination of the parameter settings of IFPSO-SVM. Set the parameters in the FOPSO algorithm to the parameter settings in literature [33], and change the inertia weight to linear inertia weight. The population size and number of iterations of the two algorithms are the same, and the optimization and convergence effects of the four test functions are shown in Figures 2–5.Figure 2
Simulation of sphere function.Figure 3
Simulation of Rastrigin function.Figure 4
Simulation of Schaffer function.Figure 5
Simulation of Holder function.In these four figures, the red line is the convergence curve of the IFPSO algorithm, and the gray line is the convergence curve of the FOPSO algorithm.From the comparison chart of the optimization simulation curves of the four test functions above, it can be seen that the IFPSO algorithm in this paper has better optimization capabilities in the process of solving unimodal functions or multimodal functions. Moreover, its convergence speed and the ability to search for the best value are faster and more accurate than the algorithm before the improvement. Its performance is improved more obviously in complex multimodal functions. It can be seen from Figure3 that, in the optimization process of the Generalized Rastrigin function, the FOPSO algorithm falls into the local optimum solution, and it fails to capture the global minimum. The position update of the IFPSO algorithm also has the characteristics of long-term memory of the fractional differential, which makes the algorithm’s particle diversity higher, with better ability to jump out of the local optimal solution. Experiments show that the IFPSO algorithm not only improves the convergence speed but also enhances the ability of the particle global search.


### 5.2. Prediction Model Based on IFPSO-SVM

#### 5.2.1. Experimental Data of the Prediction Model

This experiment uses the Statlog (heart) dataset. The dataset is obtained from the UCI machine learning database. This dataset contains a total of 303 cases, and each row records 13 characteristics and a label of the sample. Preprocess the data, and use 242 cases (about 80% of the total number of samples) as the training set and 61 cases (about 20% of the total number of samples) as the test set. The main attributes of the dataset are shown in Table2.Table 2
The attributes of the heart disease dataset.
NumberAttribute nameTypes1AgeContinuous2SexTwo categories3cp (types of chest pain)Four categories4trestbps (blood pressure)Continuous5chol (cholesterol)Continuous6fbs (fasting blood glucose)Two categories7restecg (ECG results)Three categories8thslach (maximum heart rate)Continuous9exang (whether angina during exercise)Two categories10oldpeak (ST depression)Continuous11slope (ST segment)Ordered, three categories12ca (the number of blood vessels)Continuous13thal (types of defects)Three categories14Target0, healthy1, diseasesThe physical meaning, data unit, and magnitude of each attribute in the selected dataset are different. The original data is normalized and mapped in [0, 1], and the indicators are in the same order of magnitude, which is convenient for comprehensive comparison and evaluation.


#### 5.2.2. Heart Disease Prediction Model Based on IFPSO-SVM

The modeling environment is Python, and the SVM model used is the SVC module of the sklearn tool. The full name is C-Support Vector Classification, which is a support vector machine based on LibSVM. The main purpose of this experiment is to test the effectiveness and progress of classification models and algorithms through simulation experiments of predictive models.Use the IFPSO algorithm to build a machine learning binary classification model. Input the known heart disease data (training set) into the model, let the model learn, and obtain the ability to predict new unknown data (test set). The model is evaluated by comparing the prediction results of the test set with the real labels of the test set, and the classification performance of the model is evaluated. The kernel function selects the RBF function, and the most important parameters of the model are optimized through the IFPSO algorithm. The SVM model constructed by the IFPSO algorithm greatly improves the prediction accuracy of the model and reduces the time consumption of model calculations.In the IFPSO algorithm, through experiments, it can be found that when the inertia weight value is less than 0.5, the search accuracy of the algorithm is not high, and it is easy to fall into the local optimal solution later. After many experiments, the accuracy of the algorithm is higher whenwmin=0.4 and wmax=0.8. Compared with traditional algorithms, the calculation speed is faster, and the global search capability is also good. The introduction of the fractional-order algorithm also enriches the search behavior and avoids falling into the local optimum solutions. At the same time, the change of the current particle depends not only on the moment but also on the previous state, and the particle can obtain a better fitness value. The literature [20] shows that the accuracy of the algorithm is better when the value of the fractional operator α is between 0.3,0.8. After several experiments, this paper takes α=0.4 and β=0.7, and the results show that the algorithm’s performance at this time is relatively balanced and stable. In SVM, the kernel function uses the RBF function, and we obtain a set of optimal parameters σ,C through the IFPSO algorithm. After the IFPSO-SVM model is trained on the training set, the data in the test set can be predicted. Compare the test results with the real labels in the test set. Evaluate the model by drawing a confusion matrix, calculating evaluation indicators such as Precision, Recall, and F1-Score, and drawing ROC curves.


#### 5.2.3. Multiclass Prediction Experiment Based on IFPSO-SVM

The dataset used in the experiment is UCI’s red wine dataset. This dataset includes three types of wine, with 13 different composition characteristics and a total of 178 rows of data. The three types of wine are marked as “1,” “2,” and “3.” There are 59 samples in the first category, 71 samples in the second category, and 48 samples in the third category. Preprocess the data, use 142 cases (about 80% of the total number of samples) as the training set and 36 cases (about 20% of the total number of samples) as the test set. The experimental parameters are the parameters of the two-category prediction model in the previous section.


### 5.3. Clustering Model Based on IFPSO-KM

In the simulation experiment, the classic dataset in the UCI database is used as the test dataset to verify the performance of the KM, PSO-K, ADPSO-AKM, and IFPSO-KM algorithms. The test dataset description is shown in Table3. There are four attributes in the Iris dataset, namely, calyx length, calyx width, petal length, and petal width. There are three types of iris flowers, namely, Iris setosa, Iris versicolor, and Iris virginica. The Wine quality dataset contains two data subtypes. Sets are samples of red wine and white wine. Among them, there are 1599 samples in the red wine dataset and 4,858 samples in the white wine dataset. There are 11 physical and chemical properties of red wine (white wine) and the quality (score from 0 to 10) of red wine (white wine).Table 3
Properties of the test dataset.
Test datasetNumber of data samplesNumber of clustersData dimensionIris15034Wine quality-white485812Wine quality-red159912In the experiment, take the particle populationm=80 and the maximum number of iterations Tmax=15. In the IFPSO algorithm, the inertia weight is also linearly decreased. Through many experiments, set c1=c2=1.49, ωmax=0.8, ωmin=0.3, α=0.6, and β=0.4. Through the IFPSO algorithm, we obtain a set of particle combinations of cluster centers and use the KM algorithm to cluster according to this particle combination. Use common clustering evaluation indicators (Rand index, homogeneity score) for model evaluation. The clustered data can be compared with the real data in the way of supervised learning to get the accuracy of the model.


### 5.4. Analysis of Results

#### 5.4.1. Confusion Matrix

A confusion matrix can effectively measure the accuracy of a classifier’s classification. It is a situation analysis table for summarizing and predicting the results of classification models in data science, data analysis, and machine learning. In the form of a matrix, the records in the dataset are summarized according to the two criteria of the real category and the classification judgment made by the classification model. Take the binary classification problem as an example. There are two types of records in the dataset: positive and negative. The classification model will make positive judgments (judgment records belong to the positive category) or negative judgments (judgment records belong to the negative category). The row represents the reality, and the column represents the forecast.The evaluation indicators extended by the confusion matrix as follows:Accuracy: the percentage of correctly classified samples in the total sample.Precision: the probability of a positive sample among the samples predicted to be positive.Recall: the probability that the model predicts a positive sample in the actual positive sample.F1-score: it can be regarded as the harmonic mean of model Accuracy and Recall.


#### 5.4.2. Evaluation Index of Clustering Model

SSE (sum of the squared errors) is a measure of cluster looseness. As an objective function, it is actually a strict Coordinate Decedent process. SSE cannot guarantee finding the global optimal solution but can only guarantee the local optimal solution. In other words, it may cause a variety ofk cluster divisions.Silhouette Coefficient combines the degree of cohesion and the degree of separation to evaluate the effect of clustering. The value range of the average profile coefficient is [−1, 1]. The larger the coefficient, the better the clustering effect. After each clustering, each sample will get a contour coefficient. When it is 1, it means that the point is far away from the surrounding clusters, which is a good classification. When the value is 0, it means that the point is on the boundary of the two clusters. When the value is negative, it means that the point may be misclassified.Adjusted Rand index is proposed to achieve “in the case of clustering results randomly generated, the index should be close to zero,” which has a higher degree of discrimination; the calculation formula is(23)ARI=RI−ERImaxRI−ERI.The value range of ARI is [−1, 1]. The larger the value is, the more consistent the clustering result is with the real situation. In a broad sense, ARI measures the degree of agreement between the two data distributions.


#### 5.4.3. Evaluation of Predictive Models

Figure6 is an illustration of the confusion matrix drawn by the prediction results after the dataset is trained with IFPSO-SVM. Each row represents the real situation, each column represents the prediction situation, and the main diagonal represents the correct sample size of the prediction.Figure 6
Confusion matrix.It can be seen from the figure that the total number of data samples in the test set is 61, of which 29 are health data samples and 32 are disease data samples. 26 of the health data samples were correctly predicted, and 29 of the disease data samples were correctly predicted.Table4 shows the values of some evaluation indicators calculated from the confusion matrix obtained by the prediction model.Table 4
Evaluation index value of IFPSO-SVM algorithm (heart disease dataset).
PrecisionRecallF1-ScoreSupportHealthy0.900.900.9029Disease0.910.910.9132Accuracy0.9061Macro avg.0.900.900.9061Weighted avg.0.900.900.9061To compare the performance of the heart disease prediction model based on the IFPSO-SVM proposed in this paper, several other algorithms [34, 35] are used to predict the same dataset, as well as the Precision, Recall, and F1-Score. The experimental results are shown in Table 5.Table 5
Comparison of prediction results of different algorithms.
AlgorithmsPrecisionRecallF1-ScorePSO-SVM0.8090.7590.783BP0.8310.7830.806XGBoost0.8650.8040.833FOPSO-SVM0.8650.8450.855IFPSO-SVM0.9100.9100.900Through the comparison experiment, we can see that, for the basic PSO-SVM classification model, the prediction accuracy is about 80%. The accuracy of the model built by the PSO algorithm that only updates the velocity in fractional order is about 83%. The prediction accuracy of the IFPSO-SVM model in this article has reached 90%, which greatly improves the effectiveness and accuracy of the model. All indicators are better than those in other algorithms.Finally, draw the ROC (Receiver Operating Characteristic) curve of the method in this article. Combining the two variables (1−specificity and sensitive) with a graphical method can more clearly and accurately integrate the accuracy of the reaction model. The horizontal axis is the false positive rate, and its value is proportional to the false positive rate. The vertical axis is the true positive rate, and its value is proportional to the accuracy rate. Therefore, the closer to the upper left corner of the ROC space, the better the judgment effect, as shown in Figure 7.Figure 7
ROC curve graph.AUC is the area under the ROC curve. In the experiment, the larger the AUC value, the better the model effect. Usually, (1)AUC≈1.0 means the model is the most ideal, (2) 0.7≤AUC≤0.9 means the accuracy of the model is high, and (3) AUC=0.5 means the model is meaningless. In general, an AUC of 0.9 or more can be regarded as a highly accurate judgment experiment. The prediction at this time is of practical significance. In the above model, AUC=0.9385 (the parameter combination is as follows: gamma = 0.055; c = 0.7915). It shows that the accuracy of the model has reached the standard of practical significance, and the introduction of the IFPSO algorithm greatly improves the accuracy of the model.In the multiclassification application of IFPSO-SVM, the model also has a better improvement effect. Table6 shows the algorithm evaluation of the model to classify the Wine dataset.Table 6
Evaluation index value of IFPSO-SVM algorithm (Wine dataset).
PrecisionRecallF1-ScoreSupportType 11.001.001.0014Type 21.001.001.0014Type 31.001.001.008Accuracy1.0036Macro avg.1.001.001.0036Weighted avg.1.001.001.0036It can be seen that we selected 20% of the dataset as the test set, and the Precision, Recall, and F1-Score obtained from the simulation experiment all reached 1 (the parameter combination is as follows: gamma = 0.158;c = 6.5811). Explain that the predictions for all test data are accurate. At the same time, it shows that the IFPSO algorithm effectively improves the prediction accuracy and accuracy of SVM, not only for accidental datasets. The algorithm has a good classification effect on two-category and multicategory problems.In summary, the IFPSO algorithm in this paper has better performance in the parameter optimization problem of SVM. The time complexity of the algorithm is significantly reduced, and the ability to find the global optimal solution is improved. The IFPSO-SVM prediction model constructed in this paper has achieved a higher diagnostic success rate than other models in the diagnosis of heart disease, which makes the research of the model have certain practical reference significance. The accuracy of the multicategory model has also reached 100%. The effect of the algorithm has improved significantly.


#### 5.4.4. Evaluation of the Clustering Model

According to the change curve of SSE and profile coefficient, the number of clusters is dynamically obtained. Use the standard dataset Iris as the test data. Set the range of the number of clustersk to [2, 10], and draw the SSE and Silhouette Coefficient corresponding to different numbers of clusters, to select the value of k more intuitively, as shown in Figure 8.Figure 8
Change curve of SSE and Silhouette Coefficient. (a) K-means SSE. (b) K-means Silhouette Coefficient.
(a)(b)Combining the graph, it can be seen that whenk=3, the SSE value decreases significantly, and the Silhouette Coefficient value is also higher. The actual number of classifications in the Iris dataset is also 3, which is consistent with the calculated k value.The IFPSO-KM algorithm is verified through experiments on UCI’s Iris and Wine dataset. The clustering effect of the Iris dataset can be represented by three-dimensional images. Figure9 shows the clustering effect diagram of the IFPSO-KM algorithm, and Figure 10 shows a diagram of scattering clustering according to the true value. It can be seen that the effect of the improved algorithm clustering is better. Its clusters are relatively close and the distance between clusters is large, which meets the clustering requirements.Figure 9
Cluster graph of IFPSO-KM (Iris).Figure 10
Iris’ real cluster graph.When using IFPSO-KM to cluster two datasets, the parameters are set as follows: takec1=c2=1.49, ωmax=0.8, ωmin=0.3, α=0.6, and β=0.4. Table 7 shows the number of error points for training on the Iris and Wine datasets by different clustering methods. Since the Wine dataset has more attribute values, only the corresponding initial center points of Iris are given in the table. The optimal initial center points obtained by the IFPSO- KM algorithm are the 49th, 98th, and 129th data points in the sample set, respectively. After experiments, we can see that the KM algorithm is very sensitive to the initial center point. Although the number of misclassifications in some experiments is relatively small, the improved algorithm combined with the PSO algorithm is better than the KM algorithm in terms of the degree of dependence on the initial center point and the accuracy of the classification. Effectively reduce the randomness of clustering.Table 7
Clustering result.
AlgorithmInitial cluster center of Iris datasetMisclassificationsIris datasetWine datasetK-means115512212650K-means++358912211602PSOK-means41721096286IFPSO-KM4998129648It is worth pointing out that the standard KM algorithm is not very effective for clustering datasets with more data attributes and a relatively large amount of data, and the classification accuracy can only reach about 80%. The classification accuracy of the IFPSO algorithm in this article combined with KM reached 98.183%, and the Rand index also reached 0.924, with a homogenization score of 0.905. It is a clustering model with a better clustering effect.


## 5.1. Convergence Analysis of IFPSO Algorithm

### 5.1.1. Introduction to Test Functions

To verify the performance of the IFPSO algorithm given in this paper, we compare the IFPSO algorithm and the FOPSO algorithm through several commonly used unimodal and multimodal test functions. Analyze whether the IFPSO algorithm effectively improves the convergence performance through the solution of the test functions. The characteristics of the four selected test functions are as follows:Holder function is as follows:(19)fx=−sinx1cosx2exp1−x12+x22π.Inputting domain isxi∈−10,10,i=1,2.Global minimum isfx∗=−19.2085. There are four minimum points, namely, x∗=8.05502,9.66459,8.05502,−9.66459,−8.05502,9.66459,−8.05502,−9.66459. This function has many local minima and four global minimums. It is a multimodal function.Generalized Rastrigin function is(20)fx=10d+∑i=1dxi2−10cos2πxi.Inputting domain isxi∈−5.12,5.12,i=1,…,d.Global minimum isfx∗=0, x∗=0,…,0.The Rastrigin function has multiple local minima, but the positions of the minima are regularly distributed. It is a highly multimodal function, so it is not easy to search for the global best solution.Schaffer function is(21)fx=0.5−sinx12+x22−0.51+0.001×x12+x222.Inputting domain isxi∈−4,4,i=1,2.Global maximum isfx∗=1, x∗=0,…,0.This function has a global maximum point, and there are infinite subglobal maximum points within a range of 3.14 from the global maximum point. In the simulation experiment, if the opposite value is taken, the extreme point should be −1.Sphere function is(22)fx=∑idxi2.Inputting domain isxi∈−5.12,5.12,i=1,…,d.Global minimum isfx∗=0, x∗=0,…,0.This function has a unique global minimum point. It is a continuous, convex, unimodal function.


### 5.1.2. Analysis of Convergence Results

In this paper, the IFPSO algorithm and FOPSO algorithm are simulated in Python, and the parameters of the comparison algorithm involved in this paper are given in Table1.Table 1
Algorithm parameter settings.
AlgorithmParameter settingsReferencePSOω∈0.4,0.9;c1=c2=2.0[32]FOPSOω:0.9;a=0.632;c1=c2=1.5;r1d=r2d=0,1[3]IFPSOω∈0.4,0.8;a=0.4;β=0.7In the experiment, the parameter settings of the IFPSO algorithm are maintained as the combination of the parameter settings of IFPSO-SVM. Set the parameters in the FOPSO algorithm to the parameter settings in literature [33], and change the inertia weight to linear inertia weight. The population size and number of iterations of the two algorithms are the same, and the optimization and convergence effects of the four test functions are shown in Figures 2–5.Figure 2
Simulation of sphere function.Figure 3
Simulation of Rastrigin function.Figure 4
Simulation of Schaffer function.Figure 5
Simulation of Holder function.In these four figures, the red line is the convergence curve of the IFPSO algorithm, and the gray line is the convergence curve of the FOPSO algorithm.From the comparison chart of the optimization simulation curves of the four test functions above, it can be seen that the IFPSO algorithm in this paper has better optimization capabilities in the process of solving unimodal functions or multimodal functions. Moreover, its convergence speed and the ability to search for the best value are faster and more accurate than the algorithm before the improvement. Its performance is improved more obviously in complex multimodal functions. It can be seen from Figure3 that, in the optimization process of the Generalized Rastrigin function, the FOPSO algorithm falls into the local optimum solution, and it fails to capture the global minimum. The position update of the IFPSO algorithm also has the characteristics of long-term memory of the fractional differential, which makes the algorithm’s particle diversity higher, with better ability to jump out of the local optimal solution. Experiments show that the IFPSO algorithm not only improves the convergence speed but also enhances the ability of the particle global search.


## 5.1.1. Introduction to Test Functions

To verify the performance of the IFPSO algorithm given in this paper, we compare the IFPSO algorithm and the FOPSO algorithm through several commonly used unimodal and multimodal test functions. Analyze whether the IFPSO algorithm effectively improves the convergence performance through the solution of the test functions. The characteristics of the four selected test functions are as follows:Holder function is as follows:(19)fx=−sinx1cosx2exp1−x12+x22π.Inputting domain isxi∈−10,10,i=1,2.Global minimum isfx∗=−19.2085. There are four minimum points, namely, x∗=8.05502,9.66459,8.05502,−9.66459,−8.05502,9.66459,−8.05502,−9.66459. This function has many local minima and four global minimums. It is a multimodal function.Generalized Rastrigin function is(20)fx=10d+∑i=1dxi2−10cos2πxi.Inputting domain isxi∈−5.12,5.12,i=1,…,d.Global minimum isfx∗=0, x∗=0,…,0.The Rastrigin function has multiple local minima, but the positions of the minima are regularly distributed. It is a highly multimodal function, so it is not easy to search for the global best solution.Schaffer function is(21)fx=0.5−sinx12+x22−0.51+0.001×x12+x222.Inputting domain isxi∈−4,4,i=1,2.Global maximum isfx∗=1, x∗=0,…,0.This function has a global maximum point, and there are infinite subglobal maximum points within a range of 3.14 from the global maximum point. In the simulation experiment, if the opposite value is taken, the extreme point should be −1.Sphere function is(22)fx=∑idxi2.Inputting domain isxi∈−5.12,5.12,i=1,…,d.Global minimum isfx∗=0, x∗=0,…,0.This function has a unique global minimum point. It is a continuous, convex, unimodal function.


## 5.1.2. Analysis of Convergence Results

In this paper, the IFPSO algorithm and FOPSO algorithm are simulated in Python, and the parameters of the comparison algorithm involved in this paper are given in Table1.Table 1
Algorithm parameter settings.
AlgorithmParameter settingsReferencePSOω∈0.4,0.9;c1=c2=2.0[32]FOPSOω:0.9;a=0.632;c1=c2=1.5;r1d=r2d=0,1[3]IFPSOω∈0.4,0.8;a=0.4;β=0.7In the experiment, the parameter settings of the IFPSO algorithm are maintained as the combination of the parameter settings of IFPSO-SVM. Set the parameters in the FOPSO algorithm to the parameter settings in literature [33], and change the inertia weight to linear inertia weight. The population size and number of iterations of the two algorithms are the same, and the optimization and convergence effects of the four test functions are shown in Figures 2–5.Figure 2
Simulation of sphere function.Figure 3
Simulation of Rastrigin function.Figure 4
Simulation of Schaffer function.Figure 5
Simulation of Holder function.In these four figures, the red line is the convergence curve of the IFPSO algorithm, and the gray line is the convergence curve of the FOPSO algorithm.From the comparison chart of the optimization simulation curves of the four test functions above, it can be seen that the IFPSO algorithm in this paper has better optimization capabilities in the process of solving unimodal functions or multimodal functions. Moreover, its convergence speed and the ability to search for the best value are faster and more accurate than the algorithm before the improvement. Its performance is improved more obviously in complex multimodal functions. It can be seen from Figure3 that, in the optimization process of the Generalized Rastrigin function, the FOPSO algorithm falls into the local optimum solution, and it fails to capture the global minimum. The position update of the IFPSO algorithm also has the characteristics of long-term memory of the fractional differential, which makes the algorithm’s particle diversity higher, with better ability to jump out of the local optimal solution. Experiments show that the IFPSO algorithm not only improves the convergence speed but also enhances the ability of the particle global search.


## 5.2. Prediction Model Based on IFPSO-SVM

### 5.2.1. Experimental Data of the Prediction Model

This experiment uses the Statlog (heart) dataset. The dataset is obtained from the UCI machine learning database. This dataset contains a total of 303 cases, and each row records 13 characteristics and a label of the sample. Preprocess the data, and use 242 cases (about 80% of the total number of samples) as the training set and 61 cases (about 20% of the total number of samples) as the test set. The main attributes of the dataset are shown in Table2.Table 2
The attributes of the heart disease dataset.
NumberAttribute nameTypes1AgeContinuous2SexTwo categories3cp (types of chest pain)Four categories4trestbps (blood pressure)Continuous5chol (cholesterol)Continuous6fbs (fasting blood glucose)Two categories7restecg (ECG results)Three categories8thslach (maximum heart rate)Continuous9exang (whether angina during exercise)Two categories10oldpeak (ST depression)Continuous11slope (ST segment)Ordered, three categories12ca (the number of blood vessels)Continuous13thal (types of defects)Three categories14Target0, healthy1, diseasesThe physical meaning, data unit, and magnitude of each attribute in the selected dataset are different. The original data is normalized and mapped in [0, 1], and the indicators are in the same order of magnitude, which is convenient for comprehensive comparison and evaluation.


### 5.2.2. Heart Disease Prediction Model Based on IFPSO-SVM

The modeling environment is Python, and the SVM model used is the SVC module of the sklearn tool. The full name is C-Support Vector Classification, which is a support vector machine based on LibSVM. The main purpose of this experiment is to test the effectiveness and progress of classification models and algorithms through simulation experiments of predictive models.Use the IFPSO algorithm to build a machine learning binary classification model. Input the known heart disease data (training set) into the model, let the model learn, and obtain the ability to predict new unknown data (test set). The model is evaluated by comparing the prediction results of the test set with the real labels of the test set, and the classification performance of the model is evaluated. The kernel function selects the RBF function, and the most important parameters of the model are optimized through the IFPSO algorithm. The SVM model constructed by the IFPSO algorithm greatly improves the prediction accuracy of the model and reduces the time consumption of model calculations.In the IFPSO algorithm, through experiments, it can be found that when the inertia weight value is less than 0.5, the search accuracy of the algorithm is not high, and it is easy to fall into the local optimal solution later. After many experiments, the accuracy of the algorithm is higher whenwmin=0.4 and wmax=0.8. Compared with traditional algorithms, the calculation speed is faster, and the global search capability is also good. The introduction of the fractional-order algorithm also enriches the search behavior and avoids falling into the local optimum solutions. At the same time, the change of the current particle depends not only on the moment but also on the previous state, and the particle can obtain a better fitness value. The literature [20] shows that the accuracy of the algorithm is better when the value of the fractional operator α is between 0.3,0.8. After several experiments, this paper takes α=0.4 and β=0.7, and the results show that the algorithm’s performance at this time is relatively balanced and stable. In SVM, the kernel function uses the RBF function, and we obtain a set of optimal parameters σ,C through the IFPSO algorithm. After the IFPSO-SVM model is trained on the training set, the data in the test set can be predicted. Compare the test results with the real labels in the test set. Evaluate the model by drawing a confusion matrix, calculating evaluation indicators such as Precision, Recall, and F1-Score, and drawing ROC curves.


### 5.2.3. Multiclass Prediction Experiment Based on IFPSO-SVM

The dataset used in the experiment is UCI’s red wine dataset. This dataset includes three types of wine, with 13 different composition characteristics and a total of 178 rows of data. The three types of wine are marked as “1,” “2,” and “3.” There are 59 samples in the first category, 71 samples in the second category, and 48 samples in the third category. Preprocess the data, use 142 cases (about 80% of the total number of samples) as the training set and 36 cases (about 20% of the total number of samples) as the test set. The experimental parameters are the parameters of the two-category prediction model in the previous section.


## 5.2.1. Experimental Data of the Prediction Model

This experiment uses the Statlog (heart) dataset. The dataset is obtained from the UCI machine learning database. This dataset contains a total of 303 cases, and each row records 13 characteristics and a label of the sample. Preprocess the data, and use 242 cases (about 80% of the total number of samples) as the training set and 61 cases (about 20% of the total number of samples) as the test set. The main attributes of the dataset are shown in Table2.Table 2
The attributes of the heart disease dataset.
NumberAttribute nameTypes1AgeContinuous2SexTwo categories3cp (types of chest pain)Four categories4trestbps (blood pressure)Continuous5chol (cholesterol)Continuous6fbs (fasting blood glucose)Two categories7restecg (ECG results)Three categories8thslach (maximum heart rate)Continuous9exang (whether angina during exercise)Two categories10oldpeak (ST depression)Continuous11slope (ST segment)Ordered, three categories12ca (the number of blood vessels)Continuous13thal (types of defects)Three categories14Target0, healthy1, diseasesThe physical meaning, data unit, and magnitude of each attribute in the selected dataset are different. The original data is normalized and mapped in [0, 1], and the indicators are in the same order of magnitude, which is convenient for comprehensive comparison and evaluation.


## 5.2.2. Heart Disease Prediction Model Based on IFPSO-SVM

The modeling environment is Python, and the SVM model used is the SVC module of the sklearn tool. The full name is C-Support Vector Classification, which is a support vector machine based on LibSVM. The main purpose of this experiment is to test the effectiveness and progress of classification models and algorithms through simulation experiments of predictive models.Use the IFPSO algorithm to build a machine learning binary classification model. Input the known heart disease data (training set) into the model, let the model learn, and obtain the ability to predict new unknown data (test set). The model is evaluated by comparing the prediction results of the test set with the real labels of the test set, and the classification performance of the model is evaluated. The kernel function selects the RBF function, and the most important parameters of the model are optimized through the IFPSO algorithm. The SVM model constructed by the IFPSO algorithm greatly improves the prediction accuracy of the model and reduces the time consumption of model calculations.In the IFPSO algorithm, through experiments, it can be found that when the inertia weight value is less than 0.5, the search accuracy of the algorithm is not high, and it is easy to fall into the local optimal solution later. After many experiments, the accuracy of the algorithm is higher whenwmin=0.4 and wmax=0.8. Compared with traditional algorithms, the calculation speed is faster, and the global search capability is also good. The introduction of the fractional-order algorithm also enriches the search behavior and avoids falling into the local optimum solutions. At the same time, the change of the current particle depends not only on the moment but also on the previous state, and the particle can obtain a better fitness value. The literature [20] shows that the accuracy of the algorithm is better when the value of the fractional operator α is between 0.3,0.8. After several experiments, this paper takes α=0.4 and β=0.7, and the results show that the algorithm’s performance at this time is relatively balanced and stable. In SVM, the kernel function uses the RBF function, and we obtain a set of optimal parameters σ,C through the IFPSO algorithm. After the IFPSO-SVM model is trained on the training set, the data in the test set can be predicted. Compare the test results with the real labels in the test set. Evaluate the model by drawing a confusion matrix, calculating evaluation indicators such as Precision, Recall, and F1-Score, and drawing ROC curves.


## 5.2.3. Multiclass Prediction Experiment Based on IFPSO-SVM

The dataset used in the experiment is UCI’s red wine dataset. This dataset includes three types of wine, with 13 different composition characteristics and a total of 178 rows of data. The three types of wine are marked as “1,” “2,” and “3.” There are 59 samples in the first category, 71 samples in the second category, and 48 samples in the third category. Preprocess the data, use 142 cases (about 80% of the total number of samples) as the training set and 36 cases (about 20% of the total number of samples) as the test set. The experimental parameters are the parameters of the two-category prediction model in the previous section.


## 5.3. Clustering Model Based on IFPSO-KM

In the simulation experiment, the classic dataset in the UCI database is used as the test dataset to verify the performance of the KM, PSO-K, ADPSO-AKM, and IFPSO-KM algorithms. The test dataset description is shown in Table3. There are four attributes in the Iris dataset, namely, calyx length, calyx width, petal length, and petal width. There are three types of iris flowers, namely, Iris setosa, Iris versicolor, and Iris virginica. The Wine quality dataset contains two data subtypes. Sets are samples of red wine and white wine. Among them, there are 1599 samples in the red wine dataset and 4,858 samples in the white wine dataset. There are 11 physical and chemical properties of red wine (white wine) and the quality (score from 0 to 10) of red wine (white wine).Table 3
Properties of the test dataset.
Test datasetNumber of data samplesNumber of clustersData dimensionIris15034Wine quality-white485812Wine quality-red159912In the experiment, take the particle populationm=80 and the maximum number of iterations Tmax=15. In the IFPSO algorithm, the inertia weight is also linearly decreased. Through many experiments, set c1=c2=1.49, ωmax=0.8, ωmin=0.3, α=0.6, and β=0.4. Through the IFPSO algorithm, we obtain a set of particle combinations of cluster centers and use the KM algorithm to cluster according to this particle combination. Use common clustering evaluation indicators (Rand index, homogeneity score) for model evaluation. The clustered data can be compared with the real data in the way of supervised learning to get the accuracy of the model.


## 5.4. Analysis of Results

### 5.4.1. Confusion Matrix

A confusion matrix can effectively measure the accuracy of a classifier’s classification. It is a situation analysis table for summarizing and predicting the results of classification models in data science, data analysis, and machine learning. In the form of a matrix, the records in the dataset are summarized according to the two criteria of the real category and the classification judgment made by the classification model. Take the binary classification problem as an example. There are two types of records in the dataset: positive and negative. The classification model will make positive judgments (judgment records belong to the positive category) or negative judgments (judgment records belong to the negative category). The row represents the reality, and the column represents the forecast.The evaluation indicators extended by the confusion matrix as follows:Accuracy: the percentage of correctly classified samples in the total sample.Precision: the probability of a positive sample among the samples predicted to be positive.Recall: the probability that the model predicts a positive sample in the actual positive sample.F1-score: it can be regarded as the harmonic mean of model Accuracy and Recall.


### 5.4.2. Evaluation Index of Clustering Model

SSE (sum of the squared errors) is a measure of cluster looseness. As an objective function, it is actually a strict Coordinate Decedent process. SSE cannot guarantee finding the global optimal solution but can only guarantee the local optimal solution. In other words, it may cause a variety ofk cluster divisions.Silhouette Coefficient combines the degree of cohesion and the degree of separation to evaluate the effect of clustering. The value range of the average profile coefficient is [−1, 1]. The larger the coefficient, the better the clustering effect. After each clustering, each sample will get a contour coefficient. When it is 1, it means that the point is far away from the surrounding clusters, which is a good classification. When the value is 0, it means that the point is on the boundary of the two clusters. When the value is negative, it means that the point may be misclassified.Adjusted Rand index is proposed to achieve “in the case of clustering results randomly generated, the index should be close to zero,” which has a higher degree of discrimination; the calculation formula is(23)ARI=RI−ERImaxRI−ERI.The value range of ARI is [−1, 1]. The larger the value is, the more consistent the clustering result is with the real situation. In a broad sense, ARI measures the degree of agreement between the two data distributions.


### 5.4.3. Evaluation of Predictive Models

Figure6 is an illustration of the confusion matrix drawn by the prediction results after the dataset is trained with IFPSO-SVM. Each row represents the real situation, each column represents the prediction situation, and the main diagonal represents the correct sample size of the prediction.Figure 6
Confusion matrix.It can be seen from the figure that the total number of data samples in the test set is 61, of which 29 are health data samples and 32 are disease data samples. 26 of the health data samples were correctly predicted, and 29 of the disease data samples were correctly predicted.Table4 shows the values of some evaluation indicators calculated from the confusion matrix obtained by the prediction model.Table 4
Evaluation index value of IFPSO-SVM algorithm (heart disease dataset).
PrecisionRecallF1-ScoreSupportHealthy0.900.900.9029Disease0.910.910.9132Accuracy0.9061Macro avg.0.900.900.9061Weighted avg.0.900.900.9061To compare the performance of the heart disease prediction model based on the IFPSO-SVM proposed in this paper, several other algorithms [34, 35] are used to predict the same dataset, as well as the Precision, Recall, and F1-Score. The experimental results are shown in Table 5.Table 5
Comparison of prediction results of different algorithms.
AlgorithmsPrecisionRecallF1-ScorePSO-SVM0.8090.7590.783BP0.8310.7830.806XGBoost0.8650.8040.833FOPSO-SVM0.8650.8450.855IFPSO-SVM0.9100.9100.900Through the comparison experiment, we can see that, for the basic PSO-SVM classification model, the prediction accuracy is about 80%. The accuracy of the model built by the PSO algorithm that only updates the velocity in fractional order is about 83%. The prediction accuracy of the IFPSO-SVM model in this article has reached 90%, which greatly improves the effectiveness and accuracy of the model. All indicators are better than those in other algorithms.Finally, draw the ROC (Receiver Operating Characteristic) curve of the method in this article. Combining the two variables (1−specificity and sensitive) with a graphical method can more clearly and accurately integrate the accuracy of the reaction model. The horizontal axis is the false positive rate, and its value is proportional to the false positive rate. The vertical axis is the true positive rate, and its value is proportional to the accuracy rate. Therefore, the closer to the upper left corner of the ROC space, the better the judgment effect, as shown in Figure 7.Figure 7
ROC curve graph.AUC is the area under the ROC curve. In the experiment, the larger the AUC value, the better the model effect. Usually, (1)AUC≈1.0 means the model is the most ideal, (2) 0.7≤AUC≤0.9 means the accuracy of the model is high, and (3) AUC=0.5 means the model is meaningless. In general, an AUC of 0.9 or more can be regarded as a highly accurate judgment experiment. The prediction at this time is of practical significance. In the above model, AUC=0.9385 (the parameter combination is as follows: gamma = 0.055; c = 0.7915). It shows that the accuracy of the model has reached the standard of practical significance, and the introduction of the IFPSO algorithm greatly improves the accuracy of the model.In the multiclassification application of IFPSO-SVM, the model also has a better improvement effect. Table6 shows the algorithm evaluation of the model to classify the Wine dataset.Table 6
Evaluation index value of IFPSO-SVM algorithm (Wine dataset).
PrecisionRecallF1-ScoreSupportType 11.001.001.0014Type 21.001.001.0014Type 31.001.001.008Accuracy1.0036Macro avg.1.001.001.0036Weighted avg.1.001.001.0036It can be seen that we selected 20% of the dataset as the test set, and the Precision, Recall, and F1-Score obtained from the simulation experiment all reached 1 (the parameter combination is as follows: gamma = 0.158;c = 6.5811). Explain that the predictions for all test data are accurate. At the same time, it shows that the IFPSO algorithm effectively improves the prediction accuracy and accuracy of SVM, not only for accidental datasets. The algorithm has a good classification effect on two-category and multicategory problems.In summary, the IFPSO algorithm in this paper has better performance in the parameter optimization problem of SVM. The time complexity of the algorithm is significantly reduced, and the ability to find the global optimal solution is improved. The IFPSO-SVM prediction model constructed in this paper has achieved a higher diagnostic success rate than other models in the diagnosis of heart disease, which makes the research of the model have certain practical reference significance. The accuracy of the multicategory model has also reached 100%. The effect of the algorithm has improved significantly.


### 5.4.4. Evaluation of the Clustering Model

According to the change curve of SSE and profile coefficient, the number of clusters is dynamically obtained. Use the standard dataset Iris as the test data. Set the range of the number of clustersk to [2, 10], and draw the SSE and Silhouette Coefficient corresponding to different numbers of clusters, to select the value of k more intuitively, as shown in Figure 8.Figure 8
Change curve of SSE and Silhouette Coefficient. (a) K-means SSE. (b) K-means Silhouette Coefficient.
(a)(b)Combining the graph, it can be seen that whenk=3, the SSE value decreases significantly, and the Silhouette Coefficient value is also higher. The actual number of classifications in the Iris dataset is also 3, which is consistent with the calculated k value.The IFPSO-KM algorithm is verified through experiments on UCI’s Iris and Wine dataset. The clustering effect of the Iris dataset can be represented by three-dimensional images. Figure9 shows the clustering effect diagram of the IFPSO-KM algorithm, and Figure 10 shows a diagram of scattering clustering according to the true value. It can be seen that the effect of the improved algorithm clustering is better. Its clusters are relatively close and the distance between clusters is large, which meets the clustering requirements.Figure 9
Cluster graph of IFPSO-KM (Iris).Figure 10
Iris’ real cluster graph.When using IFPSO-KM to cluster two datasets, the parameters are set as follows: takec1=c2=1.49, ωmax=0.8, ωmin=0.3, α=0.6, and β=0.4. Table 7 shows the number of error points for training on the Iris and Wine datasets by different clustering methods. Since the Wine dataset has more attribute values, only the corresponding initial center points of Iris are given in the table. The optimal initial center points obtained by the IFPSO- KM algorithm are the 49th, 98th, and 129th data points in the sample set, respectively. After experiments, we can see that the KM algorithm is very sensitive to the initial center point. Although the number of misclassifications in some experiments is relatively small, the improved algorithm combined with the PSO algorithm is better than the KM algorithm in terms of the degree of dependence on the initial center point and the accuracy of the classification. Effectively reduce the randomness of clustering.Table 7
Clustering result.
AlgorithmInitial cluster center of Iris datasetMisclassificationsIris datasetWine datasetK-means115512212650K-means++358912211602PSOK-means41721096286IFPSO-KM4998129648It is worth pointing out that the standard KM algorithm is not very effective for clustering datasets with more data attributes and a relatively large amount of data, and the classification accuracy can only reach about 80%. The classification accuracy of the IFPSO algorithm in this article combined with KM reached 98.183%, and the Rand index also reached 0.924, with a homogenization score of 0.905. It is a clustering model with a better clustering effect.


## 5.4.1. Confusion Matrix

A confusion matrix can effectively measure the accuracy of a classifier’s classification. It is a situation analysis table for summarizing and predicting the results of classification models in data science, data analysis, and machine learning. In the form of a matrix, the records in the dataset are summarized according to the two criteria of the real category and the classification judgment made by the classification model. Take the binary classification problem as an example. There are two types of records in the dataset: positive and negative. The classification model will make positive judgments (judgment records belong to the positive category) or negative judgments (judgment records belong to the negative category). The row represents the reality, and the column represents the forecast.The evaluation indicators extended by the confusion matrix as follows:Accuracy: the percentage of correctly classified samples in the total sample.Precision: the probability of a positive sample among the samples predicted to be positive.Recall: the probability that the model predicts a positive sample in the actual positive sample.F1-score: it can be regarded as the harmonic mean of model Accuracy and Recall.


## 5.4.2. Evaluation Index of Clustering Model

SSE (sum of the squared errors) is a measure of cluster looseness. As an objective function, it is actually a strict Coordinate Decedent process. SSE cannot guarantee finding the global optimal solution but can only guarantee the local optimal solution. In other words, it may cause a variety ofk cluster divisions.Silhouette Coefficient combines the degree of cohesion and the degree of separation to evaluate the effect of clustering. The value range of the average profile coefficient is [−1, 1]. The larger the coefficient, the better the clustering effect. After each clustering, each sample will get a contour coefficient. When it is 1, it means that the point is far away from the surrounding clusters, which is a good classification. When the value is 0, it means that the point is on the boundary of the two clusters. When the value is negative, it means that the point may be misclassified.Adjusted Rand index is proposed to achieve “in the case of clustering results randomly generated, the index should be close to zero,” which has a higher degree of discrimination; the calculation formula is(23)ARI=RI−ERImaxRI−ERI.The value range of ARI is [−1, 1]. The larger the value is, the more consistent the clustering result is with the real situation. In a broad sense, ARI measures the degree of agreement between the two data distributions.


## 5.4.3. Evaluation of Predictive Models

Figure6 is an illustration of the confusion matrix drawn by the prediction results after the dataset is trained with IFPSO-SVM. Each row represents the real situation, each column represents the prediction situation, and the main diagonal represents the correct sample size of the prediction.Figure 6
Confusion matrix.It can be seen from the figure that the total number of data samples in the test set is 61, of which 29 are health data samples and 32 are disease data samples. 26 of the health data samples were correctly predicted, and 29 of the disease data samples were correctly predicted.Table4 shows the values of some evaluation indicators calculated from the confusion matrix obtained by the prediction model.Table 4
Evaluation index value of IFPSO-SVM algorithm (heart disease dataset).
PrecisionRecallF1-ScoreSupportHealthy0.900.900.9029Disease0.910.910.9132Accuracy0.9061Macro avg.0.900.900.9061Weighted avg.0.900.900.9061To compare the performance of the heart disease prediction model based on the IFPSO-SVM proposed in this paper, several other algorithms [34, 35] are used to predict the same dataset, as well as the Precision, Recall, and F1-Score. The experimental results are shown in Table 5.Table 5
Comparison of prediction results of different algorithms.
AlgorithmsPrecisionRecallF1-ScorePSO-SVM0.8090.7590.783BP0.8310.7830.806XGBoost0.8650.8040.833FOPSO-SVM0.8650.8450.855IFPSO-SVM0.9100.9100.900Through the comparison experiment, we can see that, for the basic PSO-SVM classification model, the prediction accuracy is about 80%. The accuracy of the model built by the PSO algorithm that only updates the velocity in fractional order is about 83%. The prediction accuracy of the IFPSO-SVM model in this article has reached 90%, which greatly improves the effectiveness and accuracy of the model. All indicators are better than those in other algorithms.Finally, draw the ROC (Receiver Operating Characteristic) curve of the method in this article. Combining the two variables (1−specificity and sensitive) with a graphical method can more clearly and accurately integrate the accuracy of the reaction model. The horizontal axis is the false positive rate, and its value is proportional to the false positive rate. The vertical axis is the true positive rate, and its value is proportional to the accuracy rate. Therefore, the closer to the upper left corner of the ROC space, the better the judgment effect, as shown in Figure 7.Figure 7
ROC curve graph.AUC is the area under the ROC curve. In the experiment, the larger the AUC value, the better the model effect. Usually, (1)AUC≈1.0 means the model is the most ideal, (2) 0.7≤AUC≤0.9 means the accuracy of the model is high, and (3) AUC=0.5 means the model is meaningless. In general, an AUC of 0.9 or more can be regarded as a highly accurate judgment experiment. The prediction at this time is of practical significance. In the above model, AUC=0.9385 (the parameter combination is as follows: gamma = 0.055; c = 0.7915). It shows that the accuracy of the model has reached the standard of practical significance, and the introduction of the IFPSO algorithm greatly improves the accuracy of the model.In the multiclassification application of IFPSO-SVM, the model also has a better improvement effect. Table6 shows the algorithm evaluation of the model to classify the Wine dataset.Table 6
Evaluation index value of IFPSO-SVM algorithm (Wine dataset).
PrecisionRecallF1-ScoreSupportType 11.001.001.0014Type 21.001.001.0014Type 31.001.001.008Accuracy1.0036Macro avg.1.001.001.0036Weighted avg.1.001.001.0036It can be seen that we selected 20% of the dataset as the test set, and the Precision, Recall, and F1-Score obtained from the simulation experiment all reached 1 (the parameter combination is as follows: gamma = 0.158;c = 6.5811). Explain that the predictions for all test data are accurate. At the same time, it shows that the IFPSO algorithm effectively improves the prediction accuracy and accuracy of SVM, not only for accidental datasets. The algorithm has a good classification effect on two-category and multicategory problems.In summary, the IFPSO algorithm in this paper has better performance in the parameter optimization problem of SVM. The time complexity of the algorithm is significantly reduced, and the ability to find the global optimal solution is improved. The IFPSO-SVM prediction model constructed in this paper has achieved a higher diagnostic success rate than other models in the diagnosis of heart disease, which makes the research of the model have certain practical reference significance. The accuracy of the multicategory model has also reached 100%. The effect of the algorithm has improved significantly.


## 5.4.4. Evaluation of the Clustering Model

According to the change curve of SSE and profile coefficient, the number of clusters is dynamically obtained. Use the standard dataset Iris as the test data. Set the range of the number of clustersk to [2, 10], and draw the SSE and Silhouette Coefficient corresponding to different numbers of clusters, to select the value of k more intuitively, as shown in Figure 8.Figure 8
Change curve of SSE and Silhouette Coefficient. (a) K-means SSE. (b) K-means Silhouette Coefficient.
(a)(b)Combining the graph, it can be seen that whenk=3, the SSE value decreases significantly, and the Silhouette Coefficient value is also higher. The actual number of classifications in the Iris dataset is also 3, which is consistent with the calculated k value.The IFPSO-KM algorithm is verified through experiments on UCI’s Iris and Wine dataset. The clustering effect of the Iris dataset can be represented by three-dimensional images. Figure9 shows the clustering effect diagram of the IFPSO-KM algorithm, and Figure 10 shows a diagram of scattering clustering according to the true value. It can be seen that the effect of the improved algorithm clustering is better. Its clusters are relatively close and the distance between clusters is large, which meets the clustering requirements.Figure 9
Cluster graph of IFPSO-KM (Iris).Figure 10
Iris’ real cluster graph.When using IFPSO-KM to cluster two datasets, the parameters are set as follows: takec1=c2=1.49, ωmax=0.8, ωmin=0.3, α=0.6, and β=0.4. Table 7 shows the number of error points for training on the Iris and Wine datasets by different clustering methods. Since the Wine dataset has more attribute values, only the corresponding initial center points of Iris are given in the table. The optimal initial center points obtained by the IFPSO- KM algorithm are the 49th, 98th, and 129th data points in the sample set, respectively. After experiments, we can see that the KM algorithm is very sensitive to the initial center point. Although the number of misclassifications in some experiments is relatively small, the improved algorithm combined with the PSO algorithm is better than the KM algorithm in terms of the degree of dependence on the initial center point and the accuracy of the classification. Effectively reduce the randomness of clustering.Table 7
Clustering result.
AlgorithmInitial cluster center of Iris datasetMisclassificationsIris datasetWine datasetK-means115512212650K-means++358912211602PSOK-means41721096286IFPSO-KM4998129648It is worth pointing out that the standard KM algorithm is not very effective for clustering datasets with more data attributes and a relatively large amount of data, and the classification accuracy can only reach about 80%. The classification accuracy of the IFPSO algorithm in this article combined with KM reached 98.183%, and the Rand index also reached 0.924, with a homogenization score of 0.905. It is a clustering model with a better clustering effect.


## 6. Conclusion

For the problems of FOPSO algorithm and FODPSO algorithm, which only improve the velocity update formula with fractional factor, we consider adding new variables. The fractional derivation is performed on both velocity and position formulas. It can reduce the dependence on moperatorα and increase the randomness of the particles. The probability of the population falling into the local optimum is reduced. Experiments have also proved that the improved algorithm has better convergence performance and better ability to find the global optimal solution.Aiming at the problem of low prediction accuracy of SVM, this paper establishes the prediction model of IFPSO-SVM. The IFPSO algorithm is used to optimize the error penalty factor of the SVM and the parameter of the kernel function. Combining the heart dataset for simulation experiments and comparing the prediction results with the previous model, the results show that the IFPSO-SVM model has the characteristics of higher prediction accuracy and faster convergence speed. Moreover, it has a good classification effect on two-category and multicategory datasets. Due to the shortcomings of the KM algorithm, such as excessive reliance on the selection of the initial center, difficulty to obtain the global optimal solution, and empty class, this paper uses the IFPSO algorithm to select the clustering center of the dataset to optimize the clustering effect. The IFPSO-KM algorithm has a fast convergence speed and a stable clustering result. It is worth pointing out that the combination of fractional particle swarm algorithm and mutation operation can prevent empty classes and improve clustering accuracy at the same time.In the future research, adopting an adaptive algorithm for the fractional order to better enhance the diversity and randomness of particles shall be considered. For the dataset, it is possible to consider setting different size impact factors on the input feature vector according to the degree of importance to facilitate better training of the model.



---

*Source: 5885235-2022-05-26.xml*