# Research on Quantitative Investment Strategies Based on Deep Learning
## 4 Experimental Simulation
### Parameters Determination  
#### 4.3.1 Parameter Determination for LSTM  
The parameters that need to be determined include the number of hidden units of LSTM, iteration times, timestep, and batch_size. As for the timestep, the meaning of timestep is the amount of data in the previous timestamp that are used to predict the objective in the next timestamp. For example, the timestep in this article is 20, which means that the data in the previous 20 timestamps are used to predict the objective. Since in this article the trading frequency is every 15 min, 20 timestamps equals slightly more than a whole trading day. As for batch_size, the meaning of the timestep is the amount of data that are input into the LSTM cell to train every time. The batch_size value in this article is 60, which is equal to around four trading days. In this article, another combination in which the timestep is 16 and the batch_size is 80 is also discussed to make a comparison.  
As for the number of hidden units of LSTM and iteration times, theoretically, the bigger the values of these two parameters, the better performance of prediction result. However, if the values of these two parameters increase, the time for running the code will also increase a lot. To make a comparison, there are six situations that have been discussed (Take the prediction of first 2850 data for example). Every situation was run eight times to obtain the average results in Table 2:  
Six different situations are denoted by combination_1 (Hidden units: 20, Iteration times: 200, Timestep: 16, Batch size: 80), combination_2 (Hidden units: 20, Iteration times: 1000, Timestep: 16, Batch size: 80), combination_3 (Hidden units: 20, Iteration times: 2000, Timestep: 16, Batch size: 80), combination_4 (Hidden units: 20, Iteration times: 2000, Timestep: 20, Batch size: 60), combination_5 (Hidden units: 60, Iteration times: 2000, Timestep: 16, Batch size: 80), and combination_6 (Hidden units: 100, Iteration times: 2000, Timestep: 20, Batch size: 60).  
Figure 8 gives the results of different situations. It can be seen from Figure 8 that the general performance of combination_4 (Hidden units: 20, Iteration times: 2000, Timestep: 20, Batch size: 60) is best because its deviation is the least and the running time is also acceptable.  
The iteration times are an important parameter that affects the performance. However, when the iteration times increase to 2000 from 1000, although the result becomes more similar to the real price,  
\begin{table}
\begin{tabular}{l l l l l l} \hline \hline
**Hidden Units** & **Iteration Times** & **TimeStep** & **Batch_Size** & **Runningtime** & **Deviation** \\ \hline
20 & 200 & 16 & 80 & 6 min & 0.013833 \\
20 & 1000 & 16 & 80 & 16 min & 0.013703 \\
20 & 2000 & 16 & 80 & 34 min & 0.011918 \\
20 & 2000 & 20 & 60 & 32 min & 0.009551 \\
60 & 2000 & 16 & 80 & 1 h 21 min & 0.016878 \\
100 & 2000 & 20 & 60 & 2 h 27 min & 0.012416 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Results of six different situations.  
Figure 8: Results of different situations.  
the running time is doubled from 16 minutes to 34 minutes. If the iteration is still increased, the time cost will be considerable.  
Besides, the number of hidden units is also a significant parameter that affects the performance. Increasing the number of hidden units may not result in better prediction performance (using combination_3 and combination_5; or using combination_4 and combination_6, for example).  
Therefore, in this article, combination_4 (Hidden units: 20, Iteration times: 2000, Timestep: 20, Batch size: 60) is used as the parameters of LSTM.