Electric Vehicle Charging Load Forecasting via Seg-BO-Transformer

1. Introduction

1.1 Research Background

Since the First Industrial Revolution, the discovery and utilization of fossil energy sources such as coal, petroleum, and natural gas have greatly improved labor productivity and promoted the rapid development of human society, while also causing severe environmental and climate change problems. Global warming is one of the serious challenges brought by fossil energy combustion. Greenhouse gas emissions, primarily carbon dioxide, have continued to rise and have become a global security issue that seriously affects human survival and sustainable development. To mitigate these impacts on human social life, vigorously developing clean energy has become an inevitable trend in the structural transformation of energy systems. In 2023, global investment in clean energy transition reached approximately 1.8 trillion US dollars, with a growth rate of about 17%. Investment in the renewable energy sector was approximately 638 billion US dollars, setting a historical record. The transportation sector, as a fundamental economic industry, accounts for about 12% of total social carbon emissions. Vehicles burning large amounts of fossil fuel during road transport have become a key factor contributing to persistently high carbon emissions in the transportation field. Therefore, reducing the use of traditional fuel-powered vehicles is crucial for lowering the carbon footprint of the transportation sector, and the large-scale adoption of new energy vehicles provides an important pathway to achieve this goal.

To promote energy conservation, emission reduction, and environmental protection, the Chinese government has introduced a series of preferential policies including purchase subsidies for new energy vehicles, relaxed license plate restrictions, and strategic support for new energy vehicle manufacturers. These policies have promoted the rapid development of new energy vehicles. As a substitute for fuel-powered vehicles, new energy vehicles have gained increasing popularity due to their lower purchase prices and reduced usage costs. The number of new energy vehicles in China has increased rapidly. By the end of December 2024, the national new energy vehicle fleet had reached 31.4 million units, accounting for 8.90% of the total vehicle fleet. Among these, battery electric vehicles reached approximately 22.09 million, accounting for 70.34% of the total. To ensure the driving range of new energy vehicles, an effective intercity charging network has been developed. By the end of 2024, China’s total charging infrastructure had reached 12.818 million units, a year-on-year increase of 49%. Although the widespread availability of charging facilities brings many conveniences, it also presents a significant challenge to urban power distribution networks. The severe fluctuations in electric car charging loads can impose unbalanced loading, excessive current and voltage, as well as insufficient supply capacity on the power grid, exacerbating the risk of grid congestion and outages. At the same time, how to define the charging price of charging piles is crucial for both operators and users. For users, the charging price is one of the important factors influencing whether they purchase an electric car. For charging station operators, an appropriate charging price can not only enhance short-term profitability but also lay a solid foundation for long-term development, facilitating the formation of a healthy cycle in the electric car charging market.

Therefore, accurately predicting regional electric car charging loads not only helps to dispatch and optimize the power supply of charging stations, avoiding excessive pressure on the power grid during peak hours, but also provides important guiding significance for charging pricing strategies. Based on real load data from charging stations in a certain region, this paper proposes a Seg-BO-Transformer hybrid model. The model effectively extracts hidden features from time series, reduces the interference of redundant data and invalid information on prediction accuracy, and thus provides more accurate information support for relevant decision-makers.

1.2 Research Significance

Under the dual-carbon policy, sustainable development has become a broad social consensus, and the new energy vehicle industry has received strong government support. The number of electric cars and supporting charging facilities has increased rapidly. Due to the combined effects of social and natural factors, electric car charging behavior presents high randomness and complexity, bringing great challenges to charging load prediction. Therefore, accurately identifying and capturing effective information within charging load time series is the key to accurate prediction. This paper proposes a Seg-BO-Transformer hybrid model that effectively extracts local features and key information from time series, improves the accuracy of electric car charging load prediction, and provides information support for the dispatch and optimization of power systems. Based on real-world data, this paper conducts in-depth analysis of the prediction results of the proposed model, verifying its potential and application value in the field of electric car charging load prediction. The practical significance is summarized as follows:

Grid Dispatch Optimization: By accurately predicting future charging loads, power systems can plan power generation and transmission resources more efficiently, ensuring supply stability and reliability, while reducing power shortages or overpressure during peak charging hours.

Charging Station Layout Design: Urban planners can formulate reasonable layouts of public charging piles according to charging load trends, improving user experience while reducing unnecessary charging facilities.

Dynamic Pricing Mechanism: Based on accurate prediction results, power systems and charging station operators can implement flexible pricing strategies. Reasonable charging prices can improve the utilization efficiency of charging piles and optimize the operating efficiency of regional charging stations.

Safety Maintenance: By analyzing the changing trends of charging load series, relevant personnel can detect potential problems in time and take preventive measures, providing important guarantees for the safe and reliable operation of charging facilities.

1.3 Literature Review

1.3.1 Research Status of Electric Car Charging Load Prediction

Load forecasting can be divided into two broad categories: mid- and long-term load forecasting and short-term load forecasting. Long-term load forecasting not only relies on historical charging load data but, more importantly, considers the growth in electric car ownership. However, the forecasting time span for electric car ownership is too long and may be influenced by various factors, resulting in significant errors in macroscopic forecasting. Therefore, past studies have only accounted for a small portion of mid- and long-term load forecasting. Due to the limitations of mid- and long-term load forecasting, this paper focuses on short-term load forecasting. The research can be roughly divided into three categories: physical models, mathematical statistical models, and machine learning models.

(1) Physical Models

Physical models are abstractions and systematic mappings of the real world, usually involving entity construction and experimental verification. In electric car charging load prediction, physical methods typically base predictions on the battery charging/discharging process, vehicle dynamics models, and various complex physical functions. However, physical models overly rely on prior knowledge, and these pre-set assumptions may not perfectly align with real-world conditions, leading to prediction errors. Meanwhile, the huge computational cost required to process complex data hinders the development of physical models.

(2) Mathematical Statistical Models

Mathematical statistical models seek patterns from data rather than relying on inherent knowledge. Commonly used statistical models include ARIMA, SARIMA, Gray Analysis, Markov Chain, and Monte Carlo Simulations. However, statistical models frequently struggle with the inherent linear patterns of data, failing to capture nonlinear and nonstationary time series features. In the real world, charging loads show complex and volatile characteristics due to numerous internal and external factors, thus limiting the application of these models. With advances in data-driven technology, machine learning models have gradually replaced traditional physical and statistical models and have attracted greater research interest.

(3) Machine Learning Models

Machine learning methods discover potential patterns by analyzing large amounts of actual data and can better learn and process complex time series data. Common models include RF, SVM, BPNN, CNN, RNN, LSTM, etc. Because shallow machine learning models are often disturbed by local optimization and overfitting issues, deep learning models have become a popular solution for handling highly complex time series. Existing research demonstrates that data-driven deep learning models are effective for predicting highly complex and nonlinear time series. Nevertheless, there remain certain limitations. CNN cannot adequately handle the dynamic and nonstationary characteristics of time series due to its insensitivity to changes in input transformation. RNN suffers from gradient vanishing or explosion issues when dealing with longer sequences, preventing effective capture of long-range dependencies. LSTM was developed as an improved variant, yet its parallel processing capability is limited.

1.3.2 Application of Transformer in Time Series

As researchers have studied the Transformer more intensively, the model has achieved remarkable success in natural language processing, computer vision, and speech recognition. Transformer captures long-range dependencies effectively and uses self-attention with highly parallel computation, significantly improving training efficiency. Such advantages make Transformer an attractive candidate for time series forecasting. Wu et al. proposed a decomposition architecture called Autoformer. Zhou et al. introduced Informer using ProbSparse self-attention that enhances efficiency. Zhou et al. also designed FEDformer, combining frequency-enhanced decomposed blocks and Fourier-enhanced modules. Liu et al. proposed Pyraformer with pyramidal attention mechanisms. These studies have gradually established Transformer as an effective approach in time series forecasting.

1.3.3 Literature Gaps

The above literature comprehensively summarizes the research status of electric car charging load prediction. However, certain gaps remain:

(1) Most regional charging load prediction studies have focused on electricity price and weather factors, while the influence of charging service fees has been largely overlooked. Since the charging service fee is a primary source of operating income for stations, its impact on charging behavior needs further investigation.

(2) Many existing forecasting methods rely on CNN, RNN, LSTM or other models with certain limitations. Complex charging time series will introduce numerous noises and redundant information, which not only reduces computational efficiency but also requires higher capabilities for models to capture key information.

(3) Most electric vehicle charging load predictions are still limited to single time point or single horizon predictions. Many studies do not combine different time scales, which leads to incomplete predictive information. This affects the balance between short-term and long-term planning of power systems. Therefore, to comprehensively evaluate the changing trends of charging loads and to better demonstrate the generalizability of the proposed model, exploring multiple prediction horizons in a combined framework is essential.

To address these gaps, this paper proposes a new hybrid prediction model (Seg-BO-Transformer) that introduces charging service fees as a feature variable, and conducts empirical research combining single-step and multi-step charging load prediction.

1.4 Research Content and Methodology

This study focuses on short-term electric car charging load forecasting. Based on real-world data from regional charging stations, this paper analyzes multiple influencing factors, builds the Seg-BO-Transformer forecasting model, and compares the model’s performance with several baseline models. The paper is composed of six chapters. Chapter 1 introduces background, significance, literature status, research contents, methodology and innovations. Chapter 2 describes related methodologies. Chapter 3 constructs the Seg-BO-Transformer model. Chapter 4 details the data preprocessing and feature engineering. Chapter 5 gives the empirical prediction analysis. Chapter 6 presents conclusions and outlooks.

The research methodology combines literature analysis, statistical analysis, empirical research and comparative analysis. First, this paper reviews relevant domestic and international literature. Then statistical tools reveal distribution and cyclical patterns. Empirical experiments evaluate the model under single-step and multi-step predictions. A comprehensive comparison analyzes model strengths.

1.5 Innovation of This Paper

This paper proposes a novel hybrid model called Seg-BO-Transformer that integrates time series segmentation, Bayesian Global Optimization, and Transformer neural networks. The specific innovations are as follows:

(1) A new feature variable, namely volatile service fees, is introduced. By integrating service fees into the load forecasting model, we capture the impact of price changes on user behavior more accurately, making load prediction closer to real-world conditions.

(2) This paper proposes a “Segmentation-Optimization-Neural Network” hybrid framework. To ensure that the proposed time series segmentation method can effectively capture local information from the input sequence, the number and length of split subsequences are treated as model hyperparameters. In addition, a periodic positional encoding and a priori-probability-based Transformer structure are constructed. Finally, Bayesian Global Optimization is used to determine the best hyperparameters without falling into local optima.

(3) Past studies often focus on either single-step or multi-step forecasting, failing to combine them. To make up for this inadequacy and provide more comprehensive predictions, this paper adopts single-step forecasting for the next hour and multi-step forecasting for the next day and the next week, enriching the electric car charging load prediction literature.

2. Related Concepts and Theoretical Basis

2.1 Time Series Segmentation

Data segmentation refers to decomposing complex, high-dimensional data into simpler parts that are easier for the model to understand. Time series segmentation divides a continuous time series into different subsequences according to relevant rules, allowing models to better recognize underlying patterns. In time series forecasting, feeding extremely long sequences into models often produces considerable noise and redundant information. Time series segmentation yields multiple benefits:

(1) Reduced computational complexity: Segmentation reduces the amount of data the model needs to process, speeding up training and lowering computational costs.

(2) Enhanced local feature extraction: Segmentation can better capture local patterns and sudden changes in charging behavior.

(3) Noise reduction: By distributing the noise into different subsequences, segmentation effectively weakens irrelevant interference.

(4) Flexible multi-scale processing: Short subsequences can capture high-frequency fluctuations, whereas longer subsequences can reflect overall trends. Combining information across scales helps the model understand and predict future sequences more comprehensively.

2.2 Bayesian Learning

Bayesian learning incorporates prior knowledge concerning certain events to update probability estimates. In machine learning, we apply Bayes’ theorem to update the distribution of parameters based on observed data and prior distributions.

Bayesian Optimization is an efficient global optimization algorithm commonly used for hyperparameter tuning in complex neural networks. It builds a probabilistic surrogate model to approximate the objective function, quantifies uncertainty, and then uses an acquisition function to decide the next sampling point. Common acquisition functions include Expected Improvement (EI), Upper Confidence Bound (UCB), and Probability of Improvement (PI). Because Bayesian Optimization balances exploration and exploitation, it has become popular in complex machine-learning applications.

2.3 Deep Neural Networks

2.3.1 CNN

Convolutional neural networks are designed to process grid-like data. The architecture includes convolutional layers, pooling layers, and fully connected layers. The convolutional layer extracts spatial features by sliding kernels over the input data. Pooling layers down-sample the data to reduce computational costs and prevent overfitting.

2.3.2 RNN

Recurrent neural networks are used for sequential data. By storing hidden states, RNNs can maintain memory across time steps. However, the traditional RNN is plagued by gradient vanishing and exploding when dealing with long sequences.

2.3.3 LSTM

Long short-term memory networks are a special kind of RNN designed to overcome the gradient problem. LSTM uses memory cells and three gates: input gate, forget gate, and output gate. These gates selectively decide what information to store, discard or output.

2.3.4 GRU

Gated recurrent unit is a simplified version of LSTM. GRU uses only two gates, a reset gate and an update gate, and operates directly on the hidden state. GRU has fewer parameters than LSTM while maintaining similar performance.

2.3.5 Transformer

The Transformer was formally proposed in 2017 and is based on multi-head self-attention. Transformers can better identify relationships among different variables, are highly parallelizable, and avoid the gradient problems that plague RNNs. The core self-attention mechanism computes attention scores among sequence points:

$$A_{ij} = \frac{(x_i W^Q)(x_j W^K)^T}{\sqrt{h}}$$

$$y_i = \sum_{j=1}^{n} A_{ij} (x_j W^V)$$

where $W^Q$, $W^K$, and $W^V$ are query, key, and value matrices, respectively. A typical Transformer contains an encoder and a decoder, both with multi-head attention, feed-forward networks, residual connections and layer normalization.

3. Construction of the Seg-BO-Transformer Hybrid Model

3.1 The “Segmentation-Optimization-Neural Network” Framework

The charging load time series of electric cars is influenced by weather conditions, user behavior, and grid states, showing high volatility and nonlinear characteristics. Single models often cannot sufficiently extract hidden features from such complex time series. Therefore, this paper builds a “Segmentation-Optimization-Neural Network” hybrid framework that includes three core components: time series segmentation (Seg), Bayesian Optimization (BO), and Transformer neural networks. The framework first splits the original charging load time series into subsequences that have different local properties. Then, it constructs a BO-Transformer with prior probability structures using periodic positional encodings. Finally, Bayesian Optimization is applied to find the optimal parameter set.

3.2 Hyperparameter-Based Time Series Segmentation

Conventional fixed-window segmentation, event-based segmentation, and change-point-based segmentation each have limitations. Fixed-window segmentation may lead to arbitrary boundaries and overfitting. Event-based segmentation dramatically increases computational costs. Change-point detection requires high data quality and proper interpretation. Therefore, this paper proposes a hyperparameter-based time series segmentation method.

First, a sliding window approach is used to segment the raw time series dynamically. The length of each subsequence $N_i$ and the number of segments $K$ are treated as hyperparameters. The mathematical condition is:

$$N_1 + N_2 + \cdots + N_K = L$$

where $L$ is the input sequence length. When $K=1$, the sequence is not segmented. After segmentation, Bayesian Optimization will determine the optimal segmentation strategy based on model performance in validation.

3.3 A Priori-Probability Transformer Structure

Pure multi-head self-attention may face limitations when the sequence is highly volatile and complex. In this section, the Bayesian probability framework is integrated with multi-head attention. The prior probability dynamically adjusts attention weights, enabling the model to better capture potential volatility and extreme spikes. The modified attention formula is:

$$A_{ij} = \left[ \frac{(x_i W^Q)(x_j W^K)^T}{\sqrt{h}} \right] \cdot \frac{p(j)}{p(i)}$$

In this equation, $p(j)$ represents the prior probability of time point $j$, and $p(i)$ normalizes across positions. To derive $p(j)$, we calculate multi-feature variation using the following steps:

(1) Build a feature matrix $N_j^k$.

(2) Compute the amplitude of change for each feature:

$$\Delta_j^k = \left| N_j^k – \overline{N^k} \right| + \alpha_k \cdot \left| \frac{N_j^k – N_{j-1}^k}{N_{j-1}^k} \right|$$

(3) Take a weighted sum of all the feature changes:

$$\Delta_j = \sum_{k=1}^{K} \beta_k \cdot \Delta_j^k$$

(4) Compute the prior probability:

$$p(j) = \frac{\Delta_j}{\sum_{t=1}^{n} \Delta_t}$$

(5) To further improve the prior probability assignment, clustering analysis groups similar temporal patterns and modifies prior probabilities based on internal cluster variability.

(6) An exponentially weighted moving average dynamically updates prior probabilities:

$$p(j)_t = \tau \cdot p(j)_{t-1} + (1-\tau) \cdot p(j)’$$

where $\tau \in [0,1]$ balances old and new information during training.

3.4 The Bayesian Optimization Process

Transformer architectures are highly sensitive to hyperparameter selection such as learning rate, model depth, hidden size, attention heads, random seed, etc. The proposed time series segmentation module and prior probability attention module introduce additional parameters. Manual tuning is inefficient and prone to fall into local optima. Grid search suffers from the curse of dimensionality, while random search ignores past evaluation results. Genetic algorithms have slow convergence and require complex internal parameter selection. Therefore, Bayesian Optimization is employed.

The Bayesian Optimization procedure is as follows:

(1) Sample random initial points.

(2) Build a Gaussian process surrogate model.

(3) Select the next hyperparameter combination using UCB acquisition function.

(4) Train the model with the selected hyperparameters and evaluate on validation loss.

(5) Update the Gaussian process and repeat until maximum iterations or convergence.

4. Data Preprocessing and Feature Engineering

4.1 Data Description and Preprocessing

The data used in this study are from a dynamic pricing charging station in Shenzhen, spanning from September 1, 2022 to August 31, 2023. The sampling interval is one hour, giving 8,760 records. After desensitization, records include time, charging station identity, number of charging piles, charging duration, charging load, electricity price, service fee, occupancy rate, and meteorological variables. The key features and their explanations are shown in Table 1:

Table 1: Charging load data field descriptions

Feature Description
Time Timestamp in year-month-day-hour format
Station ID Charging station code
Number of piles Total number of charging piles: 72
Charging duration Sum of charging time of all piles (hours)
Charging load Total charging station load (kW)
Electricity price Local electricity price (yuan/kWh)
Service fee Charging pile service fee (yuan/kWh)
Occupancy rate Currently used charging piles / total charging piles
Air temperature Temperature at 2 m above ground (℃)
Atmospheric pressure Station air pressure (mmHg)
Relative humidity Relative humidity at 2 m above ground (%)
Average wind speed Wind speed at 10-12 m above ground (m/s)
Visibility Horizontal visibility (km)
Rainfall 0-normal, 1-light rain, 2-rain, 3-heavy rain

Statistical descriptions of the raw charging load series are shown in Table 2:

Table 2: Statistical indicators of charging load data

Sample Min Max Median Mean Variance Skewness
Charging load 0 767.019 182.2183 234.742 22557.99 0.562

The charging load data exhibit considerable daily cycles, with peak load often occurring around midnight to morning hours. The large variance and skewness confirm that this time series has strong fluctuation, randomness and non-stationarity.

The data preprocessing steps include:

(1) Data cleaning: We deleted duplicate samples and identified abnormal values using rule-based and statistical methods.

(2) Missing value imputation: To handle missing values, the paper combines Lagrangian interpolation and cubic spline interpolation. Lagrangian interpolation is simple, while cubic spline interpolation provides better performance when new data points are added because only affected spline sections need re-computation.

The general formula for cubic spline interpolation is:

$$S_i(x) = a_i + b_i(x – x_i) + c_i(x-x_i)^2 + d_i(x-x_i)^3$$

Under natural boundary conditions, we obtain smoother and more accurate imputation.

(3) Normalization: Because raw charging load data are right-skewed, the data are first transformed via the logarithm function and then scaled via Min-Max normalization:

$$x’ = \log(x+1)$$

$$x” = \frac{x’ – \min(x’)}{\max(x’) – \min(x’)}$$

(4) Periodic positional encoding: Based on the daily periodic fluctuation found in the charging load data, periodic positional encoding is defined with sine and cosine functions:

$$PE(t, 2i) = \sin\left(\frac{t}{T^{2i/d}}\right)$$

$$PE(t, 2i+1) = \cos\left(\frac{t}{T^{2i/d}}\right)$$

where $T=10000$. By adding the periodic positional encoding, the model can better capture the cyclical nature of charging demand.

4.2 Feature Engineering

Feature engineering plays an important role in forecasting accuracy. In this paper, after cleaning the data, Pearson correlation analysis and principal component analysis are performed.

(1) Correlation Analysis. The Pearson correlation coefficient is calculated using the formula:

$$r = \frac{\sum_{i=1}^{n} (x_i – \bar{x})(y_i – \bar{y})}{\sqrt{\sum_{i=1}^{n} (x_i – \bar{x})^2}\sqrt{\sum_{i=1}^{n} (y_i – \bar{y})^2}}$$

The results show that the most important factors affecting charging load are service fee and electricity price with correlation coefficients of about 0.76 and -0.77, respectively. The strong positive correlation with service fees indicates that stations with more complete facilities and better service typically attract more charging demand. Moreover, charging duration and occupancy rate also show significant positive correlations with charging load. Weather variables have weak correlations in this dataset.

(2) Principal Component Analysis. To reduce noise and eliminate redundant information, PCA is performed. The steps are as follows:

(1) Calculate the covariance matrix.

(2) Compute eigenvalues and eigenvectors:

$$C\mu = \lambda \mu$$

(3) Project the raw data onto the first $k$ principal components.

By applying PCA to the feature set, we can reduce the dimensions of weather variables and other low-relevance factors, reducing the risk of overfitting and improving model efficiency.

5. Charging Load Forecasting with Seg-BO-Transformer

5.1 Model Forecasting Framework

The overall prediction process is described below:

(1) Preprocess data and split it into training, validation and test sets with a ratio of 7:1:2.

(2) Perform PCA and time series segmentation to reduce noise and extract local hidden features. The number and length of the segments are treated as hyperparameters tuned by Bayesian Optimization.

(3) Embed periodic positional encoding to enhance the model’s capacity to capture periodicity.

(4) Construct the BO-Transformer neural network by integrating prior probability into the multi-head self-attention structure.

(5) Determine optimal hyperparameters with Bayesian Optimization.

(6) Conduct one-step and multi-step predictions and evaluate with multiple metrics.

5.2 Baseline Models

To comprehensively verify the effectiveness of the Seg-BO-Transformer model, six baseline models are designed: CNN, RNN, LSTM, GRU, CNN-GRU, and Transformer. These models have all been widely applied and proven effective in the field of time series forecasting, and they represent both standard deep networks and hybrid architectures.

5.3 Evaluation Metrics

Four evaluation metrics are selected: mean absolute error (MAE), mean absolute percentage error (MAPE), root mean square error (RMSE), and coefficient of determination ($R^2$). The formulas are:

$$MAE = \frac{1}{n}\sum_{i=1}^{n} \left| y_i – \hat{y}_i \right|$$

$$MAPE = \frac{1}{n}\sum_{i=1}^{n} \left| \frac{y_i – \hat{y}_i}{y_i} \right| \times 100\%$$

$$RMSE = \sqrt{\frac{1}{n}\sum_{i=1}^{n} (y_i – \hat{y}_i)^2}$$

$$R^2 = 1 – \frac{\sum_{i=1}^{n} (y_i – \hat{y}_i)^2}{\sum_{i=1}^{n} (y_i – \bar{y})^2}$$

5.4 Single-step Forecasting Results

For single-step forecasting, the input length is 24 hours and the output length is 1 hour ($K=1$). In other words, the model uses the last 24 hours of data to forecast the charging load for the upcoming hour. Table 3 presents the evaluation results.

Table 3: Evaluation metrics of charging load forecasting ($K=1$)

Model MAE RMSE MAPE (%) R²
CNN 41.2417 46.0223 19.48 0.9601
RNN 34.1502 42.6074 14.37 0.9638
Transformer 24.7746 32.1393 12.25 0.9820
LSTM 24.5108 31.2006 12.16 0.9832
GRU 21.4507 28.5532 9.95 0.9889
CNN-GRU 16.9431 23.1223 8.49 0.9945
Seg-BO-Transformer 12.0645 16.9033 5.67 0.9976

From the single-step prediction perspective, CNN and RNN exhibit weaker performance due to inherent limitations in capturing long-term dependencies from highly non-stationary series. LSTM and GRU show better capability. Transformer demonstrates quite competitive results, reflecting the effectiveness of self-attention in time series. CNN-GRU, as a hybrid model, outperforms all single models.

However, Seg-BO-Transformer achieves the best results across all metrics. Its MAE is 12.0645, which is significantly lower than CNN-GRU. This translates to improvements of about 28.8% and 26.9% in MAE and RMSE, respectively, compared to the best baseline. Its $R^2$ of 0.9976 indicates that the model can explain 99.76% of the total variance. This suggests that the time series segmentation, periodic positional encoding and prior probability attention mechanism effectively cooperate to capture important features and extreme values that other models fail to identify.

5.5 Multi-step Forecasting Results

5.5.1 One-Day-Ahead Forecasting

In this experiment, the input length is 240 hours and the output length is 24 hours ($K=24$). The model uses ten days of historical data to forecast the next day’s charging load curve. The evaluation results are shown in Table 4.

Table 4: Evaluation metrics of charging load forecasting ($K=24$)

Model MAE RMSE MAPE (%) R²
CNN 62.5517 75.1689 29.98 0.9478
RNN 54.0300 65.3878 25.78 0.9592
GRU 40.7500 50.3363 19.29 0.9637
LSTM 39.2196 48.9892 19.09 0.9641
CNN-GRU 33.1164 41.8791 15.94 0.9736
Transformer 36.0410 43.8706 17.41 0.9739
Seg-BO-Transformer 16.7519 22.6898 7.87 0.9901

As the forecasting horizon increases, the prediction tasks become more difficult, and all models show deterioration in performance compared to single-step forecasting. GRU’s relative ranking degrades, while LSTM and Transformer improve compared to other baselines, indicating that their gated structures or attention mechanisms help capture cyclic patterns in longer sequences.

Seg-BO-Transformer still achieves a dominant result. Its MAE reaches 16.7519 and its $R^2$ remains at 0.9901. The increase in error from the single-step case is far smaller than that of all baselines, demonstrating high robustness and generalization capability. This is because the model can segment long input sequences into more informative subsequences and filter out irrelevant noise from the input, thus preserving the most useful information for prediction.

5.5.2 One-Week-Ahead Forecasting

For one-week-ahead forecasting, the input length is 360 hours and the output length is 168 hours ($K=168$). The model uses fifteen days of historical data to predict the next week’s charging load curve. Table 5 presents the results.

Table 5: Evaluation metrics of charging load forecasting ($K=168$)

Model MAE RMSE MAPE (%) R²
CNN 101.8872 115.7878 41.05 0.8641
RNN 84.7673 98.7741 37.22 0.9172
GRU 69.3218 83.9810 32.63 0.9283
CNN-GRU 63.5268 79.7613 31.14 0.9247
LSTM 59.3698 67.3154 29.86 0.9307
Transformer 53.1803 64.9281 27.49 0.9649
Seg-BO-Transformer 29.0728 35.2941 14.95 0.9829

In the one-week-ahead task, the benchmark models show greater degradation in performance. Transformer ranks first among baselines and demonstrates strong long-sequence representation ability. Nevertheless, Seg-BO-Transformer remains far superior. Its MAE of 29.0728 is lower than all baselines by a wide margin, and its $R^2$ remains above 0.98. This indicates that the model can resist noise accumulation during multi-step prediction and maintain stable predictive power.

Through careful visual comparisons of the predicted curves against actual charging loads, it can also be observed that Seg-BO-Transformer has the closest fit to the actual data, especially at extreme peaks and valleys. This demonstrates that the model has excellent capacity to capture both high-frequency changes and long-term trends in the charging load series, providing valuable support for short-term power system scheduling and long-term capacity planning.

Scenario Best baseline MAE Seg-BO-Transformer MAE MAE improvement (%)
Single-step ($K=1$) 16.9431 12.0645 28.79
One-day ahead ($K=24$) 33.1164 16.7519 49.42
One-week ahead ($K=168$) 53.1803 29.0728 45.33

5.6 Diebold-Mariano Test

The Diebold-Mariano (DM) test is a statistical significance test used to compare two competing forecast models. The DM statistic is:

$$DM = \frac{\bar{d}}{\sqrt{V/N}}$$

where $\bar{d}$ is the average loss differential and $V$ is the HAC variance estimator. In this study, DM tests are conducted for MAE and RMSE by comparing the Seg-BO-Transformer against each baseline model. The results show that all DM statistics are well above the 1% significance level critical value (2.576), with p-values approaching zero. Even against the strongest baseline, the model shows statistically significant superiority. Thus, we can conclude that the improvements of Seg-BO-Transformer are not due to random chance but are statistically meaningful.

Table 6: DM test results (MAE)

Baseline vs Seg-BO-Transformer K = 1 K = 24 K = 168
CNN 30.7505 (0.0000) 21.3444 (0.0000) 35.9549 (0.0000)
RNN 24.4098 (0.0000) 17.4766 (0.0000) 21.4569 (0.0000)
Transformer 26.9061 (0.0000) 10.5323 (0.0000) 8.3665 (0.0000)
LSTM 26.0208 (0.0000) 12.5114 (0.0000) 11.9918 (0.0000)
GRU 21.1763 (0.0000) 16.9134 (0.0000) 18.4745 (0.0000)
CNN-GRU 2.7995 (0.0051) 16.0368 (0.0000) 20.3490 (0.0000)

5.7 Improvement Brought by the Service Fee Variable

To further validate whether including the dynamic service fee as an explanatory variable significantly increases prediction accuracy, experiments on Seg-BO-Transformer are implemented both with and without the service fee. We evaluate the following improvement ratios:

$$P_{MAE} = \left|\frac{MAE – MAE^*}{MAE^*}\right| \times 100\%$$

$$P_{RMSE} = \left|\frac{RMSE – RMSE^*}{RMSE^*}\right| \times 100\%$$

where $MAE$, $RMSE$ denote results after including service fee, while $MAE^*$, $RMSE^*$ denote results without including service fee. The results are shown in Table 7:

Table 7: Prediction improvement from adding service fee variables

Forecast horizon MAE* RMSE* P_MAE P_RMSE
K=1 13.3857 18.6674 0.0987 0.0945
K=24 18.3441 24.6896 0.0868 0.0810
K=168 31.3284 37.8814 0.0720 0.0683

These experiments show that adding service fee variables significantly improves forecasting accuracy across all horizons, with the greatest improvement in the single-step case. The improvements remain positive and substantial for the one-week-ahead case as well. This confirms that the service fee is an important factor influencing electric car charging behavior, and charging station operators can leverage the forecast model to design dynamic service fee mechanisms that smooth load curves while maximizing revenues.

6. Conclusions and Outlook

6.1 Research Conclusions

Under the global low-carbon transition, electric cars are undergoing rapid popularization. The randomness and volatility of electric car charging load bring great challenges to the stability of power grids. This paper conducts a systematic study on electric car charging load prediction using a hybrid Seg-BO-Transformer model. The empirical study is based on real data from a charging station in Shenzhen, with a total of 8,760 records over one year. The main conclusions are as follows:

(1) Charging load time series display strong non-stationarity, nonlinearity, volatility, and periodicity. The data preprocessing steps, including cleaning, interpolation, log transformation, and Min-Max normalization, effectively improve data quality. Pearson correlation analysis and PCA verify that service fees and electricity price are among the most significant factors correlated with charging load.

(2) To improve model performance, this paper designs a hybrid framework “Segmentation-Optimization-Neural Network”. Time series segmentation reduces noise, improves feature extraction and reduces redundant calculations. The prior probability multi-head attention increases the model’s ability to identify extreme values and hidden patterns. Periodic positional encoding explores daily and weekly periodicities. Bayesian Optimization automatically finds optimized hyperparameters and effectively avoids falling into local optima.

(3) Compared with CNN, RNN, LSTM, GRU, CNN-GRU and Transformer, the Seg-BO-Transformer achieves the highest prediction accuracy across all evaluation metrics, regardless of whether the task is single-step prediction, one-day-ahead prediction, or one-week-ahead prediction. In the single-step case, the $R^2$ is as high as 0.9976. As the prediction horizon extends, the proposed model maintains better stability than the baseline models, demonstrating its remarkable generalization and applicability.

(4) The DM test shows that the improved accuracy of the Seg-BO-Transformer over the baselines is statistically significant at the 1% significance level. Furthermore, including service fees as an input feature yields an additional accuracy improvement of over 6% to 9%, confirming that charging service fee is a meaningful predictor of electric car charging load.

These conclusions offer several useful managerial implications. Power systems can use accurate load prediction to optimize scheduling and improve grid safety. Charging station operators can develop dynamic pricing strategies based on load forecasts to smooth demand. Policy makers can also design reasonable subsidies and incentives to promote electric cars in an environmentally sustainable way.

6.2 Future Research Directions

This study has some limitations that future research could address. First, the data are collected from a specific charging station in one city; whether the results can be generalized to different regions with different charging habits and infrastructure still needs to be validated by using more diverse datasets. Second, future work may include additional influencing factors such as holiday effects, extreme weather events, government policies, traffic conditions and grid constraints. Third, ablation studies may systematically identify the contribution of each module in the hybrid model. Finally, many emerging deep learning technologies and foundation models could further improve the prediction capability and offer more advanced tools for electric car charging load forecasting. Future research can employ these techniques to strengthen the decision support system for power grids, charging network planners, and policy makers, thereby contributing to greener transportation and energy systems.

Scroll to Top