## 3 Methodology
### Build Prediction Methods
#### 3.5.3. A Hybrid Intelligence of LSTM and the Genetic Algorithm (GA)
The chromosomes used in this study are encoded in binary bits that represent the size of the time window and the number of LSTM units; specifically, each chromosome is represented by nine bits, of which five bits are for the window size and four bits for the number of units. Once the population is initialized, the crossover operations are used for pairing, mutation to rearrange the chromosomes, and the roulette selection algorithm to select the parents and find the superior solution. Solutions are evaluated using a predefined fitness function, and the best-performing chromosomes are selected for breeding. The fitness function evaluates how close a given solution is to the optimal solution of the desired problem. This function is a crucial part of the GA, so it has been chosen carefully. In this research, we use RMSE to calculate the fitness of each chromosome, and the subset of architectural factors that produced the smallest RMSE is selected as the optimal solution. If the output of the breeding process satisfies the termination criteria, the derived optimal or near-optimal solution is applied to the predictive model. Otherwise, the selection, crossover,  
Figure 3: Procedure of the GA-LSTM hybrid model for the prediction of the unemployment rate. and mutation processes of the genetic algorithm are repeated. To acquire a superior solution for the problem, genetic parameters such as crossover rate, mutation rate, and population size can affect the outcome. Previous research has suggested setting genetic algorithm parameters to specific values, such as a population of (4, 10, 20), a crossover probability of (0.7, 0.4, 0.6), and a mutation probability of (0.15, 0.1, 0.3) [36; 37; 38]. There is no established consensus on the optimal population size, and crossover and mutation values are generally in the range of 0 to 1. These studies have provided an initial basis for setting up and evaluating various combinations of genetic algorithm values, thus seeking to find the optimal configuration of model parameters that allows for improving the predictive performance of the test data. In this study, we have adopted an approach based on the above findings by setting a population size of 4, a crossover rate of 0.6, and a mutation rate of 0.4 in the experiment. As a stopping condition, the number of generations is assigned to 10. To determine if the LSTM network architecture is suitable for prediction, several experiments were performed, varying the hyperparameters and evaluating the performance of the model. This involved building and training multiple LSTM models with different configurations, evaluating their performance using the RMSE metric, and selecting the best-performing model. This iterative approach allows us to identify the optimal combination of hyperparameters that maximizes the predictive capacity of the model for a specific task. Using this systematic approach, we use an LSTM network with a sequential input layer followed by an LSTM hidden layer and a dense output layer, and GA investigates the optimal number of neurons in each hidden layer. Subsequently, the parameter optimization process in the GA-LSTM model was carried out rigorously to improve the predictive ability of the unemployment prediction task. We started by importing a variety of essential libraries and modules to manipulate data, design the LSTM neural network, and run the genetic algorithm. Furthermore, we imported the unemployment time series data in CSV format and prepared it by dividing it into sequences of specific length to be used as input for the LSTM network. We define a training and evaluation function that creates and trains the LSTM network for each individual of the genetic algorithm, using the RMSE metric to evaluate the training accuracy on a validation set. The structure of the genetic algorithm was defined with the DEAP library, specifying characteristics such as gene size, population, crossover, mutation, and selection operations.