Algorithm: SVM-PSO | |
Inputs: nparticles, c1, c2, Wmin, Wmax, dataset, Cmin, Cmax, N | |
Output: gbest containing C, γ, and selected features | |
1 | Initialize random uniform lists rc and rγwith the size of nparticles and random uniform matrix Rfeatures with Size nfeatures × nparticles |
2 | Initialize matrix X by vertically stacking rC, rγ, and Rfeatures and matrix V with the size of (nfeatures+ 2) × nparlicles |
3 | Pbest ← X |
4 | gbest ← column of pbest with lowest cross-entropy loss of SVM |
5 | Create w as a list of evenly spaced numbers (in descending order) from Wmin to Wmax |
6 | fori = 1,2,…,Ndo |
7 | Wcurrent←Wi |
8 | Create random variables r1 and r2 on a continuous uniform distribution |
9 | V←Wcurrent V+c1r1(pbest - X) + c2r2(gbest−X) |
10 | X←X+V |
11 | Replace the first row’s negative values of X with random uniform numbers betweenCmin and Cmax |
12 | Replace the second row’s negative values of X with random uniform numbers between 0 and 1 |
13 | Run SVM with each particle’s C, γ, and selected features |
14 | Calculate cross-entropy as the loss Junction of each SVM and store the list of results in objectiveresult |
15 | Replace pbest of particles that have better objectiveresult |
16 | Update gbest if necessary |
17 | end for |
18 | Return gbest |
Pseudocode 1: A standard SVM-PSO. | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Sharing content requires targeting cookies to be enabled. Please update your cookie preferences to use this feature.