## 2 Proposed Method for Fault Diagnosis in Milling Machines
### Genetic Algorithm  
A GA is a type of evolutionary algorithm used to solve optimization problems by mimicking the process of natural selection. A graphical flow of the steps involved in the GA is provided in Figure 6. In this study, a GA is utilized after the BiLSTM layer to optimize the selection of features that have been extracted from the AE signals. The process begins with the initialization of a population of feature subsets, each represented as a binary chromosome. The GA then iteratively evolves this population through the following steps. (I) Individuals with higher fitness (i.e., better performance in terms of classification accuracy) are selected to form a new generation. (II) Selected individuals are combined to create new offspring by exchanging genetic material, promoting diversity in the population. (III) Random changes are introduced to some individuals to explore new feature subsets and avoid local optima [35].  
Figure 5: BiLSTM network.  
Initialization: GA begins by creating a population of feature sets, each represented as a binary string e.g., [1, 0, 1, 0], where 1 includes a feature, and 0 excludes it.  
Fitness Evaluation: Each feature set's classification accuracy is tested on a simplified model. Higher accuracy indicates a better-performing subset.  
Selection, Crossover, and Mutation: During selection, the best-performing feature sets are chosen as \"parents.\" In the crossover step, parents combine to create new \"offspring\" feature sets. Finally, during mutation, small random changes are introduced, allowing the exploration of new feature combinations.  
To ensure optimal performance and computational efficiency, key GA parameters were carefully selected based on experimental testing and are described as follows. Population size was set to 50, balancing diversity and computational load and allowing for effective exploration of the feature space. Generations were set to 8, providing sufficient opportunity for convergence. Crossover probability was set at 0.5, fostering genetic diversity and broad search space exploration. Mutation probability was set at 0.2, allowing for the exploration of varied feature combinations and helping to prevent local optima. These optimized parameters, as given in Table 1 (population size = 50, generations = 8, crossover probability = 0.5, mutation probability = 0.2), ensure both computational efficiency and classification accuracy, focusing on discriminative feature selection.  
The fitness function used in this GA is designed to evaluate the classification performance of each feature subset, specifically targeting the ability to accurately distinguish  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline Population Size & 50 \\ \hline Generations & 8 \\ \hline Crossover Probability & 0.5 \\ \hline Mutation Probability & 0.2 \\ \hline \hline \end{tabular}
\end{table}
Table 1: GA parameters.  
Figure 6: Flowchart illustrating the GA process by optimizing feature selection.  
among different fault conditions. The goal is to maximize this fitness function, thereby identifying the most relevant features for fault diagnosis in milling machines. Once the GA process converges, the optimized feature subset is fed into the fully connected layer of the proposed model. GA refines the feature set by selecting the most relevant features, enhancing classification accuracy. Discarding irrelevant features reduces training time and enhances accuracy, making the model well-suited for real-time fault diagnosis.