Quantifying Uncertainty for Predicting Renewable Energy Time Series Data Using Machine Learning

Recently, there has been growing interest in using machine learning based methods for forecasting renewable energy generation using time-series prediction. Such forecasting is important in order to optimize energy management systems in future micro-grids that will integrate a large amount of solar power generation. However, predicting solar power generation is difficult due to the uncertainty of the solar irradiance and weather phenomena. In this paper, we quantify the impact of uncertainty of machine learning based time-series predictors on the forecast accuracy of renewable energy generation using long-term time series data available from a real micro-grid in Sweden. We use clustering to build different ML forecasting models using LSTM and Facebook Prophet. We evaluate the accuracy impact of using interpolated weather and radiance information on both clustered and non-clustered models. Our evaluations show that clustering decreases the uncertainty by more than 50%. When using actual on-side weather information for the model training and interpolated data for the inference, the improvements in accuracy due to clustering are the highest, which makes our approach an interesting candidate for usage in real micro-grids.


Introduction
Increasing renewable energy usage is imperative for achieving a climate neutral Europe by 2050, which requires the reduction of greenhouse gas emissions by at least 55% by 2030 [1] according to the Climate Target Plan. Furthermore, refs. [2] and [3] show that the energy capacity of photovoltaic increased from 22 GW in 2009 to 707 GW globally in 2020. To achieve the goal of zero emissions, and to effectively integrate photovoltaic energy into the global energy system, an important cornerstone is the deployment of micro-grids that integrate a large amount of solar power generation photovoltaic panels (PV-Systems). To optimize energy exchanges, recent developments in the area of digitalization, such as the Internet of Things (IoT), Machine Learning and Cloud Computing, aim to develop smart-grids, which provide uninterrupted energy to prosumers while aiming to reduce the stress from the main grid [4,5].
Consequently, there has been growing interest in using machine learning based methods for accurately predicting renewable energy generation for PV-Systems, as such predictions are important for optimal energy management strategies. However, predicting solar power generation is difficult due to the inherent uncertainty of the solar irradiance and weather phenomena that are the most influential factors for the PV output power. Reference [6] measured an uncertainty of 9.5% for the radiation during a period of one year and 8.9% for an increasing span of ten years. As weather stations may not be colocated with each PV-System, interpolated weather and radiance information available from close-by stations may be required for making such predictions, further contributing to the uncertainty of the forecast.
In this paper, we aim to evaluate different factors that impact the uncertainty of PV power forecasting. We use a large dataset available from a Swedish PV power grid and cluster the data according to weather information. Using those clusters, we build different forecasting models using LSTM and Facebook Prophet. We compare the forecasting accuracy of clustered versus non clustered models. Because, in reality, exact weather information from co-located weather stations may not be available, we evaluate the impact of using interpolated data for training and inference on prediction accuracy. Our evaluation shows that clustering decreases the uncertainty by more than 50%. When using actual on-side weather information for the model training and interpolated data for the inference, the improvements in accuracy due to clustering are the highest, which makes our approach an interesting candidate for usage in real PV micro-grids.
The rest of this paper is structured as follows: in Section 2, we review related work. Section 3 presents our methodology and approach. In Section 4, we show our evaluation setup and analyse the results. Finally, Section 5 concludes the paper and lists ideas for potential future work.

Related Work
There are several studies regarding the prediction of PV-Station energy outcome based on physical, statistical and machine learning methodologies [7]. Statistical prediction models use historic stationary time-series environmental data, which are not that well applicable to non-stationary weather dependent time-series. References [8,9] proposed the usage of LSTM networks for short-term prediction of PV-Station energy production, while [10,11] improved their machine learning approaches by clustering the dataset into four clusters, each of which represent different weather types and train a specific model for each cluster. The findings indicate that the clustered machine learning models provide more accurate and more stable results for the prediction than a model that was trained with a non-clustered dataset. In our approach, we evaluate how clustered models impact prediction accuracy when using interpolated data for training and/or inference.

Methodology
Weather phenomena, such as radiation, temperature and clouds, have a significant effect on PV power production. In order to predict such production, machine learning based methods can be used that either use only historical power production information or use additional weather features. However, precise weather information from a co-located weather station may not be readily available. Consequently, we aim to evaluate whether interpolated weather information can be feasible for the prediction of PV-Station energy outcome within a smart-grid and, if so, what the additional uncertainty is when using interpolated weather features. Interpolated data can be used in machine learning based time series prediction at two different stages: during the training time and during inference (when making the prediction).
We compare the following combinations for assessing the prediction accuracy: training on actual co-located weather data and using actual weather data for prediction (denoted A to A, e.g., a micro-grid operator predicts its PV power using its own weather station), training on interpolated data and using interpolated data for the prediction (denoted I to I, e.g., a micro-grid does not have a weather station and uses interpolated weather data for both model training and inference), training on actual co-located weather data and using interpolated data for the prediction (denoted A to I, e.g., a micro-grid operator trains the model using information available from its weather station and provides the model to close-by users that use the interpolated data for inference). For predicting the PV output power, we cluster both datasets and use the associated model for prediction (Figure 1) while comparing it with a non-clustered model.

dataset
Our dataset contains five consecutive years of weather and PV-Station information from 1 January 2015 to 31 December 2019 for each six seconds, which we average to create one minute time slots. The data are available from a solar park at the Glava Energy Center in Arvika, Sweden (Altitude 220 m, latitude 59.31°N, longitude 12.37°E). The PV panels are oriented to the south with a 40 degr. inclination. The PV modules are comprised of 20xITS 200WP + 20xITS 210WP + 20xITS 210WP + 19xITS 220WP at a total PV Power of 16.580WP (Watt-Peak) using a 4xEltek Valere 4300W inverter. In addition to the Produced Energy (kW) of the solar panels, the Glava Energy Center has a co-located weather station providing the features presented in Table 1. An open source subset of the used dataset is available (https://github.com/AI-4-Energy/Dataset, last accessed: 29 June 2021). For interpolated weather features, we use information available from Meteostat [12] and SMHI [13], using the weather station at the Karlstad Airport (Altitude 107 m, latitude 59.44°N, longitude 13.34°E) at one minute resolution. This dataset contains the same features as the on-site dataset with the exception of radiation, since only the global radiation is available.

Data Preparation
Both datasets contain several outliers and missing values due to failures in the sensors or systems. For data cleaning, we used the interquartile range (IQR) technique [14], which divides the dataset into quartiles and computes the mean of each segment. Data points that were not within a percentile of the mean were detected as outliers. We also removed data points during the night as they are not as relevant for the prediction [15], because the PV-Systems do not produce energy during this period of the day. Since, especially in Sweden, the night times change throughout the year, the datasets were adapted to consider sunset and sunrise in Sweden, available from [16].
Furthermore, we used the Pearson correlation and the Wrapper selection [17] for feature selection [18]. Our results are inline with [10], which shows that the highest correlations with the energy production of PV-Systems are Wind Speed, Temperature, Humidity, Global Radiation, 30 Degrees Radiation, 40 Degrees Radiation and Indirect Radiation.

Clustering
We applied the density based clustering method DBSCAN [19,20] to define different clusters, which represent different weather characteristics on the co-located and interpolated historical data. We used global radiation (GR) as an input for the DBSCAN clustering and as an indicator of the weather types. DBSCAN clustering requires as input the maximum distance between two points.
To automatically determine the optimal , ref. [21] proposes the usage of the nearestneighbour algorithm to find the distance from each point to its closest neighbour. When applying this technique, we found the optimal value for o of 1.6 for both datasets, which resulted in four different clusters. Table 2 presents the results of the clustering, representing the different weather conditions (sunny, partially overcast, overcast and rainy). As can be seen, most of the data points map to the overcast cluster, while the least of the points map to the rainy cluster.

Machine Learning Models for PV Power Prediction
We used both LSTM [22] and Facebook Prophet [23] to build models to predict the Produced Energy of the PV panels. Figure 2 presents the architecture used for the Bi-Directional LSTM model. The eight input features that comprise the weather and PV Power were sent through four Bi-Directional LSTM Layers, with the Return Sequence set to True. The last layer in the model contains a Dense Layer, which is used to compress the result to a singular output value. To evaluate the right amount of neurons within each layer and other parameters, we used hyper-parameter tuning [18].
In addition to the bi-directional LSTM model, we developed a model based on the Facebook Prophet API. In comparison to the LSTM model, the Facebook Prophet model consists of three different types of model-Trend, Seasonality and Holiday model [18,23]which are combined to form an additive model. As Prophet is designed to only compute univariate inputs, we used the Python library Multi Prophet [24] to overcome this restriction and use multivariate input data. This library is a wrapper around the Facebook Prophet interface to handle multiple models for each input feature which can then be used for the prediction of the output value. Prophet creates a model for each input feature as a regressor for the prediction of the PV-Station energy outcome.

Experimental Evaluation and Results
In our experimental evaluation, we want to answer the following questions: To answer these questions, we clustered the first dataset (1 January 2015 to 31 December 2018) into the four categories and created a training (75%) and testing (25%) dataset to train both approaches. The second dataset (1 January 2019 to 31 December 2019) was used for the evaluation. We trained a model for each weather category on the training dataset. To evaluate the results with a baseline model, we also built a model on the combined dataset for both LSTM and Facebook Prophet. Each of our models were trained on actual weather information (A) and on interpolated information (I). The first step of the prediction included a clustering of the input variables into a matching weather type. Once this had been detected, the corresponding model (e.g., as it was rainy, we used the model trained on rainy data for prediction) was chosen for the prediction.

Prediction Accuracy for On-Site and Interpolated Features
We compared the predicted PV Power with the measured data point and used the normalized Mean Squared Error (MSE) to calculate forecast accuracy. We used both actual on-site (A) and interpolated (I) weather information for the training and prediction. For example, A to A means that the model was trained on actual (A) data and we used actual (A) data for the prediction. The left side of each sub figure in Figure 3 shows violin plots that illustrate the distribution of normalized MSE for the LSTM models when trained on the clustered dataset. The right side (in the red box) shows the normalized error distribution for the baseline LSTM model, trained on the whole dataset, where we evaluated the forecast error separately for each cluster (e.g., we calculated the error distribution over all rainy data points in cluster 0, etc.).
As can be seen from Figure 3a, clustering decreased the normalized MSE for the A to A case. For example, the average normalized MSE decreased from 0.03 to 0.01 in cluster 3 (sunny), which is an improvement of 66%. Furthermore, clustering reduced the standard deviation of the forecast error in general. This can best be observed with cluster 0 (rainy). Without using clustering, the violin graph shows that for some rainy data points the normalized MSE prediction error was as large as 0.26. The forecast accuracy improved when using clustering for rainy days where the maximum observed normalized MSE was around 0.15. When using interpolated data for both training and prediction (I to I, Figure 3b), a similar improvement in accuracy was observed (both mean normalized MSE reduced as well as standard deviation). However, the normalized MSE is higher when using interpolated data for both training and prediction than when using actual data. While this can be observed for each cluster, clusters 1 and 2, especially, have high inaccuracy due to their more uncertain weather. Figure 3c shows the normalized MSE when training on actual data while using interpolated data for predicting PV Power (A to I). The example use-case is that the micro grid operator has a co-located weather station, and trains the model and provides it to another member of the micro grid that does not have a weather station but uses interpolated weather features. Clearly, using actual data for training reduces the error compared to using interpolated data for training. For example, when using clustering for cluster 1, using I to I resulted in the maximum normalized MSE of 0.31, which reduced to 0.18 when using A to I.

Prediction Uncertainty for Facebook Prophet
In this section, we evaluate the uncertainty of PV Power prediction when using Facebook Prophet trained on on-site versus interpolated weather features. Compared with the last section, when using the non-clustered model, we used the whole dataset for the prediction instead of the clustered data for the base-model. This was due to the structure of Prophet, which performs best with consecutive data. Figure 4 shows the normalized MSE distribution characterising the prediction error when using both actual on-site weather information and interpolated information. The error characteristics are similar to when using the bi-directional LSTM model, where we can observe an increasing uncertainty while using interpolated weather information. Furthermore, we can see that Prophet handles interpolated weather information better than LSTM models. For example, the mean of the normalized MSE for the clustering based models is below 0.05 in the Prophet model while it fluctuates just below 0.10 when using the LSTM model for the I to I case. Contrary to the mean MSE, Facebook Prophet shows a bigger deviation in the error than the LSTM model, which results in a bigger uncertainty within the prediction.

Conclusions
In this paper, we evaluate the impact of using interpolated weather information for the prediction of PV Power within smart micro grids, as a co-located weather station may not be readily available. We clustered five years of detailed weather and PV Power information available from a Swedish PV power plant using DBSCAN and evaluate how clustering improves forecast accuracy when using both Facebook Prophet and bi-directional LSTM as predictors. The clustered LSTM model (A to A) performed best of the three scenarios, with an overall normalized MSE of below 0.05 and a small error deviation. The usage of interpolated data increased the error span for both LSTM and Prophet, where mean normalized MSE increased to around 0.10. However, when training on actual data and using interpolated data for inference, the mean normalized MSE dropped, for most cases, to under 0.05, but a significant larger error deviation was determined compared to using on-site data for both training and inference. Consequently, interpolated data are feasible for the prediction of PV-Station energy outcome. Finally, Facebook Prophet outperformed the LSTM model in terms of the average normalized MSE. On the other hand, the LSTM model delivered better results in terms of error standard deviation, which correlates to the uncertainty of the prediction.