Optimized Machine Learning for Solar Energy Generation Forecasting: A Feature Selection and Hyperparameter Optimization Approach
Abstract
Solar energy is among the most promising renewable resources for developing sustainable energy systems; however, the stochastic and weather-sensitive nature of Solar Energy Generation (SEG) poses challenges for forecasting. The current study designs a machine learning framework for SEG forecasting by using feature selection methods in three stages. In the first stage, three feature selection methods, namely Pearson Correlation (PC), Recursive Feature Elimination (RFE), and Random Forest Feature Importance (RFFI), are compared systematically, each method selecting four predictors among ten weather and system variables, while avoiding the use of electrical telemetry variables to prevent data leakage. In the second stage, four regression methods, including Linear Regression, Random Forest (RF), Multilayer Perceptron (MLP), and Optimized Radial Basis Function Support Vector Regression (RBF-SVR), are tested using each feature set, and the results are verified in five independently repeated experiments. The feature selection method has a much bigger impact on accuracy than the regression method: RFFI-selected features allowed attaining a mean R² greater than 0.85 for three regression methods, whereas PC and RFE constrained all models to achieve R² less than 0.60. Among all models for RFFI features, Random Forest proved to have the best accuracy (mean R² = 0.8960 ± 0.0008), with MLP being second (R² = 0.8893 ± 0.0022), followed by the Optimized RBF-SVR model (R² = 0.8568 ± 0.0072); the Optimized RBF-SVR model took an average training time of 21.25 ± 1.12 seconds compared to RF's 35.78 ± 2.42 seconds. This shows the importance of selecting leakage-controlled features systematically in the process of forecasting SEG, and how a small number of 4 features is sufficient for achieving statistical stability.