The influence of training datasets on LSTM-based irradiance prediction

In solar photovoltaic power generation, the prediction of solar irradiance is essential for minimizing energy costs and ensuring the provision of high-quality electricity. Deep learning models have recently gained popularity in the field, as numerous scholars have successfully employed them to predict solar irradiance. In line with this, this paper proposes three distinct methods for dividing the training dataset. Subsequently, these methods are employed in predicting solar irradiance using the LSTM-based model. Furthermore, an error analysis of the prediction results is conducted for each of the three models. The optimal training dataset division method is determined and proposed based on a comparison of the sizes of the three models using six error evaluation indexes.


Introduction
The global economy has experienced rapid development, largely driven by the reliance on fossil fuels like oil and coal.Unfortunately, this has led to severe environmental pollution and contributed to the greenhouse effect [1].Consequently, there has been a growing global interest in the exploration of renewable energy sources as a means to address these issues and protect the environment [2].Solar energy has emerged as one of the most commonly used options, especially in photovoltaics [3].In this context, precise solar irradiance forecasting is vital in minimizing energy expenses and ensuring reliable power supply in electrical grids incorporating distributed solar photovoltaic systems [4].
Statistical models are commonly utilized in solar irradiance forecasting, relying on historical data, and are typically applicable to predicting timeframes ranging from 5 minutes to 6 hours [5].The CARDS model has proven accurate in capturing linear relationships between historical data and future irradiance values over several decades [6].This paper presents an innovative methodology called the Combined Long-Term Memory Network (CLSTMN), which integrates multiple influential meteorological parameters as input variables [7].The study demonstrates that the CLSTMN, employing LSTM, surpasses numerous alternatives by a significant margin, with an average prediction skill 52.2% higher than that of persistent models [8].Furthermore, this paper proposes the CEEMDAN-CNN-LSTM model, which accurately predicts solar irradiance and outperforms many alternative approaches [9].Notably, these studies explore combinations of different neural network models but need to consider the impact of training data division on these models.
In this paper, we present three methods for partitioning the training dataset.These methods are then applied to LSTM-based models for predicting irradiance.Our goal is to evaluate the impact of these partitioning methods on the prediction accuracy of the models and to identify the advantages and disadvantages of each model using various error metrics.Based on our findings, we propose the optimal dataset partitioning method.The paper is structured as follows: Section 2 describes the three training dataset partitioning methods.In Section 3, a comparison is made regarding the prediction accuracy of the various models, while Section 4 serves to present our conclusions.

Proposed method
This section aims to present three LSTM-based models for irradiance prediction, focusing specifically on the methodology employed for dataset partitioning.The dataset is partitioned differently for each model, allowing for a comparative analysis of their predictive capabilities.
We employed six error metrics as assessment criteria to evaluate the forecasting precision of these three models.These metrics provide a quantitative measure of the accuracy and reliability of the models' predictions.By employing multiple metrics, we can obtain a comprehensive understanding of the performance of each model, capturing different aspects of prediction quality such as mean squared error, mean absolute error, root mean square error, and others.Assessing the models with these diverse error metrics ensures a robust and thorough evaluation, providing valuable insights into their comparative performance regarding accuracy and precision.

Irradiance prediction model
The irradiance prediction model presented in this research uses Long Short-Term Memory (LSTM) architecture.By leveraging the strengths of LSTM, we have developed a robust and efficient model for predicting irradiance levels.To explore the impact of dataset partitioning, we formulated different models by varying the methodology employed to partition the dataset.This variation in dataset partitioning allowed us to investigate the influence of different subsets of data on the predictive performance of the models.
To visualize the underlying principles of these different models, we have provided a schematic illustration in Figure 1.This schematic diagram clearly depicts how the various models are structured and highlights the key components of the prediction process.This diagram is a useful reference for understanding the differences in the models' configurations and their respective approaches to irradiance prediction....  2. Equations ( 2)-( 7) are governing equations [10].
The structure of the LSTM.
Once the input information is received, it undergoes processing by the forget gate, which employs a sigmoid function to compute the output value.This sigmoid-based computation allows the forget gate to assign weights to different aspects of the information, determining their relevance and potential for retention.By applying the sigmoid function, the forget gate generates an output value between 0 and 1, where 0 represents complete forgetfulness, and 1 signifies complete preservation of the information.This output value is crucial for the subsequent steps in the memory updating process, enabling the proper management of information within the system.

( [ , ]
) The update gate and input gate play crucial roles in the information processing and storage within the cell.These gates are responsible for managing the writing of information into the cell.The update gate controls the flow of new candidate information into the cell.It generates a value close to zero, effectively hindering the input of fresh information and facilitating the preservation of existing stored information within the cell.By selectively blocking the update process, the input gate enables the cell to retain valuable information for prolonged durations, enhancing long-term memory capacity and stability.This mechanism ensures that crucial and relevant information remains intact within the cell, promoting its overall effectiveness in storing and processing information.
(3) The cell memory undergoes a continuous updating process that involves the interaction of its previous cell memory with both the forget gate and write gate.This recursive process ensures that the cell memory stays updated with relevant information by selectively retaining or discarding specific information.The forget gate determines which aspects of the previous cell memory should be forgotten, while the write gate decides which new information should be stored in the memory.Together, these interactions ensure the proper maintenance and adjustment of the cell memory, enhancing the overall performance of the system.
To determine the current output of the LSTM, the new cell memory is seamlessly integrated with the output gate.This integration process involves leveraging the capabilities of both the output gate and the new cell memory to generate the final output.The output gate is pivotal in deciding which states within the current cell are utilized as outputs.It employs a sigmoid activation function to evaluate and weigh the relevance and significance of each state.By applying this activation function, the output gate determines the contribution of each state to the final output, effectively controlling the flow and utilization of information.
On the other hand, the new cell memory employs a hyperbolic tangent (tanh) function to map the output values.This function ensures that the output values fall within a specified range, typically between -1 and 1.By utilizing the hyperbolic tangent function, the new cell memory ensures that the output values maintain the required properties and characteristics, allowing for accurate and reliable information processing.By combining the capabilities of the output gate and the new cell memory, the LSTM model effectively determines the current output, resulting in a comprehensive and accurate representation of the processed information.

Error assessment indicators
This section introduces six distinct error indicators, which provide various metrics for evaluating the accuracy of predictions from various models across multiple dimensions.The Mean Absolute Error (MAE) measures the extent of deviation between predicted values and actual values.Root Mean Square Error (RMSE) quantifies the degree of deviation from the actual values and reflects the errors' dispersion.R represents the correlation between the two variables, while R 2 represents the level of dependence of the dependent variable on the independent variable.The formulas for these error indicators are displayed below. where x , x , y , y , and max x denote the actual value, the mean of actual values, the predicted value, the mean of predicted values and the maximum of actual value, respectively.

Results and discussion
In this section, we will analyze the relationship between the actual and predicted values obtained from the three models.This analysis aims to provide insights into the performance and accuracy of each model in predicting the target variables.We will carefully examine the level of agreement and divergence between the actual and predicted values, allowing us to assess the effectiveness of the models.Furthermore, we will also evaluate the advantages and disadvantages of these three models from various perspectives.This comprehensive evaluation will encompass computational efficiency, scalability, complexity, interpretability, and robustness.By considering these different perspectives, we can gain a holistic understanding of the strengths and limitations associated with each model.This evaluation will enable us to make informed decisions and recommendations regarding the most suitable model for a given application or scenario.
Figure 3 visually showcases the relationship between the actual and predicted values generated by the three models under investigation.Model II exhibits a prominent one-to-one linear distribution, indicating a strong correspondence between the predicted and actual values.Similarly, Model I demonstrates a similar trend of one-to-one linearity, particularly noticeable in low light conditions.However, upon closer inspection of Figure 3c, it becomes apparent that the predicted values generated by Model III display a higher degree of dispersion and need a discernible pattern or consistent rule.Consequently, Model III exhibits the poorest predictive performance among the evaluated models.The correlation between the predicted and actual irradiance values has been discussed previously.In the following discussion, we will explore the relationship between the actual value's error and the predicted value's error, as depicted in the Figure 4. Based on the color shading in the figure, it is evident that both Model I and Model II exhibit positively skewed prediction errors.This indicates that as the true value increases, the predicted value also increases correspondingly.Furthermore, the data points of Model I are more concentrated near the origin compared to those of Model II.Conversely, the distribution of Model III primarily concentrates on the lower region, suggesting that even a slight change in irradiance results in a substantial shift in the predicted value.Overall, the prediction accuracy of Models I and II surpasses that of Model III.To comprehensively compare the advantages and disadvantages of the three models, we plotted the actual values.We predicted the values of each model along with their corresponding relative errors throughout the day.These results are displayed in Figures 5 and 6  Upon studying the figures, a clear observation emerges.Both Model I and Model II effectively capture the fluctuations in irradiance, albeit with a slight delay compared to the actual values.This indicates that these models can accurately capture the underlying patterns and changes in the irradiance.On the other hand, Model III shows a different behavior, as it primarily focuses on predicting the overall trend of irradiance rather than capturing the finer fluctuations.This can be seen in the figures where Model III's predicted values align more with the general direction of the irradiance trend rather than accurately capturing its variations.
When examining the relative errors, it becomes apparent that Model III consistently exhibits larger relative errors than the other two models.This indicates that the predictions made by Model III deviate more from the actual values, resulting in a lower level of accuracy.In contrast, both Model I and Model II demonstrate relatively smaller relative errors, suggesting higher precision in their predictions.This insight further highlights the superior performance of Model I and Model II in accurately predicting the irradiance values compared to Model III.  Figure 7 presents the probability density curves that illustrate the distribution of errors for the different models.Upon examination, it is evident that both Model I and Model II exhibit higher and sharper peaks than Model III.This implies that Model I and Model II generally have smaller prediction errors.In contrast, Model III's curve displays a wider distribution and a relatively flatter peak, indicating a higher variability and larger errors in its predicted values.
Furthermore, when comparing Model I and Model II, it can be observed that Model II's curve is skewed to the right compared to Model I.This skewness suggests that Model II tends to generate a larger proportion of predicted values, especially on the higher end of the error spectrum.This implies that Model II may tend to overestimate certain values, leading to greater errors on the higher end.Radar charts were generated to provide a more intuitive and visually appealing demonstration of the predictive accuracy of the different models.These radar charts effectively illustrate the performance of the models by utilizing six distinct error indicators.The resulting charts, collectively displayed in Figure 8, offer a comprehensive representation of the predictive accuracy of each model.
The radar charts in Figure 8 serve as a powerful visualization tool, allowing for a quick and holistic assessment of the strengths and weaknesses of the models.By plotting the error indicators on different axes, the radar charts provide a comparative analysis of the models across multiple dimensions of accuracy.
Furthermore, to facilitate greater transparency and accessibility, the relevant data used to construct the radar charts can be found in Table 1.This allows for a more detailed examination and evaluation of the models' predictions, aiding in a thorough understanding of their strengths and limitations.
The radar charts in Figure 8 and the corresponding data in Table 1 provide a robust and comprehensive depiction of the predictive accuracy of the various models.They offer a comprehensive evaluation tool that enables in-depth analysis and comparison of the models' performance across multiple error indicators, enhancing the understanding and interpretation of the predictive capabilities of each model.Specifically, Model II exhibits a 13.3% increase in the Mean Absolute Percentage Error (MAPE), indicating a substantial enhancement in the prediction accuracy compared to Model I. Similarly, there is a notable 14.2% increase in the correlation coefficient ®, indicating a strengthened linear relationship between the predicted and actual values.Additionally, Model II shows a 12.7% increase in the coefficient of determination (R2), suggesting a greater proportion of variance in the observed data being explained by the model's predictions.These improvements in error metrics emphasize the enhanced predictive performance of Model II over Model I.
Furthermore, aside from these significant metrics, Model II demonstrates a 3% improvement in other error metrics, solidifying its position as the most accurate predictor among the three models.This comprehensive analysis of error metrics, as depicted in the radar plot, sheds light on the superiority of Model II, showcasing its significant enhancements in prediction accuracy compared to both Model I and Model III.

Conclusions
This paper introduces and explores three distinct methods for partitioning the training dataset, which are then applied to an LSTM-based model for irradiance prediction.The objective is to assess and compare the predictive capabilities of these three models by conducting a comprehensive error analysis of their respective prediction results.Each model employs a different division approach for the training dataset, resulting in varying levels of prediction accuracy.Among these approaches, the training method that utilizes predicted values to update the network state during model training exhibits the lowest prediction accuracy.However, as the number of samples per training increases, this approach shows improved prediction accuracy.Despite this improvement, it is worth noting that this training approach could be more efficient, raising concerns about its practicality.Consequently, it is not recommended to employ this particular dataset division method.Based on our analysis, Model II demonstrates the highest prediction accuracy, as substantiated by numerous error indicators.These indicators offer valuable insights into the accuracy and reliability of the predictions made by Model II.Furthermore, the training dataset division method proposed in this paper can be a valuable reference point for other models engaged in similar prediction tasks.It provides a solid foundation for optimizing the partitioning of training datasets, ultimately enhancing the efficiency and accuracy of predictions in various prediction models.

Figure 1 .
Figure 1.Schematic diagrams of different model principles.

Figure 3 .
Figure 3.The three plots represent the correlation between actual and predicted values for Models I, II, and III, respectively; the three plots share the color bar on the right.

Figure 4 .
Figure 4. Three plots represent the correlation between the error of actual values and predicted values for Models I, II, and III, respectively; the three plots share the color bar on the right. .

Figure 5 .
Figure 5.The trend of changes in actual values and predicted values from different models over time.

Figure 6 .
Figure 6.Trends in errors between actual and predicted values for different models over time.
probability density curves provide valuable insights into the magnitude and distribution of errors for each model, with Model I and Model II exhibiting smaller errors and Model II showing a slightly different skewness in their predictions compared to Model I.

Figure 7 .
Figure 7. Probability density curves of the error of different models concerning the actual value.

Figure 8 .
Figure 8. Radar charts with different error indicators for different models.The radar plot is a clear visual representation highlighting the significant disparity in prediction

Table 1 .
Different error indicators for different models.