# Machine Learning and Deep Learning Models Applied to Photovoltaic Production Forecasting
## 4 Results  
This section discusses the affinity of the use of the different Artificial Intelligence methods developed to forecast photovoltaic production. The characteristics of the photovoltaic system in the building studied and the general information of the generated models are detailed in the previous section. The mean errors obtained by means of the cross-validation technique in each of the splits, i.e., training, validation (dev), and testing, are shown in Table 1.  
Furthermore, even though RF XGBoost models appear to generate accurate results, these are not good. It can be shown from the nRMSE metric that the forecast in validation set, also in the test set, has a large gap with respect to the training set. So, it can be concluded that the convergence of these models is not adequate since there is an overfitting in the results. Consequently, these models cannot be considered as a good model to forecast photovoltaic production. Finally, the other three models, SVR, SNN, and CNN, generate quite good results. These fit in all sets. The CNN model stands out, which, due to the extraction of patterns from convolutions, has a regular and precise results. Thus, it can be said that this model is the best for forecasting photovoltaic production. SVR and SNN are also adjusted, but with the results of the metrics that are shown, it is not possible to conclude which is the best between the two. Solar irradiation is zero by definition at night, so there is no photovoltaic production in this period. Therefore, it can be though that nights are an irrelevant period in the forecast of photovoltaic production. The metrics previously analyzed in Table 1 may have erroneous results since it is possible that the models are forecasting perfectly, or not, the nights. Table 2 shows the results of the models without nighttime consideration to evaluate their accuracy in the relevant periods. As can be verified with Table 2, the considerations previously adopted with Table 1 can be confirmed. The RNN model is not particularly good; RF and XGBoost models are overfitting; CNN is the best model; and SNN, and SVR are good models but not as good as the CNN model. Observing Table 2, it can be concluded that SVR model is better than SNN model due to the consistency in its results. Thus, the SVR model will have better fits in irregular periods. Furthermore, the fact of considering the entire period does not significantly affect the results. All consideration can allow modeling to be more robust to possible data changes due to continuity and experience. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Split** & **Metric** & **RF** & **XGBoost** & **SVR** & **SNN** & **RNN** & **CNN** \\ \hline \multirow{4}{*}{Train} & nMBE & 0.41\% & 0.45\% & 0.81\% & 0.45\% & \(-\)0.07\% & 0.39\% \\  & sd nMBE & 0.02 & 0.02 & 0.04 & 0.04 & 0.06 & 0.04 \\  & nRMSE & 1.88\% & 2.51\% & 4.01\% & 3.99\% & 6.51\% & 3.85\% \\  & sd nRMSE & 0.02 & 0.02 & 0.04 & 0.05 & 0.07 & 0.04 \\  & R\({}^{2}\) & 0.99 & 0.99 & 0.98 & 0.98 & 0.94 & 0.98 \\ \hline \multirow{4}{*}{Dev} & nMBE & 1.44\% & 1.37\% & 0.90\% & 0.50\% & \(-\)0.18\% & 0.40\% \\  & sd nMBE & 0.06 & 0.07 & 0.04 & 0.04 & 0.07 & 0.04 \\  & nRMSE & 6.28\% & 6.73\% & 3.91\% & 3.55\% & 7.03\% & 3.70\% \\  & sd nRMSE & 0.07 & 0.07 & 0.04 & 0.04 & 0.07 & 0.04 \\  & R\({}^{2}\) & 0.94 & 0.93 & 0.97 & 0.97 & 0.94 & 0.97 \\ \hline \multirow{4}{*}{Test} & nMBE & 1.80\% & 1.43\% & 1.81\% & 1.13\% & \(-\)1.24\% & 0.83\% \\  & sd nMBE & 0.05 & 0.06 & 0.03 & 0.03 & 0.07 & 0.03 \\ \cline{1-1}  & nRMSE & 5.67\% & 6.09\% & 3.16\% & 3.54\% & 7.30\% & 3.50\% \\ \cline{1-1}  & sd nRMSE & 0.06 & 0.07 & 0.02 & 0.04 & 0.08 & 0.04 \\ \cline{1-1}  & R\({}^{2}\) & 0.95 & 0.94 & 0.98 & 0.98 & 0.92 & 0.98 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Average error obtained with the cross-validation method in different Artificial Intelligence methods. As determined, SVR, SNN, and CNN are the most appropriate models to forecast photovoltaic production.