## 3 Proposed LSTM-GA and Optimized LSTM-GA Approach  
Machine learning and deep learning have dramatically transformed the analysis and prediction of complex data patterns. Inspired by the structure and function of the human brain, these advanced computational techniques are adept at handling vast and intricate datasets. Traditional statistical methods often fall short in this capacity, whereas machine learning and deep learning excel at uncovering hidden patterns and dependencies. LSTM networks, a type of RNN, excel in sequence prediction tasks by effectively managing long-term dependencies through unique gating mechanisms. These gates allow LSTM to retain relevant information and discard irrelevant data, making it superior to traditional RNNs for tasks like language translation and time series forecasting [36]. A Genetic Algorithm optimizes solutions by mimicking natural selection, iterating through selection, crossover, and mutation steps [37]. Over generations, this process refines the population toward an optimal or near-optimal solution. This paper proposes an innovative integration of GA and LSTM networks to develop a robust defense mechanism against GPS spoofing in UAVs. By harnessing the strengths of both algorithms, the proposed system is designed to dynamically adapt to emerging spoofing strategies, ensuring sustained effectiveness in diverse operational environments. The first proposition model involves optimizing the LSTM network using a GA to fine-tune key hyperparameters such as layer sizes and dropout rates, enhancing the model's capacity to handle sequential data effectively. Building upon this foundation, the second proposition model expands the GA's search space, enabling exploration beyond conventional hyperparameter optimization. This expanded search includes different types of activation functions, additional recurrent connections, or various regularization techniques tailored for sequential data processing. By broadening this search space, the GA gains the capability to uncover unique LSTM configurations that may outperform standard architectures in specific tasks. This approach offers a systematic and automated method to experiment with complex model architectures, potentially leading to breakthroughs in the application of LSTM in real-world scenarios. Proper datasets on various UAV parameters were sourced from Mendeley [38], a cloud-based repository specifically designed for researchers to share and access research data. During the implementation, libraries like NumPy, Pandas, and Keras were integrated into the code. Then, the two different algorithms were merged in Google Collaboratory, which is Python-based. Afterwards, the code was executed and generated results that allowed for the comparison between this approach and previous approaches. The methodology process considered in this study is presented in Figure 3.  
LSTM networks are a specialized type of RNN, designed to overcome the limitations of traditional RNNs in handling long-term dependencies in sequence data. LSTM is particularly effective in sequence prediction tasks because it can maintain information across time steps, which is crucial for understanding and predicting time series, language, and speech patterns [39]. What sets LSTM apart are its unique mechanisms called gates, which regulate the flow of information through the network. The forget gate determines which information should be discarded from the cell state. The input gate controls which new information should be added to the cell state. Finally, the output gate decides which information should be used from the cell state at any given time. These gates enable LSTM to retain important information over long periods while discarding irrelevant data, making it highly effective for tasks such as language translation, time series forecasting, and speech recognition. This gating mechanism allows LSTM to outperform standard RNNs in various sequence prediction problems by efficiently managing long-term dependencies in data.