Figures
Abstract
Fine-grained load profiling is important for demand response and energy management in smart grids, yet supervised approaches remain constrained by the scarcity of high-quality labeled datasets. To address this limitation, we propose GridCL, a self-supervised contrastive learning framework for low-label load profiling in smart grids. GridCL forms paired daily-load views using conservative input perturbations—small temporal rolling, multiplicative perturbation, and energy renormalization—and combines them with a temporal convolutional encoder to learn discriminative representations from unlabeled data. Experiments on three anonymized city datasets and one pooled benchmark show that GridCL achieves strong clustering quality on the pooled AllCities benchmark, reaching ARI,
NMI, and
silhouette, while also attaining a best city-level ARI of
. Under sparse-label evaluation, GridCL reaches
accuracy on the pooled benchmark with only 10% labeled users, and remains stable at 20% and 30% labeled users with accuracies of
and
, respectively. These results indicate that GridCL provides an effective low-label solution for fine-grained load profiling in practical smart-grid settings.
Citation: Zhang L, Wang J, Zhang W, Li K, Yao D, Yang B, et al. (2026) GridCL for fine-grained load profiling in smart grids under limited labels. PLoS One 21(7): e0354752. https://doi.org/10.1371/journal.pone.0354752
Editor: Abel C. H. Chen, Chunghwa Telecom Co. Ltd., TAIWAN
Received: December 11, 2025; Accepted: July 10, 2026; Published: July 28, 2026
Copyright: © 2026 Zhang et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: All relevant data are within the manuscript and its Supporting Information files.
Funding: This research was funded by State Grid Sichuan Electric Power Corporation (Grant 521999240001). The funder provided support in the form of research funding and salaries for authors L.Z., J.W., W.Z., K.L., D.Y., B.Y., X.K., and H.Z., but did not have any additional role in the study design, data collection and analysis, decision to publish, or preparation of the manuscript. The specific roles of these authors are articulated in the author contributions section.
Competing interests: Authors Ling Zhang, Jia Wang, Wenhua Zhang, Ke Li, Daizhou Yao, Bowei Yang, Xingsi Ke, and Hong Zhao are employed by State Grid Sichuan Electric Power Corporation. This does not alter our adherence to PLOS ONE policies on sharing data and materials.
Introduction
Smart grids are evolving into data-driven cyber-physical systems, where Advanced Metering Infrastructure (AMI) generates terabytes of load data daily. This data holds immense value for load profiling, demand response (DR), and energy management. Nevertheless, a significant obstacle persists: The phenomenon of label scarcity has been observed. The process of annotating load profiles necessitates a high degree of expertise to discern user types (e.g., “Metal Smelting” versus “Precision Manufacturing”) or behaviors, which renders it impractical to scale due to its substantial expense and time-consuming nature.
Recent studies have demonstrated the efficacy of deep learning in load profiling; however, as indicated in comprehensive reviews, such as Huber’s [1], Ryu’s [2], and Omitaomu’s [3], the training of supervised models necessitates substantial amounts of labeled data exhibiting high variability to ensure effective generalization. However, acquiring such detailed annotations on a large scale is prohibitively expensive, leading to a bottleneck known as label scarcity. Unsupervised methods, such as K-means [4] and autoencoders (AE) [5], frequently encounter difficulties in capturing complex, high-level semantic patterns. In a similar vein, contemporary generative self-supervised methodologies, as exemplified by Ref. [6], prioritize the training of models to predict masked load values. These approaches predominantly emphasize local variations rather than global behavioral semantics. The objective of load profiling is to differentiate between user types based on macroscopic patterns (e.g., “two-shift industrial” versus “commercial cooling”). This necessitates a model that is both invariant to local noise and sensitive to global structure [7].
Recently, Self-Supervised Learning (SSL), particularly contrastive learning, has caused a paradigm shift in the field of computer vision by enabling the learning of representations from unlabeled data [8]. The central concept is to amalgamate disparate “views” of a given sample while distinguishing between different samples.
However, the direct application of generic SSL frameworks (e.g., SimCLR or MoCo) to power data is problematic because the constructed views must preserve user semantics and physical plausibility. Standard time-series perturbations (e.g., random jittering, scaling, permutation) frequently contravene the physical realities of power systems. For instance, while permutation is effective for wearable sensors (see reference [9]), it destroys the temporal causality essential for load forecasting. Simple scaling, on the other hand, ignores the saturation limits of appliances. A critical oversight in their modeling is the failure to account for grid-specific phenomena, such as demand response (DR) events, characterized by load shifts to off-peak hours, and the impact of weather conditions on energy systems. The relationship between cooling load and temperature is evident in this context.
In order to address this discrepancy and respond to the particular request for physically appropriate SSL design in power applications outlined in reference [1], we present GridCL, a grid-aware self-supervised contrastive learning framework specifically designed for smart-grid load profiling. The framework combines a TCN-based contrastive encoder with a conservative view-construction scheme tailored to the physical and operational priors of daily load curves. By introducing mild schedule shifts and amplitude perturbations while preserving total energy, GridCL learns representations that are robust to realistic nuisance variation yet still discriminative of intrinsic user behaviors.
The primary contributions of this paper are as follows:
- We design a physically consistent paired-view construction scheme for daily load curves based on temporal rolling, multiplicative perturbation, and energy renormalization, enabling contrastive learning without distorting user semantics.
- We develop a TCN-based contrastive learning framework incorporating an adaptive temperature mechanism and hard negative mining. This framework effectively extracts robust embeddings from unlabeled load curves.
- Extensive experiments on multiple real-world datasets demonstrate that the resulting contrastive representation significantly improves quality compared to generic SSL methods, enabling superior performance in downstream clustering and classification tasks.
Related work
Load profiling and clustering
Conventional load profiling methodologies employ clustering algorithms, such as K-means, hierarchical clustering, and fuzzy c-means, to analyze and organize data [4,10,11]. Despite their simplicity, these systems encounter challenges when confronted with high-dimensional data and non-linear patterns. Deep clustering methods, such as Deep Embedded Clustering (DEC) [12], integrate autoencoders with clustering objectives. However, these methods frequently encounter issues such as feature collapse or an overreliance on reconstruction rather than discrimination. More recently, advanced deep learning architectures including Transformers [13,14], Graph Neural Networks [15], and hybrid unsupervised frameworks [16,17] have been developed for time series analysis and anomaly detection, demonstrating the potential of learning robust temporal representations.
Self-supervised learning paradigms
The advent of self-supervised learning (SSL) has signaled a paradigm shift in the realm of data science, offering a novel approach to learning representations from unlabeled data. A categorization of these approaches reveals two primary classifications: generative and contrastive.
Generative SSL.
The primary objective of generative methods is to reconstruct the input data from a corrupted version or a latent variable. In the context of time series, this frequently entails masking segments of the sequence and training a model to predict the missing values (masked auto-modeling) or to forecast future outcomes. For instance, the S2p framework [6] adapts the BERT architecture to power load data, predicting the midpoint of a sliding window. While generative models are effective for low-level tasks such as NILM, where precise waveform recovery is essential, they often waste capacity, model high-frequency noise, and require careful handling of “stand-by” states to avoid over-estimation. Moreover, pixel-level (or point-level) fidelity is prioritized over high-level semantic discriminability, which is the primary objective of user profiling. Recently, foundation models for time series [18,19] and energy forecasting [20] have emerged, offering powerful generative capabilities, though often at high computational costs.
Contrastive SSL.
Contrastive learning (CL) is a data mining method that aims to learn an embedding space where similar sample pairs stay close while dissimilar ones are far apart.
In the domain of Computer Vision, pioneering works such as SimCLR [21] and MoCo have demonstrated the potential of instance discrimination to match the performance of supervised learning methods. Sabiri et al. [22] have recently reviewed the frontiers of contrastive pair learning, experimentally verifying its superiority over traditional categorization approaches across supervised, semi-supervised, and self-supervised settings. The key to their success was the design of strong augmentation strategies (e.g., color jitter, crop) that define “invariance.”
In the context of time series analysis, translating CL to time series is non-trivial due to the temporal dependency. TS2Vec [23] and TNC [24] introduced hierarchical contrastive learning and temporal neighborhood coding, respectively. Another notable work, TS-TCC [25], leverages temporal and contextual contrasting to learn robust representations. Recent advancements have focused on enhancing augmentation quality and multi-view consistency. InfoTS [26] and Chen et al. [6] introduce information-aware or self-supervised strategies to adaptively learn optimal representations. In the frequency domain, TF-C [27] and CoST [28] leverage time-frequency consistency and seasonal-trend disentanglement, respectively. More recently, TFCC [29] and Tang et al. [30] introduce multi-view frameworks that construct time-based (e.g., jittering, masking) and frequency-based (e.g., phase perturbation) augmentation families to preserve global semantic context. To further refine feature representations, Lee et al. [31] proposed a learnable masking augmentation framework that enhances the model’s capacity to discern complex temporal patterns. Similarly, Li et al. [32] introduced adaptive knowledge contrastive learning with dynamic attention, addressing data sparsity by expanding semantic associations, a concept relevant to learning from sparse user behaviors. However, most contrastive methods overlook the representation biases introduced by augmentation techniques, a problem recently highlighted as Data Augmentation Bias (DAB) by Zheng et al. [33], who proposed a bias-aware framework (DABaCLT) to minimize such disparities.
Physics-guided AI in smart grids
The integration of physical knowledge into data-driven models is a growing trend that is referred to as Physics-Guided AI. In the context of smart grids, this process assumes various forms. For instance, it may entail the incorporation of physical regularization terms within the loss function, as exemplified by Kirchhoff’s laws. Alternatively, it may involve the utilization of physics-based graph topologies, or the design of physics-informed architectures. The present study contributes to the field by incorporating physical constraints directly into the data generation process. In contrast to the conventional soft regularization penalty, our methodology incorporates the invariance to specific physical phenomena (e.g., demand response shifts) into the learning objective. This ensures that the learned representations are inherently robust to these authorized perturbations.
View construction for contrastive learning
For contrastive learning, the way positive views are constructed strongly influences which invariances are learned. In the general time-series domain, Iwana et al. provide a comprehensive taxonomy including jittering, permutation, and time warping [34], while Forestier et al. explored synthetic generation [35]. While these generic transformations are effective for tasks such as human activity recognition (HAR), they can be detrimental in cyber-physical systems where “invariance” must respect physical laws [9]. Recent research in nuclear physics [36] has similarly underscored that label-invariant transformations must be tailored to the specific physics of the domain (e.g., gamma spectroscopy) to be effective. For instance, random permutation destroys the causal structure of load demand, and unconstrained scaling violates the rated power of appliances. Recent reviews in smart grid analytics [1] underscore the paucity of systematic research on physically appropriate view construction as a significant impediment to the deployment of deep learning models. This paper addresses this gap through a conservative paired-view design tailored to daily load curves.
Methodology
Overview
The proposed GridCL framework is comprised of three modules: The first component is a view-construction step that forms paired daily-load observations while preserving behavioral semantics. The second component is a temporal encoder based on dilated convolutional neural networks (CNNs) and self-attention that extracts features. The third component is a contrastive optimization module that uses adaptive InfoNCE loss with hard-negative reweighting. The overall workflow is shown in Fig 1.
From input load curves to the contrastive objective.
Conservative view construction
Design Principles. In contrast to aggressive perturbations that may distort user semantics, GridCL adopts a conservative view-construction scheme aimed at preserving daily behavioral structure. Recent surveys have identified shifting and perturbation strategies as effective in time-series contrastive learning when they do not destroy temporal context [37]. The proposed framework therefore focuses on two stable operators: small temporal rolling to simulate mild schedule drift or alignment noise, and multiplicative Gaussian perturbation to improve robustness to amplitude fluctuation and metering noise. Each derived view is then energy-renormalized so that the global daily consumption level remains comparable to the original sample.
Mathematical Formulations. The view-construction operators used by GridCL are summarized below. Each transformation preserves the global daily load shape while introducing controlled local variation.
- Temporal Rolling. A short circular shift
is applied to simulate mild schedule drift or measurement misalignment:
(1)
- Multiplicative Perturbation. Metering noise and small amplitude fluctuation are modeled by multiplicative Gaussian perturbation:
(2)
- Energy Renormalization. To preserve the daily energy scale after view construction, the perturbed profile is rescaled:
(3)
Fig 2 provides qualitative examples of the resulting GridCL views.
The examples illustrate how temporal rolling, multiplicative perturbation, and energy renormalization generate conservative paired views while preserving the global daily load shape.
Temporal feature encoder
We employ a Temporal Convolutional Network (TCN) combined with a Self-Attention mechanism [38]. The TCN backbone utilizes dilated causal convolutions to capture long-range dependencies with a logarithmic increase in the receptive field. Formally, for a 1-D input sequence and a filter
, the dilated convolution operation F on element s is defined as:
where d is the dilation factor, k is the kernel size, and accounts for the direction of the past. We stack multiple residual blocks with exponentially increasing dilation rates
(for layer j) to ensure the receptive field covers the entire daily cycle.
Subsequent to the TCN, a Self-Attention Pooling layer is employed to aggregate the temporal features into a fixed-size representation vector h. The projection head g then maps h to a normalized 16-dimensional embedding space z. In this configuration, the TCN uses channel widths [32, 64] and the projector is a 64–64–16 MLP with ReLU activation. A comparison of projection-head variants is shown in Fig 3.
The results summarize the effect of alternative projection-head configurations used with the GridCL temporal encoder.
Contrastive optimization
We use the InfoNCE loss to maximize similarity between an anchor and its augmented view
(positive pair) while minimizing similarity with other samples (negatives).
In order to enhance robustness, a Hard Negative Mining strategy is hereby introduced [39]. Contrary to the conventional approach of contrastive learning, which treats all negatives in an identical manner, our methodology incorporates a more nuanced approach. In the self-supervised setting, semantic difference is not determined from class labels. Instead, every nonmatching instance in the current mini-batch is treated as a negative, and negatives that lie close to the anchor in the learned embedding space receive larger weights. This operational definition identifies difficult negatives without using label information. The weighting function is defined as follows:
where is the set of in-batch negative samples and
controls the concentration on hard negatives. This encourages the model to learn fine-grained discriminative features to distinguish between subtle load profile variations. GridCL uses in-batch negatives only and does not use a separate momentum memory bank or queue.
The resulting weighted contrastive objective is written as:
which makes explicit how the hard-negative weights in Eq. 6 modify the standard InfoNCE denominator in Eq. 5.
An Adaptive Temperature mechanism is also used where is represented as
. The parameter
is initialized from
and optimized jointly with the encoder and projection head by backpropagation under the same Adam optimizer. During training,
is clamped to [0.03,1.0] to avoid degenerate similarity scaling.
Theoretical analysis: Contrastive vs. generative
GridCL can also be interpreted as a consistency-learning approach for load profiling, because it trains the encoder to produce stable representations under perturbations that preserve user behavior. Huber et al. (2021) identified Consistency Learning as a promising future direction for NILM. GridCL instantiates this principle by explicitly treating the stable load-curve transformations used to form paired views (e.g., temporal rolling and multiplicative perturbation) as the set of “realistic perturbations” that are invariant to user identity. This approach enables the model to acquire robust representations despite the limited availability of labeled data.
Feature discriminability.
Generative models, such as the self-supervised framework based on S2P [6], optimize a reconstruction loss defined as follows:
where denotes the reconstructed value at time step t. This approach prompts the model to retain all the information necessary to reproduce the input, including background noise and trivial variations. Conversely, our proposed GridCL optimizes an InfoNCE loss that maximizes the mutual information between consistent views while suppressing nuisance factors introduced by realistic perturbations. This approach promotes the elimination of irrelevant fluctuations while preserving the semantic factors, including user behavior patterns, that remain stable across multiple views.
Computational complexity
As demonstrated by Chen et al. [6], Bi-GRU networks, despite having fewer parameters than S2p CNNs, often require more time for training due to their sequential nature. The TCN encoder has been shown to strike an optimal balance by leveraging dilated convolutions to achieve a large receptive field (comparable to that of S2p’s sliding window) while enabling parallel computation across time steps, a capability that distinguishes it from recurrent neural networks (RNNs). In particular, for an input sequence of length L and kernel size k, the complexity of the TCN layer is , whereas the complexity of self-attention is O(L2). Given that load profiles are typically down-sampled to hourly resolution (L = 24 or 168), the quadratic term is negligible, ensuring high training efficiency compared to sequential generative baselines.
In the context of real-time deployment in smart meters, efficiency assumes paramount importance. A comparison is made between the computational complexity of the proposed TCN-based encoder and that of recurrent neural networks (RNNs) and transformer-based architectures (e.g., Informer). The input sequence length is denoted by L, the embedding dimension by D, and the kernel size by K.
- Recurrent Networks (GRU/LSTM): Complexity is
. While efficient in memory, they suffer from sequential dependency, preventing parallelization. Training time scales linearly with L.
- Transformers: Standard self-attention has a complexity of
, which becomes prohibitive for high-resolution load data (e.g., 1-minute intervals).
- Proposed TCN: Our dilated convolution layers have a complexity of
. Crucially, convolutions are fully parallelizable. The receptive field grows exponentially (
), allowing us to capture global context with only
layers.
Table 1 compares the parameter count and training speed (samples/second) on the pooled AllCities benchmark. GridCL achieves a speedup over the S2p (Bi-GRU) baseline while maintaining a comparable model size.
Because TS2Vec also uses dilated convolutional components, the architectural difference is not merely the presence of dilation. GridCL differs by applying a TCN-plus-attention encoder to full daily load profiles, using a compact 16-dimensional projection head for load-profiling embeddings, and constructing positive pairs through grid-consistent perturbations rather than generic temporal cropping.
Theoretical justification
We provide a theoretical grounding for GridCL based on the Information Bottleneck principle. The goal of contrastive learning is to maximize the mutual information I(X; Z) between the input X and representation Z, while minimizing the information about nuisance factors.
The InfoNCE loss is known to be a lower bound on the mutual information:
where N is the number of negative samples. By introducing a physically constrained transformation family for view construction, we define the positive distribution
as samples generated from the same underlying user behavior u but perturbed within grid-consistent limits by
. Minimizing
is equivalent to maximizing the mutual information between views
.
According to the “Alignment and Uniformity” theory proposed by Wang and Isola [40], perfect loss minimization implies:
- Alignment:
. Our encoder learns to be invariant to the conservative transformations in
.
- Uniformity: Feature vectors should be uniformly distributed on the hypersphere. Our Hard Negative Mining explicitly enforces this by pushing away nearby nonmatching instances, preventing feature collapse.
Thus, GridCL learns a representation that preserves user-identity information (the “signal”) while discarding nuisance variations introduced during paired-view construction (the “noise”), which corresponds to the ideal Information Bottleneck solution for load profiling.
Experiments
Experimental setup
Datasets and preprocessing.
We evaluate the framework on three anonymized city-level datasets, denoted as City-A, City-B, and City-C, together with a pooled benchmark constructed by concatenating all users across the three cities. The city and institutional identifiers are withheld from the public manuscript and code package to avoid disclosing restricted utility-data provenance, while the user counts and preprocessing interface are reported for reproducibility. The preprocessing pipeline operates on user-level daily load profiles and user metadata. For each user, we aggregate the mean 24-hour profile, the per-hour standard deviation, and 13 time-of-use (TOU) descriptors, including valley, daytime, evening, seasonal-peak, and event-related statistics. Table 2 summarizes the number of users in each scope used by the experiments.
Evaluation metrics.
We evaluate representation quality by performing K-means clustering (K = 5 for mixed dataset) on the learned embeddings. We employ three standard metrics:
- Adjusted Rand Index (ARI). This metric measures the similarity between clustering results, adjusted for chance:
(10)
whereis the count of samples in both cluster i and class j,
is the size of cluster i, and
is the size of class j.
- Normalized Mutual Information (NMI). This is a normalized version of the mutual information score:
(11)
whereand
denotes the entropy.
- Silhouette Coefficient (SC). This metric evaluates cohesion and separation among clusters:
(12)
where a(i) is the mean intra-cluster distance for sample i, and b(i) is the mean nearest-cluster distance.
Implementation details.
All experiments were implemented in PyTorch. The classical representation benchmarks were evaluated across five random seeds {7, 13, 29, 43, 71}, while the neural SSL comparisons used three seeds {7, 13, 29}. Unless otherwise stated, we report mean ± standard deviation over the corresponding runs. The main implementation settings of GridCL are summarized in Table 3.
Performance comparison
We compare GridCL against both classical feature representations and recent self-supervised time-series encoders. The classical comparisons include Raw24, Raw48, FFT10, TOU13, and the PCA-fused Fusion16 representation used in the experiments. To address the editor’s request for more recent baselines, we additionally implemented controlled reference versions of three modern SSL paradigms:
- MOMENT16: a patch-based transformer masked-modeling encoder.
- Series2Vec16: a dual-view temporal-frequency representation learner.
- TSDE16: a diffusion-style denoising embedding model.
Table 4 reports the clustering quality on the pooled AllCities benchmark. The recent SSL baselines are in-house reimplementations designed to provide controlled comparisons under the same data interface, random seeds, and evaluation pipeline.
The pooled benchmark is challenging because it mixes heterogeneous user behaviors from multiple cities. GridCL_TCN16 achieves ARI,
NMI, and
silhouette on AllCities, exceeding the compared classical and recent SSL baselines in this controlled pooled setting. On the city-specific scopes, the same configuration yields
ARI on City-A,
on City-B, and
on City-C, indicating that the selected training configuration remains competitive across heterogeneous user groups.
Ablation study: Impact of feature blocks
To better understand which information blocks are responsible for the observed gains, we conducted an ablation study over the feature groups used by the comparison code: Raw48 (mean + standard deviation), FFT10, TOU13, and their combinations.
As shown in Fig 4, the ablation results reveal a scope-dependent pattern rather than a single universally optimal block. On the pooled AllCities benchmark, the best variant is Raw48 + TOU13 with ARI , outperforming Raw48Only (
) and FullFusion16
. On City-A, the best configuration is Raw48 + FFT10 (
); on City-B, TOU13Only performs best (
); and on City-C, Raw48Only remains the strongest variant (
). These results indicate that frequency, TOU, and amplitude-related descriptors contribute differently across residential-like, commercial-like, and industrial-like user groups.
Transferability analysis
A key advantage of representation learning is the ability to transfer across cities with different load characteristics. We therefore evaluated cross-city transfer on all ordered source-target pairs using the 16-dimensional fused representation. For each pair, we form a 70/30 stratified split on the target city and use only 10% of the target training users as labeled anchors.
The transfer results show that cross-city adaptation is strongly pair-dependent. When transferring from City-A to City-B, the TransferPlus10pct strategy achieves target accuracy with 36 labeled target users. For City-B to City-C, the corresponding accuracy is
with 46 labeled target users. Transfer from City-C to City-A is the most stable case, where the performance drop relative to the source-domain reference is only
%. The corresponding strategies are summarized as follows:
- SourceOnly: train a nearest-centroid classifier on the source representation and test directly on the target.
- Target10pct: train using only the 10% labeled target subset.
- TransferPlus10pct: concatenate the source users with the 10% labeled target users and classify the target test users in the shared space.
Hyperparameter sensitivity analysis
The robustness of the fused representation also depends on the dimensionality selected after PCA compression. We therefore evaluate the sensitivity of the fused representation to the projection dimension .
Table 5 shows that the sensitivity pattern is scope-dependent. On the pooled AllCities benchmark, the best dimension is d = 16, yielding ARI . For the three individual city benchmarks, smaller projections are preferable: City-A peaks at d = 8 with ARI
, City-B peaks at d = 4 with ARI
, and City-C peaks at d = 8 with ARI
. Increasing the dimension beyond 24 generally degrades performance, suggesting that over-complete fused spaces retain nuisance variation and reduce cluster compactness. Fig 5 provides an additional convergence comparison under a longer reference training schedule.
The curves compare optimization behavior across representative GridCL training configurations.
Semi-supervised classification
To verify the label efficiency of the learned representations, we conduct a semi-supervised probe experiment using label ratios of 1%, 5%, 10%, 20%, 50%, and 100%. We first create a stratified 70/30 train-test split and then train a nearest-centroid probe on the labeled subset of the training users. This protocol is applied consistently to both the fused handcrafted representations and the neural SSL encoders.
Fig 6 summarizes the label-efficiency behavior across the pooled AllCities benchmark and the three city-level scopes.
- Pooled benchmark: with GridCL_TCN, 10% labeled users (138 users on average after the stratified split) already yield
accuracy and
macro-F1.
- Robustness across label ratios: keeping the pooled AllCities setting fixed, performance remains stable when the labeled-user ratio increases to 20% and 30%, reaching
and
accuracy, respectively, with corresponding macro-F1 scores of
and
. This pattern indicates that GridCL already captures most of the discriminative structure in the low-label regime.
- City-level behavior: with only 10% labeled users, GridCL_TCN reaches
accuracy on City-A,
on City-B, and
on City-C. These results confirm that the learned representation remains separable under low-label conditions.
The curves summarize GridCL performance across the pooled benchmark and the three city-level scopes.
Interpretability & visualization
Attention-weight profile.
Beyond clustering metrics, qualitative inspection of the learned temporal emphasis is useful for utility operators. We visualize the mean self-attention weights of a representative pooled GridCL run. Specifically, we use the AllCities model corresponding to the strongest pooled clustering result among seeds {7,13,29}, namely seed 29.
Fig 7 shows that the representative GridCL model concentrates progressively more weight on the late-day segment, with the strongest emphasis appearing from the evening peak into the final hours of the daily profile. Early-morning baseload periods receive substantially lower attention. This behavior is consistent with the intuition that inter-user differentiation becomes more pronounced when daily activity patterns diverge during higher-demand periods.
The curve reports normalized average attention weights across all users in the AllCities run with seed 29.
Embedding space visualization.
To intuitively assess the quality of learned representations, we compare a 2D PCA projection of raw normalized daily summaries with the corresponding GridCL embeddings from the same representative pooled run. PCA is used to keep the projection deterministic and directly comparable across the raw-summary and GridCL spaces. The visualization is shown in Fig 8.
Panel (a) shows raw normalized daily summaries, while panel (b) shows GridCL embeddings from the AllCities run with seed 29. Colors indicate anonymized pattern labels (Pattern A–H).
The visualization demonstrates clear qualitative structure:
- Compactness: Several pattern groups become visibly tighter in the GridCL space than in the raw-summary projection.
- Separation: Multiple anonymized pattern regions show clearer boundaries after representation learning, which is consistent with the ARI/NMI gains reported in Table 4.
- Global structure: The pooled embedding preserves large-scale organization across heterogeneous users rather than collapsing into an undifferentiated cloud.
Taken together, these qualitative patterns support the quantitative gains in Table 4 by showing that the learned GridCL representation yields clearer large-scale organization than the raw daily summaries in a representative pooled run.
Implications for privacy protection and edge offloading.
The proposed GridCL framework demonstrates significant potential in the field of privacy-preserving smart-grid analysis. This model can learn from unlabeled data, thereby eliminating the need to upload sensitive user metadata—such as ‘family size’ or ‘appliance inventory’—to the cloud for supervised learning. In addition, the lightweight TCN architecture facilitates deployment on the edge.
The pre-trained encoder can be deployed on data aggregators or on high-end smart counters, enabling high-density local device inference (D = 16). Research confirms that transmitting embedded vectors instead of high-frequency raw data reduces bandwidth consumption by more than a factor of ten. At the same time, this approach provides an additional layer of obfuscation protection against direct load-monitoring attacks.
Limitations and future work
Although robust, the method relies on extended operations that only cover the majority of “effective” fluctuations. When cases outside the distribution occur (e.g., residential load shifting to daytime hours during pandemic lockdowns), recalibration of the fixed perturbation library may be required. In future work, we will explore the potential for AutoAugment to dynamically derive optimal perturbation strategies from data. Furthermore, there is promise in extending this framework to multimodal data (e.g., load coupled with voltage/frequency logs) to enhance fault detection capabilities.
Conclusions
In this paper, GridCL is introduced—a new self-supervised load modeling framework. By combining contrastive representation learning with conservative paired-view construction, this method achieves strong representation quality on the revised benchmark. This approach effectively addresses the misalignment of labeled data, providing utility companies with powerful tools to analyze large datasets from smart meters to meet the demands of new energy internet applications.
Supporting information
S1 File. Data augmentation implementation.
The S1_File_augmentations.py file contains the load-profile augmentation methods used by the supplementary implementation.
https://doi.org/10.1371/journal.pone.0354752.s001
(PY)
S2 File. Demonstration and training script.
The S2_File_main_demo.py file provides a minimal example for loading the sample data, constructing the model, and running contrastive pre-training.
https://doi.org/10.1371/journal.pone.0354752.s002
(PY)
S3 File. Model implementation.
The S3_File_models.py file contains the temporal convolutional encoder and related model components used by the supplementary implementation.
https://doi.org/10.1371/journal.pone.0354752.s003
(PY)
S4 File. Software requirements.
The S4_File_requirements.txt file lists the Python package dependencies required to run the supplementary code.
https://doi.org/10.1371/journal.pone.0354752.s004
(TXT)
S5 File. Sample load data.
The S5_File_sample_load_data.csv file contains anonymized sample load-profile data for demonstrating the supplementary code.
https://doi.org/10.1371/journal.pone.0354752.s005
(CSV)
References
- 1. Huber P, Calatroni A, Rumsch A, Paice A. Review on Deep Neural Networks Applied to Low-Frequency NILM. Energies. 2021;14(9):2390.
- 2. Ryu S, Noh J, Kim H. Deep Neural Network Based Demand Side Short Term Load Forecasting. Energies. 2017;10(1):3.
- 3. Omitaomu OA, Niu H. Artificial Intelligence Techniques in Smart Grid: A Survey. Smart Cities. 2021;4(2):548–68.
- 4. Chicco G. Overview and performance assessment of the clustering methods for electrical load pattern grouping. Energy. 2012;42(1):68–80.
- 5.
Kong X, et al. Deep Learning for Time Series Forecasting: A Survey. arXiv preprint arXiv:250310198. 2025.
- 6. Chen S, Zhao B, Zhong M, Luan W, Yu Y. Nonintrusive Load Monitoring Based on Self-Supervised Learning. IEEE Trans Instrum Meas. 2023;72:1–13.
- 7.
Hendrycks D, Mazeika M, Kadavath S, Song D. Using self-supervised learning can improve model robustness and uncertainty. arXiv preprint arXiv:190612340. 2019.
- 8. Jing L, Tian Y. Self-Supervised Visual Feature Learning With Deep Neural Networks: A Survey. IEEE Trans Pattern Anal Mach Intell. 2020;43(11):4037–58. pmid:32386141
- 9.
Um TT, Pfister FMJ, Pichler D, Endo S, Lang M, Hirche S, et al. Data augmentation of wearable sensor data for parkinson’s disease monitoring using convolutional neural networks. In: Proceedings of the 19th ACM International Conference on Multimodal Interaction. 2017. p. 216–20.
- 10. 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(1):136–44.
- 11. Wang Y, Chen Q, Hong T, Kang C. Efficient and robust customer segmentation method for large-scale smart meter data. IEEE Trans Power Syst. 2018;33(6):5698–707.
- 12.
Xie J, Girshick R, Farhadi A. Unsupervised deep embedding for clustering analysis. In: International conference on machine learning. 2016. p. 478–87.
- 13. Tuli S, Casale G, Jennings NR. TranAD: Deep Transformer Networks for Anomaly Detection in Multivariate Time Series Data. Proc VLDB Endowment. 2022;15(6):1201–14.
- 14.
Zhou T, Ma Z, Wen Q, Wang X, Sun L, Jin R. FEDformer: Frequency Enhanced Decomposed Transformer for Long-term Series Forecasting. In: Proceedings of the 39th International Conference on Machine Learning. PMLR; 2022. p. 27268–86.
- 15. Deng A, Hooi B. Graph Neural Network-Based Anomaly Detection in Multivariate Time Series. AAAI. 2021;35(5):4027–35.
- 16.
Audibert J, Michiardi P, Guyard F, Marti S, Zuluaga MA. USAD: Unsupervised Anomaly Detection on Multivariate Time Series. In: Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 2020. p. 3395–404.
- 17. Xu H, Wang Y, Jian S, Liao Q, Wang Y, Pang G. Calibrated One-Class Classification for Unsupervised Time Series Anomaly Detection. IEEE Trans Knowl Data Eng. 2024;36(11):5723–36.
- 18.
Ansari AF, Stella L, Turkmen C, Zhang X, Mercado P, Shen H, et al. Chronos: Learning the Language of Time Series. arXiv preprint arXiv:240307815. 2024.
- 19.
Das A, Kong W, Leach A, Mathur S, Sen R, Yu R. A decoder-only foundation model for time-series forecasting. In: International Conference on Machine Learning. PMLR; 2024. p. 10035–62.
- 20.
Ferdaus MM, Dam T, Sarkar MR, Uddin M, Sreenatha G. Foundation Models for Clean Energy Forecasting: A Comprehensive Review. arXiv preprint arXiv:250723147. 2025.
- 21.
Chen T, Kornblith S, Norouzi M, Hinton G. A simple framework for contrastive learning of visual representations. In: International conference on machine learning, 2020. 1597–607.
- 22. Sabiri B, Khtira A, El Asri B, Rhanoui M. Investigating Contrastive Pair Learning’s Frontiers in Supervised, Semisupervised, and Self-Supervised Learning. J Imaging. 2024;10(8):196. pmid:39194985
- 23. Yue Z, Wang Y, Duan J, Yang T, Huang C, Tong Y, et al. Ts2vec: Towards Universal Representation of Time Series. AAAI. 2022;36(8):8980–7.
- 24.
Tonekaboni S, Eytan D, Goldenberg A. Unsupervised Representation Learning for Time Series with Temporal Neighborhood Coding. In: International Conference on Learning Representations. 2021.
- 25.
Eldele E, Ragab M, Chen Z, Wu M, Kwoh CK, Li X, et al. Time-Series Representation Learning via Temporal and Contextual Contrasting. In: Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI-21. 2021. p. 2352–9.
- 26. Luo D, Cheng W, Wang Y, Xu D, Ni J, Yu W, et al. Time Series Contrastive Learning with Information-Aware Augmentations. AAAI. 2023;37(4):4534–42.
- 27.
Zhang X, Zhao Z, Tsiligkaridis T, Zitnik M. Self-Supervised Contrastive Pre-Training for Time Series Via Time-Frequency Consistency. In: Advances in Neural Information Processing Systems. vol. 35. 2022. p. 3988–4003.
- 28.
Woo G, Liu C, Sahoo D, Kumar A, Hoi S. CoST: Contrastive learning of disentangled seasonal-trend representations for time series forecasting. In: International Conference on Learning Representations. 2022.
- 29.
Wu Y, Meng X, He Y, Zhang J, Zhang H, Dong Y, et al. Multi-view Self-Supervised Contrastive Learning for Multivariate Time Series. In: Proceedings of the 32nd ACM International Conference on Multimedia. 2024. p. 9582–90.
- 30.
Tang L, Wang Z, He G, Wang R, Nie F. Perturbation Guiding Contrastive Representation Learning for Time Series Anomaly Detection. In: Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence (IJCAI-24). 2024. p. 4955–63.
- 31. Lee J, Ham I, Kim Y, Ko H. Time-Series Representation Feature Refinement with a Learnable Masking Augmentation Framework in Contrastive Learning. Sensors (Basel). 2024;24(24):7932. pmid:39771671
- 32. Li H, Zheng J, Jin B, Zhu H. Adaptive Knowledge Contrastive Learning with Dynamic Attention for Recommender Systems. Electronics. 2024;13(18):3594.
- 33. Zheng Y, Luo Y, Shao H, Zhang L, Li L. DABaCLT: A Data Augmentation Bias-Aware Contrastive Learning Framework for Time Series Representation. Appl Sci. 2023;13(13):7908.
- 34. Iwana BK, Uchida S. An empirical survey of data augmentation for time series classification with neural networks. PLoS One. 2021;16(7):e0254841. pmid:34264999
- 35.
Forestier G, Petitjean F, Dau HA, Webb GI, Keogh E. Generating synthetic time series to augment sparse datasets. In: 2017 IEEE International Conference on Data Mining (ICDM). IEEE; 2017. p. 865–70.
- 36. Stomps JR, Wilson PPH, Dayman KJ. Contrastive Machine Learning with Gamma Spectroscopy Data Augmentations for Detecting Shielded Radiological Material Transfers. Mathematics. 2024;12(16):2518.
- 37.
Le Guennec A, Malinowski S, Tavenard R. Data augmentation for time series classification using convolutional neural networks. In: ECML/PKDD workshop on advanced analytics and learning on temporal data. 2016.
- 38.
Bai S, Kolter JZ, Koltun V. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:180301271. 2018.
- 39.
Robinson J, Chuang CY, Sra S, Jegelka S. Contrastive learning with hard negative samples. In: International Conference on Learning Representations. 2021.
- 40.
Wang T, Isola P. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In: International Conference on Machine Learning. PMLR; 2020. p. 9929–39.