## 4 Data-Driven and Contextual Optimisation Forecasting Algorithm
### Data-Driven Model
\begin{table}
\begin{tabular}{c c} \hline \hline
**Variable Name** & **Description** \\ \hline \multicolumn{3}{c}{**Short- and Long-term Forecast**} \\ \hline \multicolumn{3}{c}{_Initial Input Features_} \\ \hline \multicolumn{3}{c}{\(X_{t=0}\)\(\ldots\)\(X_{t=N}\)} \\ \hline \multicolumn{3}{c}{_Additional Input Features_} \\ \hline E\({}_{t=0}\)\(\ldots\) E\({}_{t=N}\) & Time series of extraterrestrial radiation values from 1 January 1998 to 31 December 2004 \\ \hline \multicolumn{3}{c}{_Additional Input Features_} \\ \hline E\({}_{t=0}\)\(\ldots\) E\({}_{t=N}\) & Time series of extraterrestrial radiation values from 1 January 1998 to 31 December 2004 \\ \hline \end{tabular}
\end{table} 
Table 3: Initial and additional features for FBP short- and long-term forecast. Therefore, additional features must be carefully evaluated and only added if shown to have a positive impact. For the SVM short-term forecast, three inputs were added to the initial features, as shown in Table 2: extraterrestrial radiation for the previous hour of the same day, for the same hour 1 day ago, and for the same hour 2 days prior. For the long-term forecast, the irradiance of the same hour and the same day two years ago, as well as the extraterrestrial radiation were added. The long-term forecast further included the global horizontal irradiance of the same hour and the same day two years ago, as well as the extraterrestrial radiation, as shown in Table 2.  
It is only possible to add features to FBP if the future values for these are known. This is not the case for most additional features, such as extraterrestrial radiation. However, extraterrestrial radiation is approximately the same for every time of the year at a given location, so it can be predicted precisely. Thus, a time series of predicted extraterrestrial radiation was added for FBP as additional regressors, for both short- and long-term predictions, as shown in Table 3.  
Hyperparameters are different from \"normal\" parameters, e.g., the weights \((\omega)\) and biases \((b)\). They are the parameters that cannot be learned by the SVM model but must be chosen. The hyperparameter were tuned after evaluating the results of the basic algorithm operations for the default values in Scikit-learn. Hyperparameters should be selected to give the best results and can be tuned using several different methods. These include grid search [47], random search [48], and bio-inspired techniques, e.g., swarm optimisation [49]. The hyperparameters for this SVM model were tuned by the grid search cross validation (grid-search cross-validation searches for the best combination of the given parameters using cross validation to evaluate each combination of hyperparameters). For this, a grid of possible hyperparameters was provided. Firstly, the radial basis function (RBF), shown in Equation (5), was chosen, as it produces the best results in the literature [50]. This was verified for these solar models. When using an SVM for regression with an RBF kernel, three parameters must be found: \(C\), the regularisation parameter; \(\varepsilon\), the term defining the size of the error tube; \(\gamma\), the width of the RBF kernel. \[RBF=exp\Big{(}-\gamma\|x-x^{\prime}\|^{2}\Big{)} \tag{5}\]  
One drawback of grid search cross validation is its computational cost. Other optimisation techniques should be investigated, as discussed in Section 7. To avoid excessive computations, a log-scale was initially used for all hyperparameters, e.g., 0.1, 1, 10, and 100 for \(C\). Depending on the outcome, the range was adjusted (e.g., 5, 10, and 50). It was found that \(C\) had the greatest influence on the results of this model.