## 3 Proposed Method  
In this section, a hybrid LSTM-RNN model is presented to forecast the day-ahead SI. It uses a classification method along with the LSTM-RNN model to maximize the advantage in terms of achieving better accuracy. After classification, the days are clustered into similar weather types. Therefore, the SI of similar patterns are sorted and the models learn these patterns accordingly for each type of day (sunny day and cloudy day). Classification enables the forecasting models to learn the variability and uncertainty for each day type separately. This helps lower the complexity and difficulty of data fitting, thereby improving the forecasting accuracy. Figure 2 shows the example of sunny and cloudy days, plotted with the corresponding extraterrestrial irradiance. Figure 2: Example of (**a**) a sunny day and (**b**) a cloudy day for Golden, Colorado (USA). The proposed hybrid model for SI forecasting consists of the following five steps and the overall flow of the proposed model is shown in Figure 3.  
**Step 1:** historical data are collected from the weather stations. These data include the SI along with the other weather parameters such as humidity, dew point temperature, etc., that have been previously used as exogenous features in forecasting models. **Step 2:** the clearness index for each day is then defined as the ratio of the SI at the surface of the Earth (\(I\)) to the extraterrestrial irradiation (\(I_{0}\)), as shown in Equation (1): [54]  
\[CI=I/I_{0}. \tag{1}\]  
Thus, the clearness index varies between 0 and 1, where 0 means 100% overcast and 1 indicates clear weather. The values for SI and extraterrestrial irradiation are taken as a daily average to calculate the clearness index. The clearness index can be computed using the SI from weather stations, which is obtained using NWP methods and is available for several days [55]. In this way, we can classify the next day as a cloudy or sunny day. The accuracy might not be high for such NWP methods. However, these can be used to classify the day as a cloudy or sunny day by averaging the predicted SI for a day. **Step 3**: k-means clustering is used to divide the data into sunny and cloudy days based on the clearness index. In addition, the classification based on two parameters is also  
Figure 3: The proposed hybrid approach for SI forecasting. performed to see the effects on accuracy. For this purpose, the percentage of cloud covers with a clearness index is used to classify the day. **Step 4:** the forecasting model is then trained for sunny and cloudy days. For comparison, three models (LSTM, FFNN and SVM) are trained for both days. Each forecasting model is fed with only exogenous features in order to train each model for both types of days. **Step 5**: Finally, the results are tested and validated for each type of day via various performance matrices. As noted in Step 4, although the prime focus of this study is to use the LSTM forecasting model with the clustering approach using exogenous features, the results are compared with those obtained using the other forecasting models (i.e., FFFN and SVM). In addition, the k-means clustering is used with the FFNN and SVM models in order to provide a fair comparison. Each of these models is described and discussed in the following subsections in order to provide a better intuition regarding their mechanisms. _Detailed LSTM-RNN Architecture with k-Means Clustering_  
The primary focus of the present study is to train the LSTM-RNN network using the results of classification. In this approach, SI data were fed into the k-means clustering algorithm. The clearness index was calculated from the extraterrestrial irradiance and surface solar irradiance via Equation (1). The days were accordingly classified as sunny or cloudy. The results were then used to train the LSTM-RNN network for each day type from the associated data. The detailed architecture of the proposed approach is shown in Figure 4.  
Figure 4: The LSTM-RNN architecture with k-means clustering.