Clear Sky Science · en

Electricity price forecasting with ensemble meta-models and SHAP explainers: a PCA-driven approach

· Back to index

Why tomorrow’s power price matters to you

Every time you switch on a light or plug in a laptop, you are tied into a vast, fast-moving electricity market where prices can change hour by hour. As more wind and solar farms come online, those prices are becoming less predictable—yet accurate forecasts are vital for keeping bills fair, the grid stable, and climate goals on track. This study presents a new way to predict electricity prices that is not only more accurate than traditional methods, but also explains in plain terms which factors are really driving the ups and downs of the market.

Making sense of a noisy energy world

The researchers focus on Spain’s power system, a good example of a modern grid where renewables, gas plants, and cross-border trade all shape prices. They assemble four years of hourly data on electricity use, power plant output, market prices, and weather in Spain’s five largest cities. Before any forecasting happens, they clean this raw data: filling in missing readings, removing obvious errors, and merging energy and weather records into a single, consistent picture. They also test whether prices and demand follow stable patterns over time, and look for yearly and seasonal cycles that can trip up naïve forecasting tools.

Figure 1
Figure 1.

Blending different forecasting “brains”

Instead of relying on one predictive model, the team builds a small “committee” of modern machine learning tools. Tree-based methods such as XGBoost handle complex cause-and-effect relations between many inputs. Long Short-Term Memory networks and convolutional neural networks—deep-learning techniques originally honed on language and images—are adapted to track both short-lived jumps and slower trends in prices. A hybrid CNN–LSTM model turns out to be particularly good at capturing quick spikes and longer cycles together, while other networks view the data in slightly different ways. The key step is an ensemble stage, where the outputs of all these models are combined, either by a smart weighted average or by a simple linear meta-model that learns how much to trust each “expert.”

Cutting clutter while keeping the signal

Because modern power markets produce hundreds of overlapping indicators, the study uses Principal Component Analysis (PCA) to compress the information into a smaller number of meaningful combinations. This makes training faster and reduces the risk that models latch onto random quirks in the data. At the same time, the authors refuse to smooth away real-world complexity: they keep price spikes and structural breaks, tagging them rather than deleting them, so the system learns how prices behave in turbulent periods as well as in calm ones. Careful tuning and a strict time-based train–test split mimic how the models would perform if they were deployed in an actual control room forecasting one hour ahead.

Figure 2
Figure 2.

Opening the black box of price drivers

To move beyond raw accuracy numbers, the researchers turn to a method called SHAP, which breaks down each prediction into contributions from individual inputs. This allows them to check whether the models’ “reasoning” matches how the Spanish market really works. They find that official day-ahead price forecasts from the grid operator, actual electricity demand, and weather conditions such as temperature, wind, and rain dominate the forecasts. High demand during evening peaks and cold spells pushes prices up, while strong wind and midday solar output tend to drag prices down—exactly what market rules and the merit-order effect would suggest. SHAP is also used at the model level, revealing that the CNN–LSTM hybrid and XGBoost are the most influential voices inside the ensemble.

What the results mean for bills and the grid

When the dust settles, no single model wins outright, but the combined meta-model clearly outperforms all of them, cutting forecast error more than any individual approach and doing so reliably even during volatile periods. Crucially, the explainability layer shows that this accuracy does not come from mysterious correlations, but from patterns that align with real economic and physical behavior in the Spanish grid. For energy companies, system operators, and regulators, that combination of sharper forecasts and transparent reasoning can support better planning, fairer markets, and smoother integration of renewables. For everyday consumers, it is a step toward a power system where the hidden choreography behind your electricity bill is both smarter and easier to understand.

Citation: Hayati, A., Gharehveran, S.S. & Shirini, K. Electricity price forecasting with ensemble meta-models and SHAP explainers: a PCA-driven approach. Sci Rep 16, 6466 (2026). https://doi.org/10.1038/s41598-026-35839-1

Keywords: electricity price forecasting, energy markets, machine learning, renewable energy, explainable AI