# Machine Learning Models to Predict Google Stock Prices
## 5 Concluding Remarks  
Our aim was to predict Alphabet's stock price, taking into consideration the possible explanatory factors. To achieve this goal, we built three different datasets, considering \begin{table}
\begin{tabular}{c c c c} \hline \hline  & \multicolumn{3}{c}{**ANN**} \\ \hline  & **Dataset1** & **Dataset2** & **Dataset3** \\ \hline RGA & 0.9948 & 0.9754 & 0.9760 \\ RGE Tot & 0.0015 & 0.351 & 0.0966 \\ RGR All & 1 & 1 & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Safe AI metrics for the Ridge regression model. \begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline  & \multicolumn{6}{c}{**ANN**} \\ \hline  & \multicolumn{3}{c}{**Dataset1**} & \multicolumn{3}{c}{**Dataset2**} & \multicolumn{3}{c}{**Dataset3**} \\ \hline RGA & 0.9933 & 0.9753 & 0.9830 \\ RGE Tot & 0.0042 & 0.6297 & 0.3338 \\ RGR All & 0.0038 & 0.3263 & 0.1338 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Safe AI metrics in Table 8 denote generally good accuracy but a big difference with respect to explainability. The second dataset is the most explainable, in line with the result from the LSTM model. The main issue concerning this model is the overall robustness when perturbing data with small values of RGR. \begin{table}
\begin{tabular}{c c c c c c c c c c c} \hline \hline  & \multicolumn{6}{c}{**Ridge**} \\ \hline  & \multicolumn{3}{c}{**Train**} & \multicolumn{6}{c}{**Test**} \\ \cline{2-11}  & **MSE** & **RMSE** & **MAE** & **MAPE** & **R2** & **MSE** & **RMSE** & **MAE** & **MAPE** & **R2** \\ \hline Dataset1 & 2.2978 & 1.5158 & 0.9610 & 1.50\% & 0.9980 & 9.6751 & 3.1100 & 2.4100 & 2.05\% & 0.9800 \\ Dataset2 & 43.845 & 6.6126 & 5.1162 & 8.67\% & 0.9622 & 65.7159 & 8.1065 & 6.4220 & 5.24\% & 0.8697 \\ Dataset3 & 32.772 & 5.7246 & 4.7163 & 8.85\% & 0.9718 & 88.0646 & 9.3842 & 7.5181 & 6.07\% & 0.8253 \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Accuracy of Ridge regression model. autoregressive financial market data (dataset1), economic context data (dataset2) and company financial report data (dataset3). We then compared four machine learning models for the three considered datasets. The models were compared not only in terms of predictive accuracy, but also in terms of robustness and explainability, in line with the recently proposed S.A.F.E. AI approach. Our findings underscore the importance of careful model selection in light of the desired outcomes. If the primary goal is predictive accuracy, all of the models show acceptable RGA values, ranging from 0.9625 to 0.9955. If the focus is instead on robustness, the Ridge regression model seems to be the most suitable choice, together with LSTM. If explainability is prioritized over robustness, XG Boost will be the best choice. The trade-off between all those aspects should guide the choice of the model, depending on the specific application and goals. Alternatively, the value of each metric can be mapped onto a probability, and the three resulting probabilities can be multiplied together. This led, in the case of Dataset2, to a probability of about 0.38 for LSTM, 0.19 for XGboost and 0.33 for Ridge, indicating that the LSTM is the model with the highest probability of being safe, in this case. More generally, taking into account also data comparison, if the focus is mainly in obtaining a high predictive accuracy, a user should consider an LSTM model, possibly using the first dataset. If the focus is mainly on obtaining a model which is easier to explain and understand, a user should consider XGBOOST, possibly using the third dataset. If the focus is on obtaining a model that is robust to data perturbations and outliers, a user should consider Ridge linear regression for one of the three datasets. From a financial management practice, the paper indicates how stock price can be predicted using several independent variables, with their lagged values.