# Development of a Stock Price Prediction Framework for Intelligent Media and Technical Analysis
## 3 The Developed Model
### Results from Fundamental and Technical Analysis Experiments
#### 3.3.2 Technical Analysis: Experiment 2  
The objective of Experiment 2 was to predict Vodacom's closing price using 20 days of Vodacom data, thereby predicting day 21. The experiment introduced two datasets; the first was the univariate (closing price) dataset, and the second was the multivariate (technical indicators) dataset. Five LSTM architectures were presented in the first two experiments, and in the third, the encoder-decoder LSTM was introduced. All LSTM architectures applied the mean square error as their loss function and the Adam optimiser to update the weights during training. To evaluate the performance of the experiments, the mean squared error and root mean squared error were used. Table 4 shows a summary of the results from Experiment 2.1. First, ordinary LSTM is introduced; this model has 2 layers with 200 units and a dense layer with 1 output. The model is trained for 100 epochs with a learning rate of \(1\,e^{-4}\). The prediction results are displayed against the test data in Figure 1.  
Stacked LSTM, which was the best performing model in this section, was comprised of 2 LSTM layers with 200 and 100 units each and a dense layer at the output. The model was trained for 100 epochs with a learning rate of \(1\,e^{-4}\). The prediction results are displayed against the test data in Figure 2. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Models**} & **Ordinary** & **Stacked** & **Bidirect** & **CNN LSTM** & **Conv** \\  & **LSTM** & **LSTM** & **LSTM** & **LSTM** \\ \hline MSE & 48,991.89 & 48,766.52 & 48,946.1 & 53,773.47 & 54,060.72 \\ RMSE & 221.34 & 220.83 & 221.23 & 231.8 & 232.51 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Experiment 2.1 results. Figure 1: Ordinary LSTM Experiment 2.1. \begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{1}{c}{**Models**} & **Accuracy** \\ \hline Support vector machine & 49\% \\ Decision tree & 82\% \\ Random forest & 74\% \\ Linear discriminant analysis & 96\% \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Experiment 1.3 results. The third model was the bidirectional LSTM; this model was made up of three layers. The first layer had 200 units, the second had 100 units, and the last was a dense layer at the output. The model was trained for 100 epochs with a learning rate of 1 \(e^{-4}\). The prediction results are displayed against the test data in Figure 3.  
The convolutional neural network LSTM model has a total of eight layers, as seen in Figure 4. This model was trained for 100 epochs with a learning rate of 2 \(e^{-4}\). The prediction results are displayed against the test data in Figure 5.  
Figure 3: Bidirectional LSTM Experiment 2.1. Figure 2: Stacked LSTM Experiment 2.1. Model: \"sequential_17\"  
Layer (type) Output Shape Param #  
time_distributed_33 (TimeDis (None, None, 10, 32) 96  
time_distributed_34 (TimeDis (None, None, 5, 32) 0  
time_distributed_35 (TimeDis (None, None, 160) 0  
lstm_28 (LSTM) (None, None, 200) 288800  
lstm_29 (LSTM) (None, 100) 120400  
dense_27 (Dense) (None, 30) 3030  
dense_28 (Dense) (None, 10) 310  
dense_29 (Dense) (None, 1) 11  
-------  
Total params: 412,647  
Tranable params: 412,647  
Non-trainable params: 0  
The last hybrid experiment is ConvLSTM, shown in Figure 6 with three layers. The first layer is a ConvLSTM with 64 filters; the second is a flatten layer and the third and final layer is a dense layer at the output. The model is trained for 100 epochs with a learning rate of \(2\)\(e^{-4}\). The second part of Experiment 2 introduces the multivariate dataset applied to the same five LSTM models as Experiment 2.1. With the addition of three technical indicators that generate 16 features to the dataset, there is a significant improvement in this experiment, as seen in Table 5. Experiment 2.2 follows the same process used in Experiment 2.1, and all models have the same architecture, including the same amount of layers, amount of epochs and the same learning rate as used in Experiment 2.1 to train the models. Figure 4: CNNxLSTM.