## 3 Methods
### Retail Sales Forecasting  
The optimal features selected from MRMR, RFE, and APSO on the Rossmann dataset and Walmart dataset are given as input to the Bi-GRU model for effective forecasting of retail sales. The Bi-GRU model has update and reset gates for performing sales forecasting, which also decreases the gradient dispersion and computational loss, while enabling the capability for shorter- and longer-term memory [36, 37]. Also, Bi-GRU comprises a smaller number of constraints because it does not have a forget gate, which makes it computationally efficient, less prone to overfitting, a suitable option for a smaller-type dataset. In the Bi-GRU model, the input and the forget gates of the LSTM network are replaced by the update gate, \(d_{TS}\). The update gate helps the model in determining the past information, which needs to be passed along with the future information. This process reduces the vanishing-gradient problem in the Bi-GRU model. The update gate, \(d_{TS}\), is mathematically specified in Equation (10). \[d_{TS}=\sigma(W_{d}\times[h_{TS-1},f_{TS}]+b_{d}) \tag{10}\]  
where the weight matrix is represented as \(W_{d}\); the bias matrix is denoted as \(b_{d}\); the input matrix (selected features) at the time step, \(TS\), is indicated as \(f_{TS}\); the sigmoid activation function is denoted as \(\sigma\); and the hidden state at the previous time step, \(TS-1\), is indicated as \(h_{TS-1}\). In the Bi-GRU model, the reset gate, \(p_{TS}\), is utilized for controlling the historical time-series data and is responsible for the network's shorter-term memory in the hidden state. The reset gate, \(p_{TS}\), is numerically expressed in Equation (11). \[p_{TS}=\sigma\big{(}W_{p}\times[h_{TS-1},f_{TS}]+b_{p}\big{)} \tag{11}\]  
where the bias matrix and the weight matrix of the reset gate (\(p_{TS}\)) are denoted as \(b_{p}\) and \(W_{p}\). Then, the candidate of the hidden state, \(\overset{\sim}{h}_{TS}\), is specified in Equation (12). \[\overset{\sim}{h}_{TS}=tanh(W_{h}\times[h_{TS-1}\odot p_{TS},f_{TS}]+b_{h}) \tag{12}\]  
where the tangent activation function is represented as \(tanh\), the dot multiplication operation is denoted as \(\odot\), and the bias matrix and weight matrix of the memory cell state are correspondingly denoted as \(b_{h}\) and \(W_{h}\). The output, \(h_{TS}\), is obtained by linearly interpolating \(\overset{\sim}{h}_{TS}\) and \(h_{TS-1}\), and this process is indicated in Equation (13). The Bi-GRU model's architecture is mentioned in Figure 3.  
\[h_{TS}=(1-d_{TS})\odot h_{TS-1}+d_{TS}\odot\overset{\sim}{h}_{TS} \tag{13}\]  
Appropriate feature engineering for the Bi-GRU model is needed for retail sales forecasting to extract the implicit vectors and complex variances in the historical sequence data. The traditional Bi-GRU model extracts only feature information in the forward direction, and it automatically rejects the backward historical time-series data. So, an adaptive Bi-GRU model was implemented in this study for precise retail sales forecasting. The pro posed BiGRU has the capability to process several inputs proficiently over the conventional models because of its facility to study the input from both the directions concurrently. The proposed regression model extracts the knowledge between the variables from the forward and backward directions, as mentioned in Figure 3. In the Bi-GRU model, the forward GRU extracts prior information in the historical time-series data, and the backward GRU extracts future information in the historical time-series data. The numerical expression of the Bi-GRU \(O_{TS}\) model is specified in Equation (14). \[O_{TS}=A\left(\overset{\rightarrow}{h}_{TS},\overset{\leftarrow}{h}_{TS}\right) \tag{14}\]  
where the output of the backward and forward directions is represented as \(A\), and it performs operations like multiplication function, average function, summation function, etc. In addition, the hidden states of backward and forward GRUs are denoted as \(\overset{\leftarrow}{h}_{TS}\) and \(\overset{\rightarrow}{h}_{TS}\).