scieee AI-readable full text Open interactive document viewer

Analyzing physics-inspired metaheuristic algorithms in feature selection with K-Nearest-Neighbor

Priyadarshini, Jayaraju

Abstract

In recent years, feature selection has emerged as a major challenge in machine learning. In this paper, considering the promising performance of metaheuristics on different types of applications, six physics-inspired metaphor algorithms are employed for this problem. To evaluate the capability of dimensionality reduction in these algorithms, six diverse-natured datasets are used. The performance is compared in terms of the average number of features selected (AFS), accuracy, fitness, convergence capabilities, and computational cost. It is found through experiments that the accuracy and fitness of the Equilibrium Optimizer (EO) are comparatively better than the others. Finally, the average rank from the perspective of average fitness, average accuracy, and AFS shows that EO outperforms all other algorithms.

Full text

Citation: Priyadarshini, J.; Premalatha, M.; ˇ Cep, R.; Jayasudha, M.; Kalita, K. Analyzing Physics-Inspired Metaheuristic Algorithms in Feature Selection with K-Nearest-Neighbor. Appl. Sci. 2023,13, 906. https:// doi.org/10.3390/app13020906 Academic Editors: Juan A. Gómez-Pulido and Michele Girolami Received: 12 September 2022 Revised: 30 December 2022 Accepted: 6 January 2023 Published: 9 January 2023 Copyright: © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). applied sciences Article Analyzing Physics-Inspired Metaheuristic Algorithms in Feature Selection with K-Nearest-Neighbor Jayaraju Priyadarshini 1, Mariappan Premalatha 1, Robert ˇ Cep 2, Murugan Jayasudha 1and Kanak Kalita 3,* 1School of Computer Science and Engineering, Vellore Institute of Technology, Chennai 600027, India 2Department of Machining, Assembly and Engineering Metrology, Faculty of Mechanical Engineering, VSB-Technical University of Ostrava, 17. Listopadu 2172/15, 708 00 Ostrava, Czech Republic 3Department of Mechanical Engineering, Vel Tech Rangarajan Dr. Sagunthala R&D Institute of Science and Technology, Avadi 600062, India *Correspondence: [email protected] Abstract: In recent years, feature selection has emerged as a major challenge in machine learning. In this paper, considering the promising performance of metaheuristics on different types of applications, six physics-inspired metaphor algorithms are employed for this problem. To evaluate the capability of dimensionality reduction in these algorithms, six diverse-natured datasets are used. The performance is compared in terms of the average number of features selected (AFS), accuracy, fitness, convergence capabilities, and computational cost. It is found through experiments that the accuracy and fitness of the Equilibrium Optimizer (EO) are comparatively better than the others. Finally, the average rank from the perspective of average fitness, average accuracy, and AFS shows that EO outperforms all other algorithms. Keywords: optimization; non-traditional algorithms; feature reduction; KNN; algorithms 1. Introduction Data mining is the process of finding meaningful information or extracting knowledge from large amounts of data. Data mining has the challenging problem of dealing with huge data dimensions. When working with data that has a large number of dimensions, even the advantages of technology can be a hassle [ 1 ]. The data-mining process may suffer due to a huge number of dimensions. It may also require a lot of computing time and space. Traditional machine-learning (ML) methods cannot handle these huge datasets [ 2 ]. The dataset is made up of several samples that collectively give information about a specific case of the problem. Each sample has a variety of attributes or features. The dataset may have several superfluous or duplicate attributes, in addition to its huge dimensionality. The model may be complex, and the dataset may include a substantial amount of noise. The best subset of the useful features that will contribute to the output is chosen via a pre-processing technique called feature selection (FS) [ 2 ]. FS can reduce the training time as well as the huge number of dimensions in the data. Moreover, the model’s accuracy is enhanced in addition to the simplification of the model and the best utilization of computing resources [3]. The two main FS approaches are wrapper methods and filter methods. The major drawback of the filter methods is that they work independently of the ML classifiers and do not take any input from them [ 4 ]. Meanwhile, the wrapper method uses the classifier directly and picks the features using an optimization algorithm [ 5 ]. Optimization algorithms provide the advantage of choosing an optimal or nearly optimal subset of features in a reasonable amount of time as opposed to the conventional exhaustive search. An exhaustive search becomes impractical, because it finds the solution by creating all feasible feature subsets (2 m different solutions for m features) [ 6 ]. In the literature, optimization algorithms are categorized into several groups, such as evolution-based algorithms, Appl. Sci. 2023,13, 906. https://doi.org/10.3390/app13020906 https://www.mdpi.com/journal/applsci Appl. Sci. 2023,13, 906 2 of 19 swarm-based algorithms, human behavior-inspired algorithms, physics-inspired algorithms, etc. [ 7 ]. Swarm-based algorithms mimic the collective but decentralized intelligence of living creatures, such as birds [ 8 ], wolves [ 9 ], whales [ 10 ], bacteria [ 11 ], etc. Evolutionary algorithms mimic the emergence of the fittest and healthiest individuals over generations. A few examples are the Genetic Algorithm (GA) [ 12 ], Differential Evolution (DE) [ 13 ], Biogeography-Based Optimization (BBO) [ 14 ], etc. Human behavior-inspired algorithms mimic the collective intelligent behavior of human beings in different real-life situations, such as politics [ 15 ], sports [ 16 ], corporations [ 7 ], etc. Finally, physics-based algorithms are inspired by the laws of nature, such as the gravitational law [ 17 ], black holes [ 18 ], galaxies [19], etc. In recent years, metaphor-based algorithms have extensively been used to solve FS problems from different domains. Examples include feature selection using Particle Swarm Optimization (PSO) for document clustering [ 20 ], the use of a real-valued Grasshopper Optimization Algorithm (GOA) for feature selection [ 21 ], hybridization of the Whale Optimization Algorithm (WOA) and Simulated Annealing (SA) for the feature selection problem [ 22 ], feature selection for intrusion detection in wireless mesh networks incorporating genetic operators in WOA [ 23 ], the incorporation of levy flight and opposition-based learning in chaotic Cuckoo Search (CS) for feature selection [ 24 ], feature selection using Moth Flame Optimization (MFO) [ 25 ], feature selection using the Firefly Algorithm (FA) [ 26 ], the hybridization of SA with Harris Hawk Optimization (HHO) for the feature selection problem [ 27 ] and feature selection using binary Teaching–Learning-Based Optimization (TLBO). According to the No-Free-Lunch (NFL) theorem [ 28 ], no single optimization algorithm is capable of solving every optimization problem by outperforming all other optimization techniques. Because of this, one optimizer can perform better than the others on some problems, but not on all of them. Hence, it is crucial to compare several optimization algorithms on a variety of datasets to find the optimum solution to the feature selection problem. Since there are hundreds of optimization algorithms in the literature, in this study, a few well-known and highly cited physics-inspired algorithms are chosen for this purpose. The rationale is to carry out a comparison of the various metaphors drawn from physics and evaluate their effectiveness. To evaluate the performance of these algorithms, six small- to-large-sized classification datasets are used. The accuracy, convergence, and average fitness of these algorithms are compared. This paper has the following contributions: • The main novelty of our paper lies in its comparative analysis of six well-cited physicsinspired metaphor algorithms for the problem of feature selection. • To the best of our knowledge, this is the first time these physics-inspired algorithms have been compared for this specific problem, and our findings provide valuable insights into their performance. • Our study also has broader implications for the field of machine learning and data mining, as it helps to shed light on the effectiveness of different optimization algorithms for feature selection. • Our work contributes to the growing body of research on metaheuristics and their potential applications in machine learning and data mining, and it highlights the potential value of using physics-inspired optimization algorithms for feature selection. • Additionally, our use of variable-sized classification datasets allows us to assess the applicability of these algorithms on a wide range of problems, making our results more generalizable and applicable to practitioners. Overall, we believe that our paper represents a significant contribution to the field and has the potential to impact the way practitioners approach the problem of feature selection. The rest of the paper is organized as follows. The methodology is discussed in Section 2. Section 3, namely, the Results and Discussion, covers the results and comparative analysis of all six algorithms, and the concluding remarks are given in Section 4. Appl. Sci. 2023,13, 906 3 of 19 2. Methodology 2.1. Wrapper Method for Feature Selection For feature selection, we employed a wrapper method. To accomplish their task, wrapper techniques use a learning algorithm that applies a search strategy to explore the space of feasible feature subsets, ranking them according to the quality of their performance in a specific algorithm. In most cases, wrapper approaches outperform filter methods, since the feature selection process is tailored to the specific classification algorithm being employed. Wrapper methods, on the other hand, are prohibitively time- and resourceintensive for high-dimensional data, since they require evaluating each feature set with the classifier algorithm. Figure 1depicts the way in which wrapper methods function. Appl. Sci. 2023, 12, x FOR PEER REVIEW 3 of 20 Section 2. Section 3, namely, the Results and Discussion, covers the results and comparative analysis of all six algorithms, and the concluding remarks are given in Section 4. 2. Methodology 2.1. Wrapper Method for Feature Selection For feature selection, we employed a wrapper method. To accomplish their task, wrapper techniques use a learning algorithm that applies a search strategy to explore the space of feasible feature subsets, ranking them according to the quality of their performance in a specific algorithm. In most cases, wrapper approaches outperform filter methods, since the feature selection process is tailored to the specific classification algorithm being employed. Wrapper methods, on the other hand, are prohibitively time- and resource-intensive for high-dimensional data, since they require evaluating each feature set with the classifier algorithm. Figure 1 depicts the way in which wrapper methods function. Figure 1. Wrapper feature selection framework. In this paper, K-Nearest Neighbor (k-NN) is used as the evaluator algorithm. The k- NN method uses a set of K neighbors to determine how an object should be categorized. A positive integer value of K is pre-decided before running the algorithm. To classify a record, the Euclidean distances between the unclassified record and the classified records are determined and ranked. 2.2. Fitness Function The effectiveness of an optimizer is evaluated by its fitness function. The fitness function in feature selection is dependent on the classification error rate and the number of features used for classification. It is deemed to be a good solution if the selected feature subset reduces the classification error rate and the number of features chosen. The following fitness function is used in this paper [29]: ↓ 𝐹𝑖𝑡𝑛𝑒𝑠𝑠 =𝜆𝛾𝑆(𝐷)+(1−𝜆)|𝑆| |𝐹| (1) where 𝛾𝑆(𝐷) is the classification error computed by the classifier, |𝑆| is the reduced number of features in the new subset, |𝐹| is the total features in the dataset, and 𝜆 𝜖 [0,1] Figure 1. Wrapper feature selection framework. In this paper, K-Nearest Neighbor (k-NN) is used as the evaluator algorithm. The k-NN method uses a set of K neighbors to determine how an object should be categorized. A positive integer value of K is pre-decided before running the algorithm. To classify a record, the Euclidean distances between the unclassified record and the classified records are determined and ranked. 2.2. Fitness Function The effectiveness of an optimizer is evaluated by its fitness function. The fitness function in feature selection is dependent on the classification error rate and the number of features used for classification. It is deemed to be a good solution if the selected feature subset reduces the classification error rate and the number of features chosen. The following fitness function is used in this paper [29]: ↓Fitness =λγS(D) + (1−λ)|S| |F|(1) where γS(D) is the classification error computed by the classifier, |S| is the reduced number of features in the new subset, |F| is the total features in the dataset, and λ e [0, 1] is a factor corresponding to the importance of the classification performance and length of the reduced subset. 2.3. Physics-Inspired Metaphor Algorithms In this paper, six well-cited physics-inspired metaphor algorithms are employed to solve the problem of feature selection. In this section, the functioning of these algorithms and their position-updating mechanisms are discussed. Appl. Sci. 2023,13, 906 4 of 19 2.3.1. Simulated Annealing Simulated Annealing is a fundamental nature-inspired algorithm that was proposed in 1983 by Kirkpatrick et al. [ 30 ]. The source of inspiration behind this algorithm is the annealing process of metals. The process of annealing, which starts at a very high temperature and progressively cools down, is used to physically harden metals. The algorithm involves three main parameters, including the cooling rate ( c ), the final temperature ( Tf ), and the starting temperature ( T0 ). The starting temperature is kept very high initially, and the cooling rate gradually reduces until it reaches the final temperature. The process is mimicked by randomly generating a candidate solution. The algorithm runs iteratively, and a new solution is generated in the neighborhood of the current solution in each iteration. The fitness of the current and neighbor solutions is compared. If the fitness of the new solution is better, then the position of the current solution is updated. Moreover, the best solution keeps the best position found so far. The terminating condition of the repetitive process is reaching the Tf. In each iteration, Tis updated as follows: T=T∗C, 0 <c<1 (2) SA is a global optimization algorithm, because it can explore as well as exploit the search space. The exploration is performed by updating the current solution with a worse neighboring solution in early iterations based on the value of T and the worse value of the neighboring solution. The chance of accepting the worse neighbor is computed using the following equation: exp−δ T≤r(3) where exp is the exponential function, δ is equal to the fitness difference of current and neighboring solutions, and ris randomly generated in the range [0, 1]. 2.3.2. Gravitational Search Algorithm This algorithm is inspired by Newton’s law of gravitation and the second law of motion [ 17 ]. It treats each candidate solution in the search space as an object whose mass is considered to be its fitness. Heavier objects are considered fitter than lighter objects. The objects are attached to each other with some gravitational force that causes objects to explore the search space. The heaviest object is considered the global best solution. Since the heavier objects attract other objects with more force, the whole population ultimately converges toward the heaviest object, called the global best solution. The algorithm is comprised of a few mathematical equations that are expressed below. Force calculation: The force from an object j on an object i is calculated using the following equation: Fd ij(t) = G(t)Mpi(t)×Maj(t) Rij(t) + e(xd j(t)−xd i(t)) (4) In the above equation, G is the gravitational constant that controls the search accuracy, Mpi is the passive gravitational mass of solution i , Maj is the active gravitational mass of solution j , the distance between solution i and solution j is denoted by Rij , xd is the position of a solution in dth dimension, and eis a small constant. The ultimate force on a solution (mass) is calculated by taking the weighted sum of all the forces on that solution from the kbest solutions, which are calculated as follows: Fd i(t) = ∑ j∈kbest,j6=i randjFd ij(t)(5) Appl. Sci. 2023,13, 906 5 of 19 Acceleration calculation: Once the total force on a solution in a particular dimension d is calculated, the acceleration of the solution in that dimension can be computed using the following equation: ad i(t) = Fd i(t) Mii(t)(6) where Mii is the mass of inertia of solution i. Velocity calculation: Based on the acceleration, the velocity of a solution can be computed by adding the acceleration to a fraction of the previous velocity of that solution. The equation to compute velocity is given below: vd i=randi×vd i(t) + ad i(t)(7) Position updating: To update the position of a solution, the updated velocity is simply added to the old position of the solution, as formulated below: xd i(t+1)=xd i(t) + vd i(t+1)(8) Gravitational constant updating: To update G, the following relation is used: G(t) = G0exp−αt tmax (9) where G0 is the initial gravitational constant, and α is a constant. t and tmax represent the current and final iteration numbers. 2.3.3. Sine Cosine Algorithm The Sine Cosine Algorithm (SCA) [ 31 ] has a very unique source of inspiration. It utilizes two sine and cosine functions to update the position of solutions when searching the space to find the global optimum. The position-updating model of this algorithm is very simple and is formulated below: Xt+1 i=(Xt i+r1×sin(r2)×r3Pt i−Xt i,r4<0.5 Xt i+r1×cos(r2)×r3Pt i−Xt i,r4≥0.5 (10) In the above equation, Xi denotes a solution in the ith dimension, and Pi denotes the global best solution, namely, the destination solution in the paper. The above equation involves a few other variables that are defined below. r1 is an adaptive parameter that is linearly reduced with the course of iterations. It starts from a prefixed value and linearly decreases in each iteration. It is computed as follows: r1=α−tα T(11) where αis constant. •r2is randomly generated in the range of 0 to 2π. •r3is also a random number that is generated in the range of 0 to 2. •r4 is also a random number that is generated in the range of 0 to 1, and based on its value, it is decided whether to use the sine function or the cosine function in updating the position of the current solution. When multiplied by r1 , the range of values provided by sin( r2 ) and cos( r2 ) shifts from [ − 1, 1] to [ − 2, 2]. Due to a linear decrease in the values of the parameter r1 , the range begins at [ − 2, 2] and linearly declines to [0, 0] during iterations. The positionupdating equation of SCA creates two regions around the destination P: an inner region that promotes exploitation and an outer region to promote exploration. The precondition to search the inner region is {−1<=r1Xcos(r2)<=1} or {−1<=r1Xsin(r2)<=1} , Appl. Sci. 2023,13, 906 6 of 19 and the precondition to search the outer region is {r1Xcos(r2)} , or {r1Xsin(r2)} gives a value greater than 1 or lesser than −1. 2.3.4. Atom Search Optimization Atom Search Optimization (ASO) [ 32 ], which is inspired by molecular dynamics, has shown a tremendous performance on a variety of applications in the literature. Each atom is considered a candidate solution, and the mass is mapped with the fitness in the optimization algorithm, where the higher the mass, the fitter the solution. Every atom in the population pulls or repels other atoms in the search space. The heavier atoms generate more force and pull lighter objects rapidly, and the heavier objects are pulled slowly towards the others due to their mass. The slowly moving atoms create exploitation in the algorithm, because they can search more locally, whereas the rapidly moving atoms allow the algorithm to explore the search space because of longer and quicker jumps. The algorithm starts with random initializations. In every iteration, the atoms move and accelerate, and the location of the atom that has performed the best up to that point is also likewise adjusted. Atomic acceleration is also caused by two other factors: L-J potential and constraint forces. The acceleration helps to update the velocity of the solutions (atoms). Finally, the velocity is added to the previous position to update the current position of the solution. The position-updating mechanism of the algorithm is discussed below. The population is generated by randomly generating position and velocity vectors for each atom in the population. Xi=hX1 i,X2 i, . . . , XD ii(12) Vi=hV1 i,V2 i, . . . , VD ii(13) The fitness of each solution in the population is computed, and the global best Xbest is determined. The mass of each atom is computed using the following equation: mi=Mi ∑N j=1Mj (14) where M is computed from the fitness of the current solution, the best solution, and the worst solution. The value of Kis computed, where Kdenotes the size of the subset of atoms: K=N−(N−2)rt T(15) where Nis the size of the population. The interaction force on an atom is calculated, which is accomplished using the following equation: Fid=∑ j∈K randjFijd(16) where randjis a random number in the range of [0, 1]. The constraint force is computed using the following equation: Gd i=λXd best −Xd i(17) where λis the Langrangian multiplier that is computed as follows: λ=βe−20t T(18) where βis the multiplier weight. Appl. Sci. 2023,13, 906 7 of 19 Once the mass, constraint forces, and interaction forces are computed, the acceleration is computed as follows: ad i=Fd i md i +Gd i md i (19) Once the acceleration is computed, the velocity of an atom can be computed as follows: Vd i(t+1)=r1Vd i(t) + ad i(t)(20) Using the updated velocity, the position of a solution is updated as follows: Xd i(t+1)=Xd i(t) + Vd i(t+1)(21) 2.3.5. Henry Gas Solubility Optimization Henry Gas Solubility Optimization (HGSO) is inspired by Henry’s gas law [ 33 ], which is stated below: “At a constant temperature, the amount of a given gas that dissolves in a given type and volume of liquid is directly proportional to the partial pressure of that gas in equilibrium with that liquid”. This law can be interpreted as the partial pressure of a gas and the solubility of that gas being directly proportional. If one increases, then the other increases, too. This relation is expressed through the following equation: Sg=H×Pg(22) where the gas solubility is denoted by Sg , Henry’s constant is denoted by H , and the partial pressure of the gas is represented by Pg . The proportionality constant H is highly dependent on the temperature, as it varies with the change in the temperature. In HGSO, each gas particle is considered a candidate solution, whereas all particles collectively make up the population. Initially, gas particles (population) are randomly generated, and then gas particles update their positions in the course of iterations by exploring and exploiting the search space. HGSO involves the following steps. Population initialization: A population of N gas particles is randomly generated using the following equation: Xi(t+1)=X{min}+r×X{max}−X{min}(23) where Xi denotes the initial position of the ith solution, X{min} and X{max} are the lower and upper bounds of the problem function under consideration, r is a randomly generated real number between 0 and 1, and t is the iteration number. The properties of each search agent in HGSO can be initiated using the following equation: Hj(t)=l1×rand(0, 1),P{i,j}=l2×rand(0, 1),Cj=l3×rand(0, 1)(24) where Hj(t) represents Henry’s constant for the jth cluster, P{i,j} denotes the partial pressure of the ith particle in the jth cluster, and Cj indicates the initial constant value for the jth cluster. Clustering: This step divides the search agents into K clusters to map different types of gases, where the same types of gases are grouped into a cluster. Therefore, each cluster has the same value of Henry’s constant Hj. Fitness Evaluation: In this step, each search agent in the jth cluster is evaluated through the objective function to find the best solution Xj,best in the jth cluster. Once all the clusters are evaluated, then the gases are ranked to find the global best particle Xbest. Appl. Sci. 2023,13, 906 8 of 19 Update Henry’s coefficient: The partial pressure of each gas particle changes in each iteration. Therefore, the value of Henry’s coefficient Hj is updated using the following equation: H(t+1)=exp−Cj×1 T−1 T0×Hj(t), ; T(t) = exp( −t t{max}!) (25) where Hj represents the value of Henry’s constant for the j th cluster, T indicates the temperature, T0 denotes a reference temperature equivalent to 298.15 K, and t{max} represents the maximum iterations. Update solubility: In this step, the solubility S{i,j} of the ith particle in the jth cluster is updated using the following equation: S{i,j}(t)=K×Hj(t+1)×P{i,j}(t)(26) where Kis a constant, and P{i,j}is the partial pressure of gas iin cluster j. Update position: The properties of particles computed in the previous steps are utilized to update the position of the ith gas particle in the jth cluster according to the following equation: X{i,j}(t+1)=X{i,j}(t)+F×r1×γ×X{j,best}(t)−X{i,j}(t) +F×r2×a×S{i,j}(t)×X{best}(t)−X{i,j}(t)(27) γ=β× \ expn\f racnF{best}(t)+eonF{i,j}(t)+eoo, ; e=0.05 (28) where the position of the ith search agent in the jth cluster is represented by Xij , the best agent in the jth cluster is denoted by Xj,best , and the global best particle in the entire population is represented by Xbest . Moreover, r1 and r2 are two random values in the range [0, 1], t is the current iteration, F is a flag used for diversification purposes and changes the direction of the solution, γ indicates the ability of the ith particle in the jth cluster to interact with other agents in its cluster, a represents the impact of other gases on the ith particle, β is fixed as β = 1, F i,j is the fitness of the ith particle in the jth cluster, and F{best} is the fitness of the best particle. Escape from local optimum: To avoid stagnation in local optima, all the particles are evaluated, and the worst N w agents are selected and reinitialized using the following equation: Nw=N×(rand(c2−c1)+c1), ; c1=0.1 ; and ;c2=0.2 (29) where N is the population size. Moreover, c1 and c2 are constants that define the percentage of worst particles. 2.3.6. Equilibrium Optimizer (EO) Control volume mass balance models, which are used to estimate both dynamic and equilibrium states, serve as an inspiration for the Equilibrium Optimizer (EO), a recently proposed physics-inspired algorithm [ 34 ]. The particles are considered to be the solutions, and their positions map the concentration of the particles. This algorithm constructs an equilibrium pool of five reference solutions (four best so-far particles and one arithmetic mean of them) called equilibrium candidates. Each particle updates its position with reference to a randomly selected candidate from the pool. The algorithm is aided by two carefully designed parameters called the exponential term ( F ) and the generation rate ( G ). Moreover, a concept of memory saving is used, which allows a solution to update its concentration only if it improves as compared to its previous concentration. The exploration, exploitation, and the balance between them are controlled through these parameters: the equilibrium pool and the generation probability. Appl. Sci. 2023,13, 906 9 of 19 EO uses a mass-balance equation to describe the conservation of mass within a system. The generic mass-balance equation is given as: VdC dt =QC{eq}−QC +G(30) where VdC dt represents the rate of change of mass in a control volume, Q is the flow rate, the concentration at an equilibrium state is denoted by QC{eq} , and G mimics the mass generation rate. Here, dC dt can also be solved in terms of Q V and Q V denoted by λ or the turnover rate (i.e., λ=Q V). Therefore, the above equation can be reconstructed as: dC λC{eq}−λC+G V =dt (31) By taking the integration of the above equation, we obtain: C=C{eq}+C0−C{eq}F+G λV(1−F)(32) which is used as an updating rule for each particle, where Fis calculated as follows: F=exp[−λ(t−t0)] (33) where t0 and C0 represent the initial start time and concentration. In this algorithm, each particle is a solution, and its position represents its concentration. The mathematical formulation of EO is discussed in the following steps. Initialization and function evaluation: The first step is to initialize the particles’ concentration according to the following equation: X{init} {m}=X{min}+randm(X{max}−X{min})(34) where X{init} {m} represents the initial concentration of the mth particle, X{max} shows the maximum, and X{min}shows the minimum values. Equilibrium pool and candidates X e : In this algorithm, four equilibrium candidates (good solutions) are determined to guide other particles and promote exploration. Moreover, a particle constructed by taking the arithmetic mean of all these candidates is also used, which promotes exploitation. These candidates are then assembled to form an equilibrium pool. Each particle updates its position with respect to a randomly selected candidate from the pool. Exponential term (E): This term is used in position updating to balance exploration and exploitation. The exponential term is computed as follows: E=e{−{λ}(t−t0)}(35) where tand t0are computed by following equations, respectively: t=1−Iter Max _iter {(a2Iter Max _iter )} (36) t0=1 λln−a1sign({r}−0.5)h1−e{−{λ}t}i+t(37) In the above equation, a large value of a1 promotes exploration, and a large value of a2 promotes exploitation. The sign({r}−0.5) controls the direction of exploration and exploitation. Using the above equations, Eis computed as follows: E=−a1sign({r}−0.5)[e{−{λ}t}−1]) (38) Appl. Sci. 2023,13, 906 16 of 19 Table 6. Average rank of all averages (Fitness, accuracy, and AFS). Dataset Stats SA GSA SCA ASO HGSO EO DS1 Avg. fitness rank Avg. accuracy rank AFS rank 5 5 6 3 3 1 6 6 4 1 1 3 4 4 2 2 2 4 DS2 Avg. fitness rank Avg. accuracy rank AFS rank 6 6 4 5 5 5 3 3 1 2 2 6 4 4 3 1 1 2 DS3 Avg. fitness rank Avg. accuracy rank AFS rank 6 6 4 1 1 4 5 5 2 3 3 6 4 4 1 2 2 3 DS4 Avg. fitness rank Avg. accuracy rank AFS rank 6 5 6 4 4 4 3 3 1 5 5 5 2 2 2 1 1 3 DS5 Avg. fitness rank Avg. accuracy rank AFS rank 6 6 6 5 5 5 1 1 2 4 4 4 3 3 3 1 1 1 DS6 Avg. fitness rank Avg. accuracy rank AFS rank 6 6 6 3 3 5 4 4 2 1 1 4 5 5 1 2 2 3 Avg. Rank 5.61 3.66 3.11 3.33 3.11 1.88 3.4. Comparison with Other Methods from the Literature In this section, the top three physics-inspired metaheuristic algorithms are compared with the state of the art. For this comparison, results from other KNN-metaheuristic comminations reported by Elminaam et al. [ 37 ] were chosen. The metaheuristics chosen for comparison draw their metaphor inspiration from various sources. For example, the Grey Wolf Optimizer (GWO) and Whale Optimization Algorithm (WOA) may be classified as mammal inspired, whereas moth Flame Optimization (MFO) and the Butterfly Optimization Algorithm (BFO) are insect inspired. Similarly, Harris Hawk Optimization (HHO) and the Marine Predator Algorithm (MPA) are inspired by preying behavior seen in nature. Additionally, results based on popular ML algorithms such as Naive Bayes, Logistic Regression, Random Forest, Support Vector Machine (SVM), K-NN, Decision Tree, and Stochastic Gradient Descent (SGD) are also compared, along with their principal component analysis (PCA)-enhanced versions. In terms of classification accuracy (Table 7), in two out of the three datasets compared, EO outperformed all the other methods. In fact, for the breast cancer dataset and ionosphere dataset, EO was on average 12.75% and 7.12% better, respectively, than the metaheuristics presented in [ 37 ]. In the sonar dataset, too, EO and SCA were within 2.5% of the best solution reported in [ 37 ]. Additionally, when compared with the ML algorithms, the EO solution for the breast cancer dataset was on average 17.89% better. An average superiority of 5.68% was seen for EO when compared with the PCA-ML methods reported in [38]. The average features selected for the breast cancer, ionosphere, and sonar datasets by the various metaheuristics are reported in Table 8. It can be observed that the feature reductions by the current physics-inspired metaheuristics are much higher. For the breast cancer, ionosphere, and sonar datasets, the average percent feature reduction achieved by the three physicsinspired algorithms was 85.11%, 88.24%, and 84.89%, respectively, and for the metaheuristic algorithms from [37], it was only 67.62%, 64.71%, and 67.14%, respectively. Thus, from the comprehensive comparisons shown so far, it is clear that the current KNN hybridized physics-inspired metaheuristic algorithms (especially EO, SCA, and HGSO) are superior to those reported in the literature. Moreover, it is seen that even solutions by hybridized ML algorithms (for example, by dimensionality reduction techniques such as PCA) were inferior to current solutions. This is worth highlighting, since the current wrapper methods are much simpler in terms of computational complexity as compared to the PCA-hybridized ML methods. Appl. Sci. 2023,13, 906 17 of 19 Table 7. Comparison of classification accuracy with literature results. Method Breast Cancer % Improvement &Ionosphere % Improvement Sonar % Improvement EO 0.995 Best Solution 0.986 Best Solution 0.976 2.46% SCA 0.986 0.91% 0.971 1.54% 0.976 2.46% HGSO 0.986 0.91% 0.986 Best Solution 0.951 5.15% GWO [37] 0.970 2.58% 0.951 3.68% 0.970 3.09% MFO [37] 0.605 64.46% 0.774 27.39% 0.547 82.82% WOA [37] 0.973 2.26% 0.957 3.03% 0.976 2.46% SSA [37] 0.982 1.32% 0.985 0.10% 1.000 Best Solution BOA [37] 0.903 10.19% 0.901 9.43% 0.881 13.51% HHO [37] 0.929 7.10% 0.929 6.14% 0.833 20.05% MPA [37] 0.982 1.32% 0.985 0.10% 0.976 2.46% Naive Bayes [38] 0.845 17.75% -- - - Logistic Regression [38] 0.879 13.20% -- - - Random Forest [38] 0.995 Best Solution -- - - SVM [38] 0.620 60.48% -- - - K-NN [38] 0.900 10.56% -- - - Decision Tree [38] 0.880 13.07% -- - - SGD [38] 0.903 10.19% -- - - PCA-Naive Bayes [38] 0.975 2.05% -- - - PCA-Logistic Regression [38] 0.975 2.05% -- - - PCA-Random Forest [38] 0.962 3.43% -- - - PCA-SVM [38] 0.942 5.63% -- - - PCA-K-NN [38] 0.921 8.03% -- - - PCA-Decision Tree [38] 0.905 9.94% -- - - PCA-SGD [38] 0.916 8.62% -- - - &% improvement achieved by the best solution with respect to the compared algorithms. Table 8. Comparison of AFS with literature results. Method Breast Cancer % Feature Reduction &Ionosphere % Feature Reduction Sonar % Feature Reduction EO 4.8 84% 5 85% 11.4 81% SCA 4.8 84% 3.4 90% 8 87% HGSO 3.8 87% 3.6 89% 7.8 87% GWO [37] 7 77% 4 88% 11 82% MFO [37] 6 80% 23 32% 31 48% WOA [37] 8 73% 7 79% 26 57% SSA [37] 11 63% 14 59% 16 73% BOA [37] 12 60% 20 41% 26 57% HHO [37] 12 60% 10 71% 20 67% MPA [37] 12 60% 6 82% 8 87% & % Feature reduction is calculated as 100% minus the ratio of AFS by each algorithm and maximum features in the corresponding dataset. A higher value of % feature reduction is desired. 4. Conclusions In this paper, six well-cited physics-inspired metaphor algorithms were employed for feature selection. Feature selection is one of the major challenges being faced in the field of data mining and machine learning. The objective of this research was to identify the most promising physics-inspired algorithms for the problem of feature selection. To accomplish this, six small- to large-sized datasets were used. The performance of EO was found to be superior on most of the datasets, and the metrics that were used for the comparative analysis were taken from the literature and included accuracy, fitness, the average number of features selected, and convergence analysis. The current physics-inspired metaphor algorithms, especially EO, SCA, and HGSO comprehensively outperformed other metaheuristics, as well as the ML-based solutions seen in recent literature. Based on our findings, we highly recommend using EO for the feature selection problem. Author Contributions: Conceptualization, R. ˇ C. and K.K.; Data curation, J.P., M.P. and M.J.; Formal analysis, J.P., M.P. and M.J.; Investigation, J.P., M.P. and M.J.; Methodology, R. ˇ C. and K.K.; Software, R. ˇ C. and K.K.; Validation, J.P., M.P. and M.J.; Visualization, J.P., M.P. and M.J.; Writing—original draft, J.P., M.P. and M.J.; Writing—review and editing, R. ˇ C. and K.K. All authors have read and agreed to the published version of the manuscript. Appl. Sci. 2023,13, 906 18 of 19 Funding: This research received no external funding. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: The data presented in this study are available through email upon request to the corresponding author. Conflicts of Interest: The authors declare no conflict of interest. References 1. Köppen, M. The curse of dimensionality. In Proceedings of the 5th Online World Conference on Soft Computing in Industrial Applications (WSC5), Online, 4–18 September 2000; Volume 1, pp. 4–8. 2. Ikotun, A.M.; Almutari, M.S.; Ezugwu, A.E. K-Means-Based Nature-Inspired Metaheuristic Algorithms for Automatic Data Clustering Problems: Recent Advances and Future Directions. Appl. Sci. 2021,11, 11246. [CrossRef] 3. Khalid, S.; Khalil, T.; Nasreen, S. A survey of feature selection and feature extraction techniques in machine learning. In Proceedings of the Science and Information Conference (SAI), London, UK, 27–29 August 2014; pp. 372–378. 4. Porkodi, R. Comparison of filter based feature selection algorithms: An overview. Int. J. Innov. Res. Technol. Sci. 2014 ,2, 108–113. 5. Jovi´c, A.; Brki´c, K.; Bogunovi´c, N. A review of feature selection methods with applications. In Proceedings of the 2015 38th International Convention on Information and Communication Technology, Electronics and Microelectronics (MIPRO), Opatija, Croatia, 25–29 May 2015; pp. 1200–1205. 6. Brezoˇcnik, L.; Fister, I.; Podgorelec, V. Swarm Intelligence Algorithms for Feature Selection: A Review. Appl. Sci. 2018 ,8, 1521. [CrossRef] 7. Askari, Q.; Saeed, M.; Younas, I. Heap-based optimizer inspired by corporate rank hierarchy for global optimization. Expert Syst. Appl. 2020,161, 113702. [CrossRef] 8. Rahman, A.; Sokkalingam, R.; Othman, M.; Biswas, K.; Abdullah, L.; Kadir, E.A. Nature-Inspired Metaheuristic Techniques for Combinatorial Optimization Problems: Overview and Recent Advances. Mathematics 2021,9, 2633. [CrossRef] 9. Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey wolf optimizer. Adv. Eng. Softw. 2014,69, 46–61. [CrossRef] 10. Mirjalili, S.; Lewis, A. The whale optimization algorithm. Adv. Eng. Softw. 2016,95, 51–67. [CrossRef] 11. Passino, K.M. Bacterial foraging optimization. Int. J. Swarm Intell. Res. (IJSIR) 2010,1, 1–16. [CrossRef] 12. Whitley, D. A genetic algorithm tutorial. Stat. Comput. 1994,4, 65–85. [CrossRef] 13. Storn, R. On the usage of differential evolution for function optimization. In Proceedings of the North American Fuzzy Information Processing, Berkeley, CA, USA, 19–22 June 1996; pp. 519–523. 14. Simon, D. Biogeography-based optimization. IEEE Trans. Evol. Comput. 2008,12, 702–713. [CrossRef] 15. Askari, Q.; Younas, I.; Saeed, M. Political Optimizer: A novel socio-inspired meta-heuristic for global optimization. Knowl.-Based Syst. 2020,195, 105709. [CrossRef] 16. Fadakar, E.; Ebrahimi, M. A new metaheuristic football game inspired algorithm. In Proceedings of the 2016 1st Conference on Swarm Intelligence and Evolutionary Computation (CSIEC), Bam, Iran, 9–11 March 2016; pp. 6–11. 17. Rashedi, E.; Nezamabadi-Pour, H.; Saryazdi, S. GSA: A Gravitational Search Algorithm. Inf. Sci. 2009 ,179, 2232–2248. [CrossRef] 18. Hatamlou, A. Black hole: A new heuristic optimization approach for data clustering. Inf. Sci. 2013,222, 175–184. [CrossRef] 19. Zerigat, D.H.; Benasla, L.; Belmadani, A.; Rahli, M. Galaxy-based search algorithm to solve combined economic and emission dispatch. UPB Sci. Bull. Ser. C Electr. Eng. 2014,76, 209–220. 20. Abualigah, L.M.; Khader, A.T.; Hanandeh, E.S. A new feature selection method to improve the document clustering using particle swarm optimization algorithm. J. Comput. Sci. 2018,25, 456–466. [CrossRef] 21. Zakeri, A.; Hokmabadi, A. Efficient feature selection method using real-valued grasshopper optimization algorithm. Expert Syst. Appl. 2019,119, 61–72. [CrossRef] 22. Mafarja, M.M.; Mirjalili, S. Hybrid Whale Optimization Algorithm with simulated annealing for feature selection. Neurocomputing 2017,260, 302–312. [CrossRef] 23. Vijayanand, R.; Devaraj, D. A Novel Feature Selection Method Using Whale Optimization Algorithm and Genetic Operators for Intrusion Detection System in Wireless Mesh Network. IEEE Access 2020,8, 56847–56854. [CrossRef] 24. Kelidari, M.; Hamidzadeh, J. Feature selection by using chaotic cuckoo optimization algorithm with levy flight, opposition-based learning and disruption operator. Soft Comput. 2021,25, 2911–2933. [CrossRef] 25. Zawbaa, H.M.; Emary, E.; Parv, B.; Sharawi, M. Feature selection approach based on moth-flame optimization algorithm. In Proceedings of the 2016 IEEE Congress on Evolutionary Computation (CEC), Vancouver, BC, Canada, 24–29 July 2016; pp. 4612–4617. 26. Selvakumar, B.; Muneeswaran, K. Firefly algorithm based feature selection for network intrusion detection. Comput. Secur. 2019 , 81, 148–155. 27. Abdel-Basset, M.; Ding, W.; El-Shahat, D. A hybrid Harris Hawks optimization algorithm with simulated annealing for feature selection. Artif. Intell. Rev. 2021,54, 593–637. [CrossRef] 28. Wolpert, D.H.; Macready, W.G. No free lunch theorems for optimization. IEEE Trans. Evol. Comput. 1997,1, 67–82. [CrossRef] Appl. Sci. 2023,13, 906 19 of 19 29. Too, J.; Liang, G.; Chen, H. Memory-based Harris hawk optimization with learning agents: A feature selection approach. Eng. Comput. 2021,38, 4457–4478. [CrossRef] 30. Bertsimas, D.; Tsitsiklis, J. Simulated annealing. Stat. Sci. 1993,8, 10–15. [CrossRef] 31. Mirjalili, S. SCA: A Sine Cosine Algorithm for solving optimization problems. Knowl.-Based Syst. 2016,96, 120–133. [CrossRef] 32. Zhao, W.; Wang, L.; Zhang, Z. Atom search optimization and its application to solve a hydrogeologic parameter estimation problem. Knowl.-Based Syst. 2019,163, 283–304. [CrossRef] 33. Hashim, F.A.; Houssein, E.H.; Mabrouk, M.S.; Al-Atabany, W.; Mirjalili, S. Henry gas solubility optimization: A novel physicsbased algorithm. Future Gener. Comput. Syst. 2019,101, 646–667. [CrossRef] 34. Faramarzi, A.; Heidarinejad, M.; Stephens, B.; Mirjalili, S. Equilibrium optimizer: A novel optimization algorithm. Knowl.-Based Syst. 2020,191, 105190. [CrossRef] 35. Conrads, T.P.; Fusaro, V.A.; Ross, S.; Johann, D.; Rajapakse, V.; Hitt, B.A.; Steinberg, S.M.; Kohn, E.C.; Fishman, D.A.; Whitely, G.; et al. High-resolution serum proteomic features for ovarian cancer detection. Endocr.-Relat. Cancer 2004 ,11, 163–178. [CrossRef] [PubMed] 36. Street, W.N.; Wolberg, W.H.; Mangasarian, O.L. Nuclear feature extraction for breast tumor diagnosis. In Proceedings of the IS&T/SPIE 1993 International Symposium on Electronic Imaging: Science and Technology, San Jose, CA, USA, 31 January–5 February 1993; Volume 1905, pp. 861–870. 37. Elminaam, D.S.A.; Nabil, A.; Ibraheem, S.A.; Houssein, E.H. An Efficient Marine Predators Algorithm for Feature Selection. IEEE Access 2021,9, 60136–60153. [CrossRef] 38. Ibrahim, S.; Nazir, S.; Velastin, S.A. Feature Selection Using Correlation Analysis and Principal Component Analysis for Accurate Breast Cancer Diagnosis. J. Imaging 2021,7, 225. [CrossRef] [PubMed] Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.