# Hybrid LSTM Model to Predict the Level of Air Pollution in Montenegro
## 4 Results and Discussion
### CAQI Prediction Model Implementation  
The proposed system aims to create advanced hourly air pollution predictions by implementing a hybrid LSTM model. Hybridization in this paper involves the use of the GA, given the advantageous characteristics of this algorithm. The GA metaheuristic is applied to elevate the LSTM's accuracy and aims to find the best combination of a suitable time step number and the number of LSTM units in each layer. The GA parameter settings are displayed in Table 3. The fitness function is the same as the MSE of the model produced by each individual. To create the next generation, one-point crossover was performed, with a crossover probability of 0.9. The selection of individuals was performed using tournament selection, with a tournament size of 3. Mutation was applied on the offspring with a mutation probability of 0.3. The mutation uniformly modified both genes, and it could either increase or decrease the values within the given ranges. In our GA, individuals distinguished by a chromosome composed of two genes represented as integers were used. The first gene determines the number of hidden layers, while the second gene determines the number of time steps. These values are tailored for the effective implementation of the LSTM hybrid model. The values of the first gene (the first parameter) were randomly taken from the interval 7-15 and the values of the second gene (the second parameter)  
Figure 7: Visual representation of pairwise feature relationships. were randomly taken from the interval 24-40. The range of \((24,40)\) was considered for the selection of the optimal number of time steps, while the range of \((7,15)\) was examined to choose the best number of units. Bearing in mind that the GA was used for the LSTM model parameters' fine-tuning, a GA search was applied to find the most favorable combination of values for the time step and hidden layer size, while other parameters that characterized the GA itself were taken as fixed values and were not subjected to detailed analysis. The best hyperparameter settings for the LSTM model are presented in Table 4. While there are certain guidelines for the setting of hyperparameters, it is necessary to optimize them as their values rely on the quality of the data. The chosen set of hyperparameters affect the ML algorithm's performance, especially the CPU time necessary for training and testing and the memory usage to store model and intermediate results. In the literature [11], it has been demonstrated that taking a relatively small number of time steps is sufficient to obtain good performance of the algorithm. The time step value is related to the number of time steps in the input sequences used to train the LSTM model. The input data to the LSTM model are organized into value sequences, each containing 24 consecutive observations, and the LSTM model processes these sequences to learn patterns and relationships in the data over time. During training, the input data are divided into sets of 24 consecutive observations. The model takes these sequences as input and is trained to predict the next value in the sequence (i.e., the 25 th observation) as an output. In essence, the model learns the relationships between an input string and the individual output value that follows it. The choice of 24 time steps as the lower bound of the interval was made based on the assumption that CAQI values exhibit relatively periodic changes, considering daily human activity. However, larger values were also allowed, considering the tendency shown by numerical results addressing similar issues. By increasing the upper bounds of the intervals, we enabled the model to better learn patterns from the dataset. It was found that the best accuracy and convergence were achieved for 15 hidden units in the LSTM layer and 24 time steps. Preliminary tests showed that [PERSON] demonstrated the best performance among all observed optimizers. The training model was configured with a total of 300 epochs and a batch size of 8.