# Time Series Forecasting of Thermal Systems Dispatch in Legal Amazon Using Machine Learning
## 3 Proposed Method
### Benchmarking  
For the proposed method, the LSTM is considered. LSTM networks are a type of recurrent neural network architecture designed to model sequential data while addressing the vanishing or exploding gradient problem in traditional ANNs [77]. Given a sequence of input data, an LSTM unit maintains a hidden state vector \(\mathbf{h}_{i}\) and a cell state vector \(\mathbf{c}_{t}\) at time step \(t\)[25].  
The LSTM unit consists of several gates that control the flow of information [78]. The input gate (\(\mathbf{i}_{t}\)) controls the flow of new information into the cell state, the forget gate (\(\mathbf{f}_{t}\)) controls the flow of old information to be forgotten from the cell state, and the output gate (\(\mathbf{o}_{i}\)) controls the flow of information from the cell state to the hidden state for output [79]. The computations in an LSTM unit are described as follows:  
\[\mathbf{i}_{t} =\sigma(\mathbf{W}_{i}\cdot[\mathbf{h}_{t-1},\mathbf{x}_{t}]+ \mathbf{b}_{i})\] \[\mathbf{f}_{t} =\sigma(\mathbf{W}_{f}\cdot[\mathbf{h}_{t-1},\mathbf{x}_{t}]+ \mathbf{b}_{f})\] \[\mathbf{o}_{t} =\sigma(\mathbf{W}_{o}\cdot[\mathbf{h}_{t-1},\mathbf{x}_{t}]+ \mathbf{b}_{o})\] \[\tilde{\mathbf{c}}_{t} =\tanh(\mathbf{W}_{c}\cdot[\mathbf{h}_{t-1},\mathbf{x}_{t}]+ \mathbf{b}_{c})\] \[\mathbf{c}_{t} =\mathbf{f}_{t}\odot\mathbf{c}_{t-1}+\mathbf{i}_{t}\odot\tilde{ \mathbf{c}}_{t}\] \[\mathbf{h}_{t} =\mathbf{o}_{t}\odot\tanh(\mathbf{c}_{t})\]  
where \(\mathbf{W}\) and \(\mathbf{b}\) are weight matrices and bias vectors specific to each gate, \(\tilde{\mathbf{c}}_{t}\) is the candidate cell state, and \(\sigma\) and \(\tanh\) are the sigmoid and hyperbolic tangent activation functions [80]. The LSTM network was employed for benchmarking using three optimizers as follows: root mean square propagation (RMSProp) [81], adaptive moment estimation (ADAM) [82], and stochastic gradient descent with momentum (SGDM) [83].  
An adaptive neuro-fuzzy inference system (ANFIS) is also evaluated in comparison with the best method found in this work, considering the Sugeno FIS using fuzzy c-means (FCM), subtractive clustering, and grid partition. The ANFIS is a hybrid model that integrates the strengths of both ANNs and fuzzy logic principles, making it particularly effective for time series forecasting [84].  
ANFIS harnesses the learning capabilities of neural networks to optimize the fuzzy inference system's parameters, thereby enhancing the model's ability to handle non-linear and complex patterns inherent in time series data [85]. ANFIS employs a Takagi-Sugeno-type fuzzy inference mechanism, which facilitates the generation of a fuzzy rule base from the input data, enabling a nuanced mapping of inputs to outputs. ANFIS stands out as a robust and versatile tool for time series forecasting, offering significant improvements in predictive performance and reliability [86].  
The evaluation flowchart followed in this paper is presented in Figure 6. The proposed application is based on ensemble learning models that combine weak learners to create a meta-learner. For this, the bagging, boosting, and stacking approaches are used. A statistical analysis was carried out considering 50 experiments with each model to evaluate the variability in the results considering a random initialization of the network. The maximum, minimum, mean, standard deviation, and variance values are presented. The LSTM and ANFIS methods were used for comparative analysis (benchmarking).