Next Article in Journal
Reducing Carbon Emissions Through Rolling Scheduling Optimization of a City-Level Virtual Power Plant Considering External Power Dominance and Multi-Resource Flexibility Aggregation: A Case Study of Guangzhou, China
Previous Article in Journal
Discharge Characteristics and Configuration of Electrical Clearances in the ±500 kV Valve Hall of Offshore Platforms
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Residential Electricity-Use Profiling for Demand-Side Management Using a Convolutional Attention Variational Autoencoder and Adaptive GWO-K-Means Clustering

1
State Grid Hubei Electric Power Trading Center, Wuhan 430040, China
2
School of Electrical Engineering and Automation, Wuhan University, Wuhan 430072, China
*
Author to whom correspondence should be addressed.
Energies 2026, 19(18), 4430; https://doi.org/10.3390/en19184430 (registering DOI)
Submission received: 1 July 2026 / Revised: 8 August 2026 / Accepted: 16 September 2026 / Published: 18 September 2026

Abstract

Residential load profiling can support the design of differentiated demand-side management, but clustering methods are sensitive to representation quality and initialization. We developed a profiling workflow that combines a convolutional attention variational autoencoder (CA-VAE), adaptive gray wolf optimizer K-Means (GWO-K-Means) search over candidate cluster numbers and centers, and a clustering-loss refinement stage. On 6390 prepared residential average-day load profiles from the Commission for Energy Regulation dataset, ten independent runs yielded a final silhouette coefficient of 0.5002 (SD 0.0314), a Davies–Bouldin index of 0.8532 (SD 0.0383), and a Calinski–Harabasz index of 3694.3 (SD 260.5). Relative to raw K-Means, the final workflow improved all three internal validity measures (paired Wilcoxon signed-rank test, p = 0.001953 for each metric). GWO selected K = 5 in 6 of 10 runs; this modal solution produced five interpretable load profiles. The profiles provide load-shape-derived candidate groups for future demand-response trials, rather than validated estimates of operational flexibility.

1. Introduction

Residential demand is increasingly important to power-system flexibility because household loads collectively shape distribution-network peaks and the effectiveness of time-of-use tariffs and demand-response programs. Smart-meter data make it possible to segment users according to recurring load shapes and to match groups with differentiated demand-side management interventions [1,2,3]. However, residential smart-meter data are high-dimensional, large-scale, variable in quality, and characterized by nonlinear relationships [4]. Electricity-use patterns also differ substantially among households, leading to heterogeneous load-regulation potential [5]. Reliable user profiling therefore requires methods that distinguish behaviorally meaningful load shapes while retaining a clear connection to operational energy-management decisions.
Clustering algorithms group users with similar electricity-use patterns [6,7] and can be broadly categorized as direct or indirect methods. Direct clustering applies an algorithm directly to electricity-consumption data. Improved K-Means and fuzzy C-means remain widely used for classifying daily load curves [8,9]. Dynamic time warping combined with density-peak clustering has also been used to identify typical load curves [10,11], and state-feature clustering has been applied to non-intrusive load-event detection [12]. Nevertheless, direct clustering often cannot capture complex behavioral variation in high-dimensional electricity data, which limits clustering performance.
Indirect clustering extracts lower-dimensional features before clustering. Common approaches include manually designed indicators and dimensionality-reduction algorithms. Indicators such as daily maximum load and load factor can characterize electricity use [13], but they provide limited information about temporal evolution. Principal component analysis has been applied to user-metering data [14], but its linear formulation cannot adequately represent nonlinear relationships. Dimensionality reduction has also been combined with ensemble clustering for load-curve analysis [15]. More recently, deep-learning methods have been introduced into load clustering [16]. A joint convolutional neural network autoencoder (CNN-AE) and hierarchical clustering model has shown the potential of deep feature extraction and joint training for electricity-use pattern classification [17]. Long short-term memory autoencoders have also been studied [18], although their requirement for a single continuous input series makes simultaneous classification of multiple users difficult. Recent Energies research has further combined ensemble clustering with explainable artificial intelligence to connect residential load profiles with demand-response decisions [19], highlighting the importance of both clustering performance and operational interpretability.
Despite these advances, deep learning-based feature extraction still has three limitations. First, conventional convolutional autoencoders capture local temporal features but do not explicitly model long-range dependencies across a load curve. Second, clustering algorithms such as K-Means require the number of clusters and initial cluster centers to be specified in advance and are sensitive to local optima. Third, most methods separate feature extraction from clustering, so the learned representation is not necessarily aligned with the clustering objective.
This study develops a residential load-profiling workflow that combines convolutional attention variational representation learning with adaptive GWO-K-Means and clustering-loss refinement. Its contribution is not the use of any component in isolation. Instead, it evaluates a reproducible sequence in which CA-VAE produces compact daily load embeddings, GWO searches candidate values of K and initial centers using a pre-specified SC-DBI objective, and a subsequent clustering-loss stage is assessed rather than being assumed to improve the representation. The framework targets 48-step average-day profiles and preserves direct profile-level interpretation. The empirical claims are limited to internal clustering validity on the CER dataset and screening-level demand-side management implications.

2. Data Preprocessing

2.1. Data Source

The present analysis uses a prepared CER input matrix [20] containing 6390 user-level, Min–Max normalized average daily load curves with 48 half-hourly values per user. The retained input is complete and contains no NaN or Inf values. The analysis therefore focuses on clustering these supplied long-term average-day profiles.
Averaging daily load curves emphasizes persistent shape characteristics but suppresses day-specific, seasonal, and weekday–weekend variation. The conclusions are consequently limited to long-term shape-based residential profiling.

2.2. Scope of the Retained Input Data

The retained analysis file does not include the original day-level missingness pattern or raw daily records. We therefore do not claim a new validation of the mean value of simultaneous data (MVSD) imputation in this revision. Comparing MVSD with alternative imputation methods requires the original daily observations and is identified as future work.
For a user with a missing observation at a given time, the imputed value is calculated as follows:
x t ( i ) = 1 N j Ω x j , t ( i )
where the missing measurement of the user at the target time is estimated from the set of valid days for the same user and the same time period; the denominator denotes the number of valid days in this set.

2.3. Normalization and Interpretation

Because the retained input does not include original day-level observations or anomaly labels, this revision does not re-evaluate a repeated 3-sigma outlier procedure or its effect on legitimate peak-demand behavior. Such validation requires raw daily data and observed event labels.
μ i = 1 M m = 1 M x m ( i )
σ i = 1 M m = 1 M ( x m ( i ) μ i ) 2
where the mean, standard deviation and number of valid measurement points are calculated for each user. Then, each measurement is judged according to the following criterion:
| x m ( i ) μ i | > 3 σ i x m ( i )   is   outlier
Detected outliers are treated as missing observations and imputed using MVSD. This procedure is repeated until no additional outliers are detected.
The supplied profiles are Min–Max normalized per user. This removes absolute load magnitude from the clustering input and emphasizes shape. Where original-scale profiles are used for interpretation, they are descriptive rather than part of the clustering objective.
x ^ t ( i ) = x t ( i ) x min ( i ) x max ( i ) x min ( i )
where each raw observation is normalized using the minimum and maximum observations for the same user. In the limiting case of a constant load, the denominator is set to 1 to avoid division by zero.
After normalization, each user’s average daily load curve lies in [0, 1], and the resulting matrix is used as the input to CA-VAE.

3. CA-VAE Feature Extraction Model

3.1. Basic Principle of Variational Autoencoder

A variational autoencoder (VAE) is a generative model that combines deep learning with probabilistic inference [21]. Unlike a conventional autoencoder (AE), a VAE imposes a probability distribution, typically a standard normal distribution, on the latent variables, producing a more regular and continuous latent representation.
A VAE comprises an encoder and a decoder. The encoder maps the input to the mean and log-variance parameters of the latent posterior distribution. Using the reparameterization trick, the decoder samples a latent variable from this distribution and reconstructs the input. Maximizing the evidence lower bound (ELBO) is equivalent to minimizing the following loss function:
L VAE = L recon + β L KL
The reconstruction loss measures the discrepancy between the input and reconstructed output. This study uses mean squared error (MSE):
L recon = 1 n i = 1 n x i x ^ i 2
where the batch size, the original normalized load sequence and the load sequence reconstructed by the decoder are used to calculate the reconstruction error.
KL divergence regularizes the latent posterior distribution toward the prior distribution:
L KL = 1 2 j = 1 d ( 1 + log σ j 2 μ j 2 σ j 2 )
where the calculation uses the latent-space dimension and the mean and standard deviation produced by the encoder. KL divergence prevents the latent space from degenerating into a deterministic mapping and promotes continuity and diversity in the learned representation.
The weighting coefficient balances reconstruction quality against latent-space regularization. A larger value produces a more regular latent space at the cost of reconstruction accuracy, whereas a smaller value improves reconstruction but may reduce latent-space smoothness. Its value is selected experimentally.

3.2. Encoder Structure Integrating Convolution and Attention

To improve VAE feature extraction for electricity-use time series, the encoder is extended with convolution and attention. As shown in Figure 1, the resulting convolutional attention encoder comprises one-dimensional convolutional layers, a self-attention layer, and fully connected layers.
(1) One-dimensional convolutional neural network (1D-CNN). A 1D-CNN applies a sliding window along the time series to extract local temporal features. Two one-dimensional convolutional layers are used here to learn increasingly abstract temporal patterns.
First convolutional layer: the normalized 48-dimensional load sequence is treated as a one-channel signal. Each kernel spans five consecutive half-hour periods (2.5 h) to capture short-term load variation. The convolution reduces the temporal dimension from 48 to 44 and is expressed as follows:
h t ( 1 , f ) = ReLU k = 0 K 1 1 W k ( 1 , f ) x t + k + b ( 1 , f ) , t = 1 , , T 1
where the output of the first-layer filter at each time step is determined by the corresponding convolution weights, bias term and activation function.
The second convolutional layer extracts higher-level temporal patterns from the multichannel feature maps produced by the first layer. This convolution reduces the temporal dimension from 44 to 42 and is expressed as follows:
h t ( 2 , f ) = ReLU k = 0 K 2 1 c = 1 F 1 W k , c ( 2 , f ) h t + k ( 1 , c ) + b ( 2 , f ) , t = 1 , , T 2
where the output is determined by the second-layer filter weights across time offsets and input channels. Together, the two convolutional layers learn a hierarchy of temporal representations, from local 2.5 h trends to higher-level combinations of load patterns.
(2) Self-attention layer. Convolutional layers capture local temporal dependencies but do not directly model relationships between distant time periods. A self-attention mechanism is therefore introduced after the convolutional layers [17]. Three learnable linear transformations map the convolutional feature matrix to query, key, and value matrices, from which attention weights between time steps are calculated:
Q = H W Q , K = H W K , V = H W V
The attention weights are obtained using scaled dot-product attention:
Attention ( Q , K , V ) = softmax Q K T d k V
The attention-weight matrix quantifies how strongly each time step attends to every other time step during encoding. This mechanism is well suited to residential electricity-use data, which often contain dependencies across distant periods, such as low daytime consumption followed by concentrated evening demand or high nighttime heating demand followed by low daytime demand. Such relationships extend beyond the local receptive field of a convolution kernel. Self-attention can encode these long-range dependencies, thereby improving the distinction between latent representations of different electricity-use patterns.
For example, the mechanism can associate low electricity use at 08:00 with high electricity use at 18:00, a pattern consistent with residents being away during the day and returning in the evening.
(3) Global average pooling and fully connected layers. Global average pooling (GAP) compresses the feature matrix produced by the attention layer into a fixed-length vector by averaging along the temporal dimension:
h ¯ = 1 T 2 t = 1 T 2 h t attn
where the 64-dimensional feature vector at each time step is averaged across all time steps after the second convolution. Because GAP retains information from the full daily sequence, it is suitable for representing complete load-curve shapes. The resulting 64-dimensional vector is mapped to a 128-dimensional intermediate representation, after which two linear layers produce the mean and log-variance of the latent variables:
h f c = ReLU ( h ¯ W f c + b f c )
μ = h f c W μ + b μ
log σ 2 = h f c W σ + b σ
Reparameterization: sampling directly from the posterior distribution is not differentiable and therefore prevents encoder optimization by backpropagation. The reparameterization trick is used to address this problem [21]:
z = μ + exp ( 0.5 log σ 2 ) ϵ , ϵ ~ N ( 0 , I )
where a random vector is sampled from a standard normal distribution. This transformation isolates the stochastic component from the model parameters, allowing gradients to propagate through the mean and variance parameters to the encoder.

3.3. Decoder Structure

The decoder reconstructs the original 48-dimensional load curve from the 16-dimensional latent variable z. It uses a three-layer fully connected architecture: z (16 dimensions) → FC (128) → FC (256) → FC (48). The first two layers use ReLU activation, and the final layer produces the reconstructed load curve. A Sigmoid activation constrains the output to [0, 1], matching the normalized input range.
x ^ = σ ( d 2 W d 3 + b d 3 )
σ ( x ) = 1 1 + e x

3.4. Training Strategy

CA-VAE is pretrained with Adam for 200 epochs using a learning rate of 0.002, a KL-divergence weight beta of 0.3, batch size 256, a 16-dimensional latent space, convolution kernels of 5 and 3, and 32 and 64 filters. Gradients are clipped at 5. These values were fixed for the repeated-run study; gamma, fitness weights, and attention were additionally examined through the robustness checks reported below.

4. Adaptive Clustering Based on GWO-K-Means

4.1. Basic Principle of Gray Wolf Optimizer

The gray wolf optimizer (GWO) is a swarm-intelligence algorithm inspired by the hunting behavior of gray wolves [22]. The population is organized into α, β, δ, and ω wolves, representing the best, second-best, third-best, and remaining candidate solutions, respectively. At each iteration, candidate positions are updated using the positions of the three leading wolves and progressively approach the optimum. The search comprises global exploration, encircling, and local exploitation.
Once a candidate prey location has been identified, the wolves update their positions to encircle it. This behavior is modeled as follows:
D = | C X p ( t ) X ( t ) |
X ( t + 1 ) = X p ( t ) A D
where the formulation uses the current iteration, the prey position (the current best solution), the current wolf position, and the distance between the wolf and the prey. The coefficient vectors are calculated as follows:
v e c A = 2 a r 1 a
C = 2 r 2
where two random vectors are sampled uniformly from [0, 1]. The convergence factor decreases linearly from 2 to 0 over the optimization process according to the following expression:
a = 2 1 t T max
where the maximum number of iterations is 80. As the convergence factor decreases from 2 to 0, the range of the coefficient vector contracts from [−2, 2] to [0, 0]. An absolute coefficient value greater than 1 promotes global exploration, whereas a value below 1 promotes local exploitation.
Because the true global optimum is unknown, the α, β, and δ wolves are treated as the most informative candidate solutions. Each wolf first calculates candidate positions relative to these three leaders:
X 1 = X α A 1 | C 1 X α X |
X 2 = X β A 2 | C 2 X β X |
X 3 = X δ A 3 | C 3 X δ X |
The updated position of a wolf is then calculated as the mean of the three candidate positions:
X ( t + 1 ) = X 1 + X 2 + X 3 3
where the three leaders are the first-, second-, and third-ranked individuals in the current population, and their coefficient vectors are generated independently. Combining information from all three leaders reduces reliance on a single best candidate and is intended to limit premature convergence.

4.2. Adaptive Optimization of K-Means Parameters Based on GWO

Adaptive GWO-K-Means searches K in [3, 10] and corresponding latent-space centers. Each wolf encodes a candidate K and its K centers. This range spans a minimum coarse distinction among residential shapes while limiting the number of profiles to an interpretable operational scale.
f = w 1 SC w 2 DBI
The GWO fitness function is F = 0.6 SC − 0.4 DBI, where SC is maximized and DBI is minimized. CH is calculated as an independent third evaluation metric and is not added to the search objective, avoiding a second manually weighted composite criterion. In a controlled fixed-representation sensitivity check, four weight pairs from (0.3, 0.7) to (0.7, 0.3) all selected K = 5 and produced the same partition.
CH = SSB / ( K 1 ) SSW / ( n K )
S S B = k = 1 K | C k | μ k μ 2
S S W = k = 1 K z i C k z i μ k 2
where SSB and SSW denote between-cluster and within-cluster dispersion, respectively. The calculation also uses the samples and center of each cluster and the global center across all samples. A larger CH value indicates stronger clustering performance. CH is not included in the fitness function and is used only as a third evaluation dimension.
The GWO population contains 30 wolves and is evolved for 80 iterations. Each candidate undergoes 10 local K-Means refinement iterations, and the K-mutation probability is 0.1. These settings were fixed before the repeated-run study to balance population exploration, local center refinement, and computational cost. The retained global-best candidate and its K trajectory are reported for reproducibility.

4.3. Selection Basis of K

To assess the K selected by GWO, the sum of squared errors (SSE), SC, DBI, and CH are calculated for each candidate value from K = 3 to K = 10. Figure 2 shows how the four indices vary with K.
As shown in Figure 2a, SSE decreases monotonically with increasing K, with a clear change in slope at K = 5. This elbow suggests that additional clusters beyond K = 5 provide diminishing reductions in within-cluster error. SC reaches its maximum of approximately 0.515 at K = 4, decreases to approximately 0.45 at K = 5, and rises to approximately 0.49 for K ≥ 7 (Figure 2b). DBI reaches its minimum of approximately 0.82 at K = 9 and is approximately 0.90 at K = 5 (Figure 2c), whereas CH generally increases with K and reaches its maximum at K = 10 (Figure 2d).
The validity indices can favor different values of K, especially because DBI and CH may favor more finely divided partitions. Across ten independent end-to-end runs, GWO selected K = 5 in 6 runs, K = 6 in 2 runs, and K = 9 in 2 runs. We therefore retain K = 5 as the modal, representative, and operationally interpretable solution, rather than as a unique numerical optimum. All selected K values are reported in the Supplementary Material.
For an additional comparison across K values, the four indices are transformed using Min–Max normalization. DBI and SSE are reversed so that larger normalized values consistently represent better performance. A weighted comprehensive score is then calculated, as shown in Figure 3.
Figure 3 shows distinct behavior among the four normalized indices. Normalized SC is highest at K = 4, whereas normalized DBI, CH, and SSE increase with K, causing the comprehensive score to generally rise as K increases. Because this trend is largely driven by indices that favor larger K, a higher comprehensive score alone does not establish that a larger number of clusters is more useful in practice.
Considering Figure 2 and Figure 3 together with the GWO fitness result, K = 5 provides a balanced solution across the validity indices. The resulting five profiles are also interpretable in terms of electricity-use periods and load levels and remain manageable for fine-grained demand-side management. K = 5 is therefore selected as the final number of clusters.

5. Joint Optimization Training

5.1. Basic Idea of the Joint Model

Conventional indirect clustering treats feature extraction and clustering as sequential, independent tasks. Feature extraction minimizes reconstruction error, whereas clustering minimizes classification error, with no feedback between the two objectives [17]. Consequently, the learned latent representation may not be well aligned with the clustering task.
To align these objectives, multitask learning is used to jointly optimize CA-VAE feature extraction and GWO-K-Means clustering. A clustering-loss term is added to the CA-VAE objective so that the encoder learns to reconstruct the input while also improving cluster structure. Clustering-loss gradients fine-tune the encoder, preserving salient load information while promoting within-cluster compactness and between-cluster separation. Figure 4 shows the joint framework.

5.2. Clustering-Loss Function

Following the deep embedded clustering (DEC) method in [23], a custom clustering layer is added after the CA-VAE encoder. The layer weights represent cluster-center vectors and are initialized using the optimal centers obtained by GWO-K-Means.
The clustering layer converts latent-space distance into similarity. It first calculates the Euclidean distance between each user’s latent representation and each cluster center, then converts the distance into a soft assignment probability using the Student t-distribution:
q i j = ( 1 + z i μ j 2 ) 1 / j = 1 K ( 1 + z i μ j 2 ) 1
where the latent-space feature vector of a user, the coordinate vector of a cluster center and the probability that the user belongs to a cluster are considered.
Soft assignment retains each sample’s probability of belonging to every cluster, which is useful for samples near cluster boundaries. The Student t-distribution is used instead of a Gaussian distribution because its heavier tails assign relatively greater probability to samples farther from a cluster center. This property provides more balanced assignments at moderate latent-space distances and reduces excessive concentration in a small number of high-density regions [23].
In addition to the soft assignment distribution q, the clustering loss requires an auxiliary target distribution. This target strengthens high-confidence assignments while suppressing ambiguous assignments near cluster boundaries and is defined as follows:
p i j = ( q i j 2 / f j ) / j ( q i j 2 / f j )
f j = i = 1 n q i j
where the auxiliary probability of a user belonging to a cluster is normalized by that cluster’s soft frequency across all samples, preventing large clusters from dominating the loss.
The auxiliary target distribution squares the soft assignment probabilities. This transformation increases the relative weight of high-confidence assignments and reduces the relative weight of low-confidence assignments, progressively sharpening the distribution and improving cluster discrimination.
The clustering loss is then defined as the KL divergence between the soft assignment distribution and the auxiliary target distribution:
L cluster = K L ( p q ) = ( 1 / n ) i = 1 n j = 1 K p i j ln ( p i j / q i j )
Minimizing this divergence guides the encoder toward latent-space features for which the soft assignment approaches the target distribution, promoting compactness within clusters and separation between clusters.

5.3. Joint Loss Function and Training Process

The CA-VAE reconstruction loss, latent-space KL regularization, and clustering loss are combined in the joint objective:
L = L recon + β L KL + γ L cluster
where reconstruction loss measures the difference between the decoder output and the original input, latent-space KL regularization constrains the posterior distribution, and clustering KL divergence optimizes cluster assignment. The two weighting coefficients balance latent-space regularization and clustering loss.
Training proceeds in two stages. CA-VAE is pretrained for 200 epochs, then jointly refined for 80 epochs using one fifth of the pretraining learning rate. A fixed-seed gamma sensitivity check over {0, 0.05, 0.10, 0.20} retained K = 5 in all conditions; gamma = 0.05 had the best SC and DBI in that representative check. The clustering-loss stage is therefore evaluated as a refinement mechanism, not presumed to improve every internal metric.
Joint training updates the encoder and decoder parameters without repeating GWO. For the representative seed-42 solution, the GWO-selected K is 5; in the repeated study, K remains a stochastic search outcome and all selected values are retained in the analysis.

5.4. Experimental Configuration and Reproducibility

Ten independent end-to-end runs used seeds 42–51. Each run used the same data size, architecture, K search range, and baseline settings. MATLAB R2023a Update 7 with Statistics and Machine Learning Toolbox and Deep Learning Toolbox was run on a MacBook Air with an Apple M5 10-core CPU, 16 GB memory, and macOS 26.5.1; gpuDeviceCount was zero. The complete workflow including evaluated baselines required 4123.3 (SD 334.5) s. Mean durations of pretraining, GWO search, and joint refinement were 2185.5, 313.6, and 1276.9 s, respectively.

6. Results and Discussion

The complete residential user clustering workflow is shown in Figure 4:
(1) Impute missing values, detect outliers, and normalize the raw CER records to obtain a cleaned input matrix;
(2) Pretrain CA-VAE on the processed electricity-use data for 200 epochs to obtain initial latent-space feature vectors;
(3) Apply adaptive GWO-K-Means in the latent space using 30 wolves and 80 iterations to determine K and the initial cluster-center vectors;
(4) Initialize the clustering layer with the GWO-K-Means solution and jointly train feature extraction and clustering for 80 epochs using clustering-loss feedback;
(5) Extract the final latent representation, assign users to cluster centers, and construct a profile for each cluster.

6.1. Training Behavior and Cluster Selection

For the representative seed-42 run, adaptive GWO selected K = 5. Supplementary Figure S2 separates the loss components so that the clustering loss can be inspected on its own scale, and Supplementary Figure S3 reports the retained global-best GWO fitness and its associated K trajectory. These optimization curves describe the representative run and are not a substitute for the repeated-run results. The training loss curves are shown in Figure 5.
The representative pretraining objective decreased and then stabilized. During joint refinement, the reconstruction, KL, and clustering-loss components remained finite. Loss curves describe numerical optimization behavior; they do not independently establish improved clustering quality.
Figure 6 shows the best fitness value observed during GWO optimization. Fitness increases rapidly within the first five iterations and stabilizes after approximately 10 iterations, indicating that the search converges well within the selected 80-iteration budget.
For each cluster, the mean load at every time point is used to construct a representative daily load curve. Boxplots summarize the corresponding distribution across users, including the median, quartiles, and dispersion [17]. Figure 7 presents the representative daily curves, and Figure 8 presents the distributional summaries and mean curves.
Figure 8 further compares the electricity-use distributions of the five clusters. In the upper row, the solid line denotes the mean, the dashed line denotes the median, the dark band denotes the 25–75% interquartile range (IQR), and the light band denotes plus or minus one standard deviation. The lower row presents boxplots at six representative times: 04:00, 08:00, 12:00, 16:00, 20:00, and 24:00.
Cluster 1 maintains low mean and median loads throughout the day and has a narrow IQR, indicating consistent low-load behavior. Cluster 2 has a similar curve shape but slightly higher afternoon and evening demand and a wider IQR. Clusters 1 and 2 therefore show relatively concentrated and regular electricity use. Cluster 3 exhibits high daytime demand and a wider distribution, reflecting greater variation in consumption and peak magnitude. Cluster 4 has high nighttime and early-morning loads that subsequently decline, a pattern that may correspond to thermal-storage heating or other nighttime operation. Cluster 5 remains low in the morning and rises gradually from afternoon to evening.
The boxplots are consistent with the patterns identified from the mean curves. Model training and clustering use normalized load curves; for engineering interpretation, Figure 7 and Figure 8 show inverse-normalized curves and boxplots in the original load units.

6.2. Residential Load Profiles and User-Profile Interpretation

For qualitative visualization [24], t-SNE projects the 16-dimensional latent representations from the representative seed-42 K = 5 run into two dimensions (Figure 9). The display uses fixed settings and illustrates the selected partition only; it is not used as quantitative evidence of cluster stability or global separation.
The t-SNE visualization in Figure 9 shows distinct structure among the learned representations. Clusters 3 and 4 occupy relatively isolated regions, consistent with their distinctive electricity-use patterns. Clusters 1 and 5 each form several dense subgroups with visible separation, while limited overlap occurs near the boundaries of Clusters 1, 2, and 5, whose load shapes are similar but differ in peak timing and load level.
Overall, the visualization shows greater proximity among users assigned to the same cluster than among users assigned to different clusters. This pattern supports the ability of CA-VAE latent features to represent differences in residential electricity use, while limited overlap remains among clusters with similar load shapes.
For each cluster, peak time, load factor (mean/peak), and peak-to-valley difference ratio ((peak-valley)/peak) are calculated. These indicators are combined with daily load-curve shape to define the user-profile labels reported in Table 1.
The five profiles differ in peak timing, load level, and curve shape. Cluster 1 is a low-load evening-peak profile; Cluster 2 is a medium-low-load broad evening-peak profile; Cluster 3 is a high-load daytime-peak profile; Cluster 4 is a high-load nighttime profile; and Cluster 5 is an evening-rising profile.
The profiles are interpretable in terms of electricity-use period, load level, and curve shape and therefore imply different load-regulation opportunities [25]. For example, Cluster 3 may respond to a noon peak tariff, Cluster 4 may be suited to valley-period incentives, and Clusters 1 and 5 may support evening peak-shaving programs. These differences can inform fine-grained demand-side management and differentiated tariff design.

6.3. Demand-Response Implications

The five profiles are behavioral user profiles derived from load curves, not observed demand-response actions or validated flexibility resources. Their peak timing, relative valley depth, and shape can be used to formulate candidate profile-specific participation measures for later field evaluation. Any such evaluation requires actual program participation, response events, tariff conditions, and absolute load information. Table 2 summarizes the profile-specific candidate demand-response measures.
(1) Candidate peak-shaving measure. Profiles with daytime or evening peaks may be prioritized for testing targeted price or incentive offers. This inference is based on load-shape characteristics and should not be interpreted as measured response.
(2) Candidate valley-period measure. Profiles with relatively high nighttime or low daytime demand may motivate future tests of valley-period offers, subject to customer acceptance and operational constraints.
(3) Candidate load-shifting measure. Evening-rising or evening-peak shapes may be useful for designing hypotheses about time-of-use offers. Their realized response cannot be inferred from the clustering result alone.
In summary, the profiles can support the formulation of targeted demand-response hypotheses. They should be regarded as candidate groups for future trials rather than as validated operational resources or estimates of dispatchable flexibility.

6.4. Comparative Performance and Ablation Analysis

The revised evaluation compares the final framework with raw K-Means, CA-VAE + K-Means, CA-VAE + PSO-K-Means, and CA-VAE + GMM. All methods are evaluated in the ten independent runs, and Table 3 reports mean and SD. The non-GWO baselines use fixed K = 5 for comparability, whereas the adaptive GWO workflow retains the K selected in each run. PSO uses the same latent features, population size, iteration budget, fitness definition, and local refinement budget as the fixed-K comparison.
(1) K-Means, applied directly to the normalized 48-dimensional data; (2) VAE-K-Means, which uses a conventional fully connected VAE without convolution or attention before K-Means clustering; and (3) VAE-GMM, which applies a Gaussian mixture model to features extracted by a conventional VAE. SC, DBI, and CH are used for evaluation. The non-GWO baselines use fixed K = 5, whereas adaptive GWO retains the K selected in each run; Table 3 reports the results.
Across ten paired runs, the final framework outperformed raw K-Means and CA-VAE + GMM on SC, DBI, and CH (exact paired Wilcoxon p = 0.001953 for each of these metric comparisons). It did not show a uniform internal-metric advantage over CA-VAE + K-Means, CA-VAE + PSO-K-Means, or the pre-joint GWO solution. These outcomes bound the performance claim to the comparisons supported by the data.
Table 4 summarizes the ablation and robustness checks. The attention and gamma checks are single-seed analyses and are labeled as such; the repeated-run pre-joint comparison is reported separately to avoid treating a representative run as a statistical conclusion.
The attention-free representative run selected K = 4 and had lower SC and higher DBI than the attention-enabled run, whereas CH was higher under the different K. The gamma sensitivity check retained K = 5 and showed small metric differences. In the ten-run comparison, joint refinement did not provide a uniform gain over the pre-joint GWO solution. We therefore describe attention and joint refinement as assessed components rather than universally beneficial modules.
The ten-run comparison does not support a blanket superiority claim for GWO over every alternative. GWO is retained because it searches K and initial centers jointly; its value is therefore assessed through the reported modal K = 5 solution, the controlled robustness checks, and the bounded comparisons in Table 3.
In the ten-run comparison, the pre-joint GWO solution had higher mean SC and lower mean DBI than the final joint-refined solution, while the final solution had a slightly higher mean CH (3694.3 versus 3688.8). The clustering-loss stage is consequently reported as a tested refinement rather than as a uniformly improving step.
The original PCA-K-Means statement is not retained as a central comparative claim in this revision. The repeated-run comparison instead reports raw K-Means, CA-VAE + K-Means, CA-VAE + PSO-K-Means, and CA-VAE + GMM, for which the scope of supported conclusions is stated in Table 3.
Overall, the repeated-run results support a limited conclusion: the final workflow is clearly better than raw K-Means and CA-VAE + GMM on the reported internal metrics, while comparisons with CA-VAE + K-Means, CA-VAE + PSO-K-Means, and the pre-joint GWO solution are mixed. The method contribution is the integrated and reproducibly evaluated workflow, not a claim of universal dominance by each component.

6.5. Limitations and Future Research

The present evidence has five important limitations. First, the framework is evaluated only on prepared CER average-day profiles, and external generalizability is not established. Second, aggregation suppresses day-level, seasonal, and weekday–weekend variation. Third, raw daily data were not available to re-evaluate imputation or outlier handling. Fourth, the repeated-run analysis indicates that profile stability varies, particularly for a small day-load profile. Fifth, demand-response implications are inferred from load shape rather than observed response events. The profiles should therefore be used for program screening and hypothesis design, not as direct estimates of dispatchable flexibility.
Future work should validate preprocessing alternatives on raw daily records, test the workflow on independent regional datasets and rolling time windows, assess scalability under larger deployments, and combine profile assignments with observed demand-response events. These steps are required before claims about operational flexibility or cross-region transferability can be made.

7. Conclusions

This study evaluates a residential user-profiling framework that combines CA-VAE representation learning, adaptive GWO-K-Means search, and clustering-loss refinement. The CER evidence supports the following bounded conclusions:
(1) The final framework outperformed raw K-Means and CA-VAE + GMM on the three internal clustering metrics across ten paired runs.
(2) GWO searched K and initial centers in the latent space. K = 5 was the modal result (6/10 runs) and was retained as the representative, interpretable solution rather than a unique optimum.
(3) Attention and clustering-loss refinement were assessed with bounded ablations. They did not establish a uniform improvement across all internal metrics, so the corresponding claims are limited accordingly.
(4) The resulting profiles provide load-shape-derived candidate groups for future demand-response design. They do not validate customer response, aggregate flexibility, or transferability beyond the CER setting.

Supplementary Materials

The following supporting information can be downloaded at: https://www.mdpi.com/article/10.3390/en19184430/s1. Table S1. K selected by adaptive GWO in ten end-to-end runs (seeds 42-51). K = 5 was selected in 6/10 runs, K = 6 in 2/10, and K = 9 in 2/10. Figure S1. Frequency of the K values selected in the ten independent end-to-end runs. Figure S2. Pretraining and joint-refinement loss components for the representative seed-42 run, plotted on separate vertical scales. Figure S3. Retained global-best GWO fitness and selected K trajectory for the representative seed-42 run. Table S2. Shape-correlation stability after matching each run to the representative seed-42 K = 5 profiles. The small day-load profile is less stable and is treated as a limitation in the manuscript. Figure S4. Distribution of matched profile-shape correlations across the ten runs. Table S3. Reproducibility and execution-time summary. Durations include the evaluated baseline flow where stated and are reported only for the hardware above.

Author Contributions

Conceptualization, J.W. and X.C.; methodology, H.Y. and X.C.; software, H.Y.; validation, H.Y. and X.D.; formal analysis, H.Y. and X.D.; investigation, J.W., M.C. and M.P.; resources, J.W., M.C. and M.P.; data curation, H.Y.; writing—original draft preparation, H.Y. and X.D.; writing—review and editing, X.C. and J.W.; visualization, H.Y.; supervision, X.C.; project administration, J.W. and X.C.; funding acquisition, J.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Hubei Power Trading Center Co., Ltd., under the project “Research on Demand Response Market Mechanisms Adapted to the Spot Market in 2025”, grant number SGDLFY00SCJS2500069.

Data Availability Statement

The CER smart-meter dataset is publicly available from the Commission for Energy Regulation smart metering project. The processed analysis inputs and MATLAB implementation used in this study are available from the corresponding author upon reasonable request, subject to the applicable data-use conditions.

Conflicts of Interest

The authors declare that this study received funding from Hubei Power Trading Center Co., Ltd. The funder had the following involvement with the study through its employee authors: conceptualization, investigation, provision of resources, manuscript review and editing, project administration, and funding acquisition. The specific contributions of Jing Wang, Meng Chen, and Mengfei Peng are detailed in the Author Contributions statement.

Abbreviations

ARI, adjusted Rand index; CA-VAE, convolutional attention variational autoencoder; CH, Calinski–Harabasz index; DBI, Davies–Bouldin index; DSM, demand-side management; GMM, Gaussian mixture model; GWO, gray wolf optimizer; PSO, particle swarm optimization; SC, silhouette coefficient.

References

  1. Lei, Y.; Sun, Z.; Ye, Z.; Wu, X. Research on non-intrusive monitoring methods for power system loads. Trans. China Electrotech. Soc. 2021, 36, 2288–2297. [Google Scholar] [CrossRef]
  2. Wang, Y.; Zhang, N.; Kang, C.; Xi, W.; Huo, M. Power consumer behavior model: Basic concepts and research framework. Trans. China Electrotech. Soc. 2019, 34, 2056–2068. [Google Scholar] [CrossRef]
  3. Tu, Q.; Miao, S.; Zhang, D.; Li, L.; Zhao, J. Rural photovoltaic trading mode based on price-based demand response in a distributed generation market environment. Trans. China Electrotech. Soc. 2020, 35, 4784–4797. [Google Scholar] [CrossRef]
  4. Kong, W.; Dong, Z.Y.; Jia, Y.; Hill, D.J.; Xu, Y.; Zhang, Y. Short-term residential load forecasting based on LSTM recurrent neural network. IEEE Trans. Smart Grid 2019, 10, 841–851. [Google Scholar] [CrossRef]
  5. Wang, S.; Du, X.; Yao, H.; Wang, F. Load curve clustering for multiple types of users. Power Syst. Technol. 2018, 42, 3401–3412. [Google Scholar] [CrossRef]
  6. Zhao, J.; Xia, X.; Liu, Z.; Xu, C.; Su, D.; Shan, X. Electricity feature selection and behavior profiling of power users. Power Syst. Technol. 2020, 44, 3488–3496. [Google Scholar] [CrossRef]
  7. Li, X.; Jiang, X.; Qian, J.; Chen, H.; Song, J.; Huang, L. Electricity industry classification and synthesis method based on users daily load curves. Autom. Electr. Power Syst. 2010, 34, 56–61. [Google Scholar]
  8. Xu, L.; Yang, X.; Zhang, M. Electricity consumption behavior analysis of industrial users based on data mining. Electr. Meas. Instrum. 2017, 54, 68–74. [Google Scholar]
  9. Yang, H.; Zhang, L.; He, Q.; Niu, Q. Research on power load classification based on adaptive fuzzy C-means algorithm. Power Syst. Prot. Control 2010, 38, 111–115+122. [Google Scholar]
  10. Jin, W.; Zhang, X.; Liu, S.; Huang, R.; Pan, B.; Lin, Z. Identification of industry typical load curves based on pruning strategy and density peak clustering. Autom. Electr. Power Syst. 2021, 45, 20–28. [Google Scholar]
  11. Wang, X.; Liu, J.; Liu, Y.; Xu, L.; Ma, T.; Xu, W. Typical load curve shape clustering algorithm using adaptive piecewise aggregate approximation. Autom. Electr. Power Syst. 2019, 43, 110–118. [Google Scholar]
  12. Zhou, D.; Zhang, H.; Zhou, H.; Hu, W. Non-intrusive load event detection method based on state feature clustering. Trans. China Electrotech. Soc. 2020, 35, 4565–4575. [Google Scholar] [CrossRef]
  13. Haben, S.; Singleton, C.; Grindrod, P. Analysis and clustering of residential customers energy behavioral demand using smart meter data. IEEE Trans. Smart Grid 2016, 7, 136–144. [Google Scholar] [CrossRef]
  14. Sun, Y.; Mao, Y.; Li, Z.; Zhang, X.; Li, F. Comprehensive clustering method for user load characteristics and adjustable potential oriented to power big data. Proc. Chin. Soc. Electr. Eng. 2021, 41, 6259–6271. [Google Scholar] [CrossRef]
  15. Zhang, B.; Zhuang, C.; Hu, J.; Chen, S.; Zhang, M.; Wang, K.; Zeng, R. Ensemble clustering algorithm for power load curves combined with dimensionality reduction technology. Proc. Chin. Soc. Electr. Eng. 2015, 35, 3741–3749. [Google Scholar] [CrossRef]
  16. Xu, C.; Chen, K.; Ma, J.; Liu, J.; Wu, J. Power load identification based on deep belief network. Trans. China Electrotech. Soc. 2019, 34, 4135–4142. [Google Scholar] [CrossRef]
  17. Xu, M.; Zhao, J.; Wang, X.; Xuan, Y.; Chen, B. Classification method of residential electricity consumption patterns based on a multitask joint model. Trans. China Electrotech. Soc. 2022, 37, 5490–5502. [Google Scholar] [CrossRef]
  18. Pang, C.; Yu, J.; Feng, C.; Liu, Y.; Jiang, Y. Power load clustering modeling and characteristic analysis based on LSTM autoencoder. Autom. Electr. Power Syst. 2020, 44, 57–63. [Google Scholar]
  19. Sarmas, E.; Fragkiadaki, A.; Marinakis, V. Explainable AI-Based Ensemble Clustering for Load Profiling and Demand Response. Energies 2024, 17, 5559. [Google Scholar] [CrossRef]
  20. Commission for Energy Regulation. CER Smart Metering Project. 2012. Available online: https://www.ucd.ie/issda/data/commissionforenergyregulationcer/ (accessed on 3 June 2026).
  21. Kingma, D.P.; Welling, M. Auto-encoding variational Bayes. arXiv 2013, arXiv:1312.6114. [Google Scholar]
  22. Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey wolf optimizer. Adv. Eng. Softw. 2014, 69, 46–61. [Google Scholar] [CrossRef]
  23. Xie, J.; Girshick, R.; Farhadi, A. Unsupervised deep embedding for clustering analysis. arXiv 2015, arXiv:1511.06335. [Google Scholar]
  24. Flexa, C.; Gomes, W.; Moreira, I.; Alves, R.; Sales, C. Polygonal coordinate system: Visualizing high-dimensional data using geometric dimensionality reduction and a deterministic version of t-SNE. Expert Syst. Appl. 2021, 175, 114741. [Google Scholar] [CrossRef]
  25. Wang, X.; Dong, S.; Wang, L.; Yu, Z.; Zhu, J. Identification of resident transferable loads based on appliance state association analysis. Trans. China Electrotech. Soc. 2020, 35, 4961–4970. [Google Scholar] [CrossRef]
Figure 1. Schematic diagram of the CA-VAE model.
Figure 1. Schematic diagram of the CA-VAE model.
Energies 19 04430 g001
Figure 2. Relationship between the number of clusters K and evaluation indices.
Figure 2. Relationship between the number of clusters K and evaluation indices.
Energies 19 04430 g002
Figure 3. Multi-index comprehensive score for different K values.
Figure 3. Multi-index comprehensive score for different K values.
Energies 19 04430 g003
Figure 4. Overall workflow for residential user classification.
Figure 4. Overall workflow for residential user classification.
Energies 19 04430 g004
Figure 5. Training loss curves.
Figure 5. Training loss curves.
Energies 19 04430 g005
Figure 6. GWO convergence curve.
Figure 6. GWO convergence curve.
Energies 19 04430 g006
Figure 7. Typical daily load curves of each cluster.
Figure 7. Typical daily load curves of each cluster.
Energies 19 04430 g007
Figure 8. Typical electricity-use boxplots and curves of each cluster. Colors identify Clusters 1–5: blue, orange, yellow, purple, and green, respectively. Upper panels: solid/dashed lines show mean/median; dark/light bands show the interquartile range/mean ± standard deviation. Lower panels show boxplots at the six indicated times.
Figure 8. Typical electricity-use boxplots and curves of each cluster. Colors identify Clusters 1–5: blue, orange, yellow, purple, and green, respectively. Upper panels: solid/dashed lines show mean/median; dark/light bands show the interquartile range/mean ± standard deviation. Lower panels show boxplots at the six indicated times.
Energies 19 04430 g008
Figure 9. t-SNE visualization of latent-space features.
Figure 9. t-SNE visualization of latent-space features.
Energies 19 04430 g009
Table 1. User-profile labels.
Table 1. User-profile labels.
ClusterProfileUsersPeak (h)Load FactorP-V RatioShapeFeature
C1Low-load evening peak228418.50.570.76Narrow peakShort evening use
C2Medium-low broad peak198718.50.660.74Broad peakSustained use
C3High-load daytime peak55811.50.540.75Day peakDaytime use
C4High-load nighttime peak961.00.540.74Night peakNight use
C5Evening-rising load146521.50.580.73Gradual riseLate-return use
Table 2. Demand-response potential analysis of each user cluster.
Table 2. Demand-response potential analysis of each user cluster.
ClusterProfileUsersPeak ShaveValley FillShiftWindowStrategy
C1Low-load evening peak2284Med.Med.HighEveningShift evening load
C2Medium-low broad peak1987LowLowLowEveningRoutine TOU
C3High-load daytime peak558HighLowMed.Noon/dayPeak pricing
C4High-load nighttime peak96LowHighLowNight valleyValley incentives
C5Evening-rising load1465Med.Med.Med.-HighEvening/nightOff-peak shifting
Table 3. Ten-run clustering comparison (mean (SD)).
Table 3. Ten-run clustering comparison (mean (SD)).
InterpretationCH, Mean (SD)DBI, Mean (SD)SC, Mean (SD)Method
Proposed final method3694.3 (260.5)0.8532 (0.0383)0.5002 (0.0314)Final CA-VAE + GWO-K-Means
Final method better on all metrics1147.7 (137.5)1.6358 (0.0796)0.2618 (0.0310)Raw K-Means
No uniform final-method advantage3720.9 (227.9)0.8607 (0.0610)0.5101 (0.0227)CA-VAE + K-Means
No GWO superiority claim at fixed K3705.6 (234.2)0.8329 (0.0365)0.5201 (0.0186)CA-VAE + PSO-K-Means
Final method better on all metrics1590.0 (270.2)1.3544 (0.3103)0.3279 (0.0439)CA-VAE + GMM
Table 4. Ablation and robustness checks.
Table 4. Ablation and robustness checks.
InterpretationCHDBISCAblation or Check
Joint stage has mixed outcome3688.8 (223.5)0.8222 (0.0187)0.5262 (0.0125)CA-VAE + GWO-K-Means, pre-joint (10 runs)
Repeated comparator; full results in Table 31590.0 (270.2)1.3544 (0.3103)0.3279 (0.0439)CA-VAE + GMM (10 runs)
K = 4; no uniform CH conclusion3735.60.98160.4473Attention off (seed 42)
K = 5 retained in both checks3393.3; 3459.00.8616; 0.84090.5219; 0.5353Gamma = 0.05; fitness weights 0.3/0.7 to 0.7/0.3 (seed 42)
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, J.; Chen, M.; Peng, M.; Cui, X.; Yang, H.; Dang, X. Residential Electricity-Use Profiling for Demand-Side Management Using a Convolutional Attention Variational Autoencoder and Adaptive GWO-K-Means Clustering. Energies 2026, 19, 4430. https://doi.org/10.3390/en19184430

AMA Style

Wang J, Chen M, Peng M, Cui X, Yang H, Dang X. Residential Electricity-Use Profiling for Demand-Side Management Using a Convolutional Attention Variational Autoencoder and Adaptive GWO-K-Means Clustering. Energies. 2026; 19(18):4430. https://doi.org/10.3390/en19184430

Chicago/Turabian Style

Wang, Jing, Meng Chen, Mengfei Peng, Xue Cui, Huangyi Yang, and Xuehan Dang. 2026. "Residential Electricity-Use Profiling for Demand-Side Management Using a Convolutional Attention Variational Autoencoder and Adaptive GWO-K-Means Clustering" Energies 19, no. 18: 4430. https://doi.org/10.3390/en19184430

APA Style

Wang, J., Chen, M., Peng, M., Cui, X., Yang, H., & Dang, X. (2026). Residential Electricity-Use Profiling for Demand-Side Management Using a Convolutional Attention Variational Autoencoder and Adaptive GWO-K-Means Clustering. Energies, 19(18), 4430. https://doi.org/10.3390/en19184430

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop