# Enhancing Air Quality Prediction with an Adaptive PSO-Optimized CNN-Bi-LSTM Model
## 3 Model Introduction
### Bi-LSTM  
In addressing the limitations inherent in traditional LSTM cells--particularly their unidirectional flow of information, which confines their context understanding to past events without tapping into future context--[PERSON] and [PERSON] (2018) innovated the Bidirectional Recurrent Neural Network (BRNN) paradigm. This pioneering architecture ingeniously integrates a pair of LSTM hidden layers that operate in tandem yet in opposing temporal orientations, collaboratively yielding a more comprehensive output. The essence of the BRNN lies in its ability to break free from the constraint of sequential data processing by simultaneously considering both preceding and succeeding inputs within its predictive framework. By doing so, it capitalizes on the synergy of two complementary views: one scanning the sequence from start to end (forward pass), the other reversing this trajectory (backward pass). This dual perspective integration significantly enriches the model's capacity for contextual understanding and nuanced prediction ([PERSON] et al., 2019; [PERSON] et al., 2020; [PERSON] et al., 2020). Illustrative of this sophisticated design, Figure 6 presents a Bi-directional LSTM (Bi-LSTM) model schematic, visually encapsulating how these counter-propagating LSTM layers converge to enhance feature extraction and sequence analysis. This framework enhances the model's capacity to capture long-range dependencies, significantly improving its performance in tasks that demand deep contextual sensitivity, such as natural language processing, speech recognition, and time-series prediction. By leveraging these capabilities, the model is better equipped to tackle a wide range of complex, real-world challenges, thereby increasing its applicability across various domains.  
In Figure 6, the outputs for the model at time \(t\) from the forward sequence, denoted as \(\overset{\rightarrow}{h}_{t}\), and from the reverse sequence, represented as \(\overset{\rightarrow}{h}_{t}\), are respectively displayed.  
\[\overset{\rightarrow}{h}_{t} =f(w_{1}x_{t}+w_{2}\overset{\rightarrow}{h}_{t-1}+b_{t1})\] \[\overset{\leftarrow}{h}_{t} =f(w_{4}x_{t}+w_{3}\overset{\leftarrow}{h}_{t+1}+b_{t2})\] \[y_{t} =g(\overset{\leftarrow}{w}_{5}\overset{\leftarrow}{h}_{t}+w_{6} \overset{\rightarrow}{h}_{t}+b_{t3})\]  
In the described model, \(w_{1}\sim w_{6}\) represent the weight matrices, while \(g(\cdot)\) denotes a smooth bounded function. Furthermore, \(\overset{\rightarrow}{h}_{t}\) and \(\overset{\leftarrow}{h}_{t}\) correspond to the forward and reverse outputs at time t, respectively. Additionally, \(b_{t1}\sim b_{t3}\) are identified as bias vectors. Finally, \(y_{t}\) constitutes the model's ultimate output at time t.  
Considering Bi-LSTM's aptitude for time-series analysis, this study transformed the past t hours' data from n stations, amounting to m \(\times\) c variables, into a 2-D array shaped as \(72\times 6(72=6\times 3\times 4)\), effectively condensing the information into \(v\times t(v=m\times c\times n)\) dimensions. The fully connected output layers generate the AQI predictions for n stations over the next t' hours.  
Figure 6: Bi-LSTM network structure.