Skip to main content
. 2026 Mar 4;16(3):150. doi: 10.3390/bios16030150
Algorithm 1 Pseudocode of the PSO-based feature selection procedure used to determine the optimal subset of discriminative ECG features.
Input: Feature matrix (X), Class labels (y)
Output: Optimal feature subset (gBest)
Procedure PSO_Feature_Selection()
    Initialize the particle population with random binary feature subsets
    Initialize particle velocities and PSO parameters (ω, c1, c2)
    while termination condition not met do
        for each particle in the population do
            Evaluate fitness using selected features (e.g., classification accuracy)
            Update personal best position (pBest) and global best (gBest)
            Update velocity and position using standard PSO equations
            Apply sigmoid transfer function to binarize new positions
        end for
        Update global best solution if needed
    end while
Return: gBest → selected optimal feature subset