## 4 Implementation Details
### Feature Selection  
Feature selection is crucial to the performance of the forecasting algorithm [59]. In the present study, the SI was selected for the unsupervised k-means clustering of the datasets in order to classify the days as either sunny or cloudy day. For the LSTM-RNN, model external parameters (exogenous input parameters) are selected to train it for clustered data. The correlation of the external parameters with the SI was calculated using Pearson's correlation coefficient (PCC). It enables to see the relevancy of the external parameters towards the SI. The PCC ranges from \(-1\) to \(+1\), with a value close to \(+1\) indicating a higher correlation and values approaching \(-1\) indicating a negative or inverse relationship. For example, relative humidity has a negative value that shows an inverse relationship with SI. In this case, if relative humidity goes high, SI goes down and vice versa. PCC of external parameters with SI is shown in Figure 5. At the x-axis, the locations are mentioned whereas, the y-axis presents the variables including SI and other external parameters. Each box shows the PCC value for the variable with SI.  
Provided two variables (\(X\),\(S\)), the formula for calculating _PCC_ is given below in Equation (2):  
\[PCC(X,S)= \frac{1}{N-1}\sum_{i=1}^{N}\left(\frac{\overline{X_{i}-\mu_{X}}}{ \sigma_{X}}\right)\left(\frac{G_{i}-\mu_{S}}{\sigma_{S}}\right), \tag{2}\]  
where \(\mu\) and \(\sigma\) are the mean and standard deviation of the variables (\(X\),\(S\)), and \(N\) is the number of observations in each variable.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Location** & **Datasets Division** & **Years** & **Number of Examples** \\ \hline \multirow{3}{*}{Golden} & Training set & 10 & 3650 \\  & Validation set & 1 & 366 \\  & Test set & 1 & 365 \\ \hline \multirow{3}{*}{Jena} & Training set & 6 & 2190 \\  & Validation set & 1 & 365 \\  & Test set & 1 & 365 \\ \hline \multirow{3}{*}{Basel} & Training set & 10 & 3651 \\  & Validation set & 1 & 365 \\ \cline{1-1}  & Test set & 1 & 365 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Dataset distribution.  
Figure 5: The PCC of each variable with the SI for all the dataset locations.  
For the proposed study, an error evaluation approach was used to select the suitable features among the exogenous features, i.e., listed in Section 4.1. This approach is known as the wrapper approach [60]. According to this approach, errors for all the possible variable subsets are evaluated using evaluation metrics such as RMSE, in this study. We evaluated the results for various combinations of the variables (exogenous inputs) and find out the combination that showed the minimum error. The error was evaluated using training and validation sets. The features' selection method indicated that the dry-bulb temperature, the dew point temperature and the relative humidity were the best choices for the analysis.  
For features selection, various other methods are reported that are related to correlation methods. Nevertheless, the wrapper approach is used in this study. Using other correlation methods for feature selection, may not give us good performance because the correlation of a feature can be irrelevant by itself. However, it can provide better performance improvement when combining with other features.  
To further highlight the improved performance, additional categorical features are introduced to this methodology, namely: the hours of the day (1-24) and the months of the year (1-12).