## 3 Materials and Methods
### Methods
#### 3.3.1 LSTM Model  
The LSTM model is a special recurrent neural network that solves the gradient disappearance and gradient explosion problems of RNN. It can effectively work out nonlinear variable time series predictions [16]. The core of LSTM is its gating logic. Compared with RNN, LSTM adds an additional neuron called \"memory cell\" and three gating structures that can control memory cells, input gate, forget gate, and output gate, so LSTM can better handle longer time sequences. The architecture of the model is shown in Figure 1.  
LSTM processes the garlic price sequence by first determining what kinds of garlic price information are to be retained at the previous moment through a forgetting gate, then determines the garlic price information to be updated and retained in the memory cell through an input gate, and finally determines the predicted garlic price through an output gate. At moment \(t\), there are three inputs to the LSTM. They are \(x_{t}\), \(h_{t-1}\), and \(C_{t-1}\), where \(x_{t}\) denotes the garlic price value of the network input at the current moment, \(h_{t-1}\) denotes the garlic price value of the previous LSTM cell's output, and \(C_{t-1}\) denotes the previous LSTM cell state. At moment \(t\), there are two outputs of the LSTM cell. They are \(h_{t}\) and \(C_{t}\). \(h_{t}\) denotes the output price value of the LSTM cell at the current moment, and \(C_{t}\) is the state of the cell at the current moment. Next, the operation mechanism of LSTM model in garlic price prediction is described in detail. Forgetting gate. It maps the read \(x_{t}\) and \(h_{t-1}\) vectors to the (0,1) interval by the sigmoid function and obtains the state calculation \(f_{t}\) of the forgetting gate. \(f_{t}\) indicates the weight of allowing the corresponding information to pass. For example, 0 means the message cannot \begin{table}
\begin{tabular}{c l} \hline \hline
**Symbol** & **Description** \\ \hline \(x_{t}\) & the garlic price value of the network input at \(t\). \\ \(h_{t}\) & the output price value of the LSTM cell at \(t\) \\ \(C_{t}\) & the LSTM cell state at \(t\) \\ \(\hat{C}_{t}\) & the extracted information to be recorded at \(t\) \\ \(f_{t}\) & the weight of allowing the corresponding information to pass at \(t\) \\ \(o_{t}\) & the output of the cell state obtained by the sigmoid function at \(t\) \\ \(i_{t}\) & the weight of allowing the corresponding information to pass at \(t\) \\ \(r_{t}\) & the hidden state and the weight of information to pass at \(t\) \\ \(z_{t}\) & the weight of allowing the corresponding information to pass at \(t\) \\ \(H_{t}\) & the GRU cell state at \(t\) \\ \(\hat{H}_{t}\) & the value of the candidate state \\ \(W_{(f,i,c,r,z)}\) & the weight matrices \\ \(b_{(f,z,r,z)}\) & the bias terms \\ \(\mu_{t}\) & the random disturbance term at \(t\) \\ \(e_{t}\) & the unpredictable error term at \(t\) \\ \(\sigma_{t}^{2}\) & the conditional variance terms at \(t\) \\ \(\alpha_{i}\) & the GARCH coefficient \\ \(\beta_{i}\) & the ARCH coefficient \\ \(\gamma\) & the leverage coefficient \\ \(\delta\) & the power parameter of the estimated standard deviation \\ \hline \hline \end{tabular}
\end{table} 
Table 2: List of symbols and descriptions. pass and 1 means that all information can pass. This determines the degree of forgetting of the previous state. The specific formula is  
\[f_{t}=\sigma(W_{f}\times[h_{t-1},x_{t}]+b_{f}) \tag{1}\]  
where \(W_{f}\) is the weight matrix of the forgetting gate and \(b_{f}\) is the bias term of the forgetting gate. Input gate. It first determines the garlic price information to be retained by the sigmoid function. Then, the input content is normalized to the interval (\(-1\),1) by the tanh activation function, generating a new vector \(\tilde{C_{t}}\) and adding it to the cell state. Finally, the old cell state \(C_{t-1}\) is multiplied bit by bit with an element of the forgetting gate \(f_{t}\). The new input information is added to update \(C_{t-1}\) to the new cell state \(C_{t}\).