## 4 Data-Driven and Contextual Optimisation Forecasting Algorithm
### Data-Driven Model  
In the data-driven part, two promising ML algorithms (SVM and FBP) were utilised to generate the predictions. It was implemented in Python [44] using Scikit-learn [45] and Prophet Libraries [30]. Initially, a comparative study of the SVM and FBP algorithms was conducted to assess their accuracy. Subsequently, the effects of adding extraterrestrial radiation as an input feature to the model were investigated. For the SVM short-term prediction, three variables were used as initial features, all past values of the global horizontal irradiance. These are the radiation of the same day 1 h  
Figure 3: Block diagram of DCF, showing its two main parts: data-driven model and contextual optimisation. ago, the same hour 1 day ago, and the same hour 2 days ago, as shown in Table 2. [PERSON] and [PERSON] found that the same hour of previous days has a stronger correlation with the target variable than radiation data from 1h ago [28]. For the long-term prediction of the SVM model, radiation values of the same hour and same day one year ago were used as its initial feature (see Table 2), as these have a strong correlation [38]. For the Facebook Prophet short-term prediction, the same variable as for SVM was used, the global horizontal irradiance. However, as FBP has a different algorithm structure, the feature is the time series of solar radiation up to the values that are predicted. There is no differentiation of global horizontal radiation (1H-, 1D-, 2D radiation) as for the SVM model. For example, all values from 00:00 on 1 January 1998 up to 08:00 on 24 June 2005 were used to predict 09:00 + 10:00 + 11:00 on 24 June 2005. Similarly, for the long-term prediction, the entire past time series up to the predicted year was used. The past time series should contain at least one year of data so that seasonalities can be captured. Both the long- and short-term prediction features are shown in Table 3. These will only differ in their predicted output values (3 h or 1 year). After choosing the initial features for the data-driven model, further features were added and their effectiveness evaluated. Adding features to a model can improve its performance [28]. However, there is no inherent benefit to increasing the model complexity. Additional features can also lead to worse results or have no impact on performance [46]. \begin{table}
\begin{tabular}{c c} \hline \hline
**Variable Name** & **Description** \\ \hline \multicolumn{3}{c}{**Short-term Forecast**} \\ \hline \multicolumn{3}{c}{_Initial Input Features_} \\ \hline
1H Radiation & Radiation values for the same day 1 h ago \\
1D Radiation & Radiation values for the same hour 1 day ago \\
2D Radiation & Radiation values for the same hour 2 days ago \\ \hline \multicolumn{3}{c}{_Additional Input Features_} \\ \hline
1H Extraterr & Extraterrestrial values for the same day 1 h ago \\
1D Extraterr & Extraterrestrial values for the same hour 1 day ago \\
2D Extraterr & Extraterrestrial values for the same hour 2 days ago \\ \hline \multicolumn{3}{c}{**Long-term Forecast**} \\ \hline \multicolumn{3}{c}{_Initial Input Features_} \\ \hline
1Y Radiation & Radiation from the same hour and day a year ago \\ \hline \multicolumn{3}{c}{_Additional Input Features_} \\ \hline
2Y Radiation & Radiation at the same hour and day two years ago \\
1Y Extraterr & Extraterrestrial radiation of same hour and day a year ago \\
2Y Extraterr & Extraterrestrial radiation of same hour and day two years ago \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Initial and additional features for SVM short- and long-term forecast.