Electricity consumption load pattern recognition method and device based on bayesian variational inference
By establishing a Gaussian regression mixture model using the Bayesian variational inference method, the shortcomings of temporal correlation and computational efficiency in electricity load pattern recognition are addressed. This enables efficient and accurate clustering analysis of massive electricity consumption data, improving the accuracy and interpretability of the clustering results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN POWEROAK NEWENER CO LTD
- Filing Date
- 2026-07-02
- Publication Date
- 2026-07-31
AI Technical Summary
Existing methods for identifying electricity load patterns are insufficient in handling time-series correlations and in terms of computational efficiency for large-scale data. Traditional methods are unable to meet the timeliness requirements for analyzing high-frequency data collected by smart meters.
A Gaussian regression mixture model is established using a Bayesian variational inference method. The temporal correlation of electricity consumption behavior is characterized by B-spline basis functions and Gaussian processes. The model parameters are optimized using the Bayesian variational inference algorithm to achieve efficient and accurate clustering analysis of massive electricity consumption data.
It significantly improves the physical interpretability and accuracy of clustering results, enables accurate modeling of the temporal correlation of electricity consumption behavior, and completes efficient clustering analysis of massive electricity consumption data within an acceptable timeframe.
Smart Images

Figure CN122490132A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of power user behavior analysis technology, specifically relating to a method for identifying power load patterns based on Bayesian variational inference, electronic equipment, and storage medium. Background Technology
[0002] Pattern recognition of electricity load is of great significance for grid dispatching, refined operation of the power system, optimal configuration of energy storage devices, and optimization of user services. On the one hand, by identifying and grouping user electricity load patterns, power suppliers or energy storage product manufacturers can gain a deeper understanding of the load characteristics and needs of different types of customers, thereby customizing more suitable energy storage solutions or electricity pricing packages for them. On the other hand, unlike building a single prediction model for all users, building separate electricity consumption prediction models for each type of user based on clustering results can effectively improve the model's characterization ability and prediction accuracy, providing a more reliable basis for load management, grid dispatching, and demand-side response.
[0003] Currently, in the field of electricity load pattern recognition, classical distance-based clustering algorithms or probabilistic model clustering methods designed directly for time series are commonly used. However, distance-based methods typically assume that the data are independent and identically distributed, failing to fully consider the inherent temporal correlation and sequential dependence of electricity consumption data as a time series. This results in insufficient ability to characterize dynamic time series patterns and sensitivity to data noise. While probabilistic model clustering methods can model temporal dependencies, their parameter estimation process often involves complex integral calculations. When faced with large-scale, high-dimensional time series data generated by high-frequency acquisition from smart meters, the computational efficiency is insufficient to meet the timeliness requirements of analysis in practical applications, and the scalability is poor.
[0004] Therefore, there is an urgent need for a power load pattern recognition scheme that can simultaneously balance the accuracy of time-series correlation modeling and the efficiency of large-scale data computation. Summary of the Invention
[0005] This application provides a method, electronic device, and storage medium for identifying electricity load patterns based on Bayesian variational inference, aiming to overcome the shortcomings of existing electricity load clustering analysis methods in handling temporal correlation, data noise, and computational efficiency, and to achieve efficient and accurate clustering analysis of massive electricity data.
[0006] In a first aspect, embodiments of this application provide a method for identifying electricity load patterns based on Bayesian variational inference, the method comprising: Step S1: Obtain the total active power time series of the user and perform preprocessing to obtain the preprocessed power time series; Step S2: Establish a Gaussian regression mixture model. In the Gaussian regression mixture model, the power time series is represented by a main trend term consisting of a linear combination of B-spline basis functions plus a random error term following a Gaussian process. The covariance function of the Gaussian process is used to characterize the temporal correlation between the electricity consumption of the same user at different time points. Step S3: The parameters of the Gaussian regression mixture model are estimated using the Bayesian variational inference algorithm. The variational distribution and the temporal correlation parameters in the covariance function are updated iteratively by maximizing the lower bound of evidence. Step S4: Determine the electricity load category of each user based on the estimation results of the Bayesian variational inference algorithm.
[0007] Optionally, the preprocessing in step S1 includes: Perform a natural logarithmic transformation on each total active power in the total active power time series, and standardize its time axis to a preset interval.
[0008] Optionally, the B-spline basis function is a cubic B-spline basis function.
[0009] Optionally, the mean of the Gaussian process is 0, and the covariance matrix is... ,in, For the error variance, This is the correlation matrix.
[0010] Optionally, the correlation matrix is determined by the following covariance function:
[0011] in, , is the time-series correlation parameter, and These are two different points in time.
[0012] Optionally, step S3 specifically includes: Step S31: Fix the time-series correlation parameters, and update the variational posterior distribution of the mixed weights, the variational posterior distribution of each user category, the variational posterior distribution of the basis function coefficients of each category, and the variational posterior distribution of the error variance of the Gaussian process sequentially by minimizing the KL divergence. Step S32: Fix the variational posterior distributions obtained in step S31, and update the estimated values of the time-series correlation parameters by maximizing the lower bound of evidence; Step S33: Repeat steps S31 and S32 until the change in the lower bound of evidence is less than the preset threshold.
[0013] Optionally, the prior distribution of the mixed weights adopts a Dirichlet distribution, the prior distribution of the basis function coefficients adopts a multivariate normal distribution, and the prior distribution of the error variance adopts an inverse gamma distribution.
[0014] Optionally, the method further includes: Pre-set a candidate set of cluster counts containing multiple positive integer values; Based on each candidate value for the number of clusters, steps S2 and S30 are executed to obtain the posterior distribution that satisfies the convergence termination condition, and the deviation information criterion value is calculated based on the posterior distribution. The candidate value of the number of clusters that minimizes the deviation information criterion value is selected as the optimal number of clusters. From the posterior probabilities of each user category estimated based on the optimal number of clusters, the electricity load category corresponding to the highest posterior probability is selected as the user's final category.
[0015] Secondly, embodiments of this application provide an electronic device, including at least one processor and a memory communicatively connected to the at least one processor. The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform any of the methods described above.
[0016] Thirdly, embodiments of this application provide a computer storage medium storing instructions or programs that, when executed by at least one processor, cause the at least one processor to perform any of the methods described above.
[0017] This application provides a method for identifying electricity load patterns based on Bayesian variational inference, which has the following advantages: First, a Gaussian regression mixture model of power time series is established. On the one hand, by using B-spline basis functions to smooth the power curve in the Gaussian regression mixture model, common abnormal records and noise interference in smart meter data are effectively suppressed, improving the robustness to data noise. On the other hand, by introducing a Gaussian process as a random error term into the Gaussian regression mixture model, a specific covariance function is used to explicitly characterize the correlation between the electricity consumption of the same user at different time points, compared with the traditional method that ignores time series... The structural clustering method ensures at the model level that the clustering algorithm can identify user groups based on dynamic behavioral patterns, significantly improving the physical interpretability and accuracy of the clustering results and achieving accurate modeling of the temporal correlation of electricity consumption behavior. Secondly, a dedicated Bayesian variational inference algorithm is designed to transform the complex posterior distribution approximation problem into an evidence lower bound maximization optimization problem, avoiding the dimensionality curse of traditional Markov chain Monte Carlo (MCMC) methods under high-dimensional time series data. This makes it possible to complete the clustering analysis of massive minute-level electricity meter data within an acceptable time, achieving efficient and accurate clustering analysis of massive electricity consumption data. Attached Figure Description
[0018] Figure 1 A flowchart of a method for identifying electricity load patterns based on Bayesian variational inference provided in an embodiment of this application; Figure 2 A detailed flowchart of step S1 provided in the embodiments of this application; Figure 3 A detailed flowchart of step S3 provided in the embodiments of this application; Figure 4 A flowchart illustrating the method for adaptively determining the optimal number of clusters provided in this application embodiment; Figure 5 A schematic diagram illustrating the entire process of comprehensive analysis of electricity consumption data provided in the embodiments of this application; Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] The technical terms used in this application are explained below: 1. Total Active Power: This is the power component in an AC circuit that is actually used to do work (such as heating, lighting, and driving machinery), and is measured in watts (W) or kilowatts (kW).
[0021] 2. Time Series Data: This refers to a sequence of observations arranged in chronological order, typically obtained by measuring the same indicator at continuous or discrete points in time.
[0022] 3. Cluster Analysis: Cluster Analysis is an unsupervised machine learning method that aims to divide a set of data objects into multiple clusters (or categories), such that objects within the same cluster are similar to each other, while objects in different clusters are dissimilar. In this invention, it specifically refers to identifying user groups with similar electricity consumption behavior patterns based on time series data of total active power consumption.
[0023] 4. Bayesian Variational Inference: This is an efficient computational method for approximating the posterior distribution of complex probability models. Compared to traditional sampling-based Markov chain Monte Carlo methods, variational inference transforms the posterior inference problem into an optimization problem: finding an approximate distribution from an easily tractable family of distributions that minimizes the KL divergence with the true posterior distribution.
[0024] 5. Gaussian Process: A Gaussian Process is a probabilistic model used to describe a set of random variables, where any finite number of variables follow a joint Gaussian distribution. In this invention, GP is used as the random error term in the model. Its core lies in defining the correlation between observations at different time points through a covariance function (kernel function), thereby characterizing the continuity and smoothness of changes in user electricity consumption over time.
[0025] 6. B-spline basis functions: B-spline basis functions are a set of piecewise polynomial functions with local support and good smoothness. In this application, they are used as a set of basis functions to flexibly and smoothly fit and represent the overall trend and shape of the power consumption curve of a single user through their linear combination, forming the core of the deterministic part of the model. Here, p is the degree of these basis functions, usually p=3 by default. The following is the formula definition of the B-spline basis functions: 1) Zero-order basis function (p=0)
[0026] 2) p-th basis functions (p>0)
[0027] 7. DIC: Deviation Information Criterion is a criterion used for comparing and selecting Bayesian models. It weighs the goodness of fit of the model (measured by the posterior mean deviation) against the complexity of the model (measured by the number of effective parameters). In this invention, DIC is used to objectively and data-drivenly select the optimal number of clusters from a set of candidate cluster numbers (K value), achieving adaptive model selection.
[0028] 8. Gaussian Regression Mixture Model: This is a probabilistic generative model. In this invention, the model is composed of multiple components (corresponding to different user categories). Each component is itself a Gaussian process regression model, defined by a deterministic mean function composed of B-spline basis functions and a Gaussian process random term.
[0029] 9. KL Divergence: Kullback-Leibler Divergence is an asymmetric measure of the difference between two probability distributions. In the Bayesian variational inference algorithm of this invention, the best approximation solution for complex posterior distributions is obtained by minimizing the KL divergence between the variational distribution and the true posterior distribution. This optimization process is equivalent to maximizing the lower bound of evidence (ELBO), which is the theoretical basis for the algorithm's convergence.
[0030] 10. ELBO: Evidence Lower Bound, is a computable lower bound on the true model evidence (marginal likelihood) in variational inference. Maximizing ELBO is equivalent to minimizing the KL divergence between the variational distribution and the true posterior distribution. In the algorithm of this invention, ELBO is the objective function for iterative optimization, and its convergence is used to determine whether the algorithm terminates.
[0031] 11. Dirichlet Distribution: A multivariate continuous probability distribution defined over the real number field.
[0032] 12. Categorical Distribution: A discrete probability distribution that describes the distribution of a single random variable across a finite number of categories.
[0033] 13. Inverse Gamma Distribution: A continuous probability distribution defined over the positive real number domain, often used in Bayesian statistics as the conjugate prior of variance.
[0034] 14. Multivariate Normal Distribution: A continuous distribution of a high-dimensional random variable, defined by its mean vector and covariance matrix.
[0035] 15. K-means Clustering: K-means clustering is a classic distance-based unsupervised clustering algorithm. Its core idea is to divide the dataset into K clusters through iterative optimization, such that the similarity of data points within the same cluster is as high as possible, and the differences between different clusters are as large as possible.
[0036] 16. MCMC Method: Markov Chain Monte Carlo (MCMC) is a set of algorithms that use Markov chains to sample from a random distribution, with previous steps serving as the base case. The more steps, the better the results. This method solves the problem of direct sampling in high-dimensional spaces by constructing a Markov chain with a stable state corresponding to the target distribution and performing a walk. It is commonly used for posterior distribution estimation and high-dimensional integral calculation in Bayesian inference.
[0037] Please refer to Figure 1 , Figure 1 A flowchart illustrating the electricity load pattern recognition method based on Bayesian variational inference provided in this application embodiment. Figure 1 As shown, the method includes the following steps S1 to S4.
[0038] Step S1: Obtain the total active power time series of the user and perform preprocessing to obtain the preprocessed power time series.
[0039] The total active power time series includes the total active power sequence and its corresponding time series. In practical applications, the total active power time series is usually derived from high-frequency data collected by smart meters, such as active power readings sampled every 15 minutes or every minute. Since the raw collected data often contains dimensional differences, missing values, or non-stationary characteristics, directly using it for probabilistic modeling may lead to numerical instability or convergence difficulties. Therefore, the preprocessing in this embodiment aims to convert the raw physical quantities into a standard input form that conforms to the statistical assumptions of the subsequent Gaussian regression mixture model. It should be understood that although this embodiment focuses on the functional definition of preprocessing, in actual deployment, the specific preprocessing strategy can be flexibly adjusted according to data quality and model requirements. Its core purpose is to eliminate non-technical interference factors and retain characteristic information reflecting the user's actual electricity consumption behavior.
[0040] Step S2: Establish a Gaussian regression mixture model. In the Gaussian regression mixture model, the power time series is represented by the main trend term consisting of a linear combination of B-spline basis functions plus a random error term that follows a Gaussian process.
[0041] Unlike existing technologies, this application does not use a single function or a single stochastic process to fit the entire power curve. Instead, it creatively employs a binary decomposition structure consisting of a deterministic "main trend term" and a time-dependent "random error term." The main trend term utilizes a linear combination of B-spline basis functions to characterize the macroscopic profile and smooth variation patterns of user electricity consumption behavior. B-splines, as piecewise polynomial basis functions, possess local support and good smoothness, effectively filtering out high-frequency measurement noise and extracting stable load morphology characteristics.
[0042] Unlike existing technologies, the random error term is not the independent and identically distributed white noise assumed in traditional regression models, but is modeled as a Gaussian process. The covariance function of this Gaussian process is used to characterize the temporal correlation between the electricity consumption of the same user at different time points. This is the core feature that distinguishes the model in this application from the independent and identically distributed assumption in traditional clustering methods. In traditional regression or clustering models, residuals are usually assumed to be uncorrelated white noise, meaning that the deviation at time t is unrelated to the deviation at time t+1. However, electricity consumption behavior has significant inertia and memory effects. For example, once an air conditioner compressor starts, its power consumption will remain high and fluctuate slowly for a period of time; the operating cycle of industrial equipment also often shows state dependence between different time periods. If this temporal correlation is ignored, the model will misjudge this structured residual information as random noise, leading to a decrease in the accuracy of load pattern identification. By introducing a Gaussian process as an error term and using the covariance function to explicitly model the dependencies between time points, this application can transform the structured information in the residuals into effective clustering features, thereby avoiding clustering bias caused by ignoring the non-independence of data and more accurately capturing users' dynamic electricity consumption habits.
[0043] This dual-component architecture enables the model to both ensure robust extraction of typical patterns through the trend term and finely characterize the dynamic differences in individual behaviors through the Gaussian process error term, significantly improving the model's ability to represent complex electricity consumption data.
[0044] Step S3: The parameters of the Gaussian regression mixture model are estimated using the Bayesian variational inference algorithm. The variational distribution and the temporal correlation parameters in the covariance function are updated iteratively by maximizing the lower bound of evidence.
[0045] For the aforementioned Gaussian regression mixture model containing latent variables and complex covariance structures, traditional MCMC methods face severe computational bottlenecks when processing large-scale, high-dimensional time series data, making it difficult to meet the timeliness requirements of practical applications. Therefore, this embodiment employs Bayesian variational inference as the core solution engine. This algorithm transforms the originally difficult-to-compute posterior distribution inference problem into an optimization problem of finding the optimal variational distribution to approximate the true posterior. The objective function of the optimization is the lower bound of evidence, also known as ELBO. By iteratively maximizing the lower bound of evidence, the algorithm can alternately update the variational posterior distribution of model parameters and the hyperparameters characterizing time-series correlations. This optimization-based inference paradigm not only avoids cumbersome numerical integration and sampling processes, significantly reducing computational complexity, but also ensures the monotonical convergence of the algorithm. More importantly, the variational inference framework naturally supports the quantification of model uncertainty, making the parameter estimation results no longer simple point estimates, but distribution estimates containing confidence information, providing statistical assurance for subsequent robust clustering.
[0046] Step S4: Determine the electricity load category of each user based on the estimation results of the Bayesian variational inference algorithm.
[0047] After completing the variational inference of the model parameters, the posterior probability distribution of each user's classification into various potential electricity load categories has been obtained. Unlike traditional hard clustering methods that only output definite category labels, this embodiment assigns categories based on posterior probabilities, for example, selecting the category with the highest posterior probability as the user's final classification. This probabilistic classification mechanism can not only identify users with typical load patterns but also effectively identify ambiguous users at category boundaries, and their classification probability itself is a quantitative measure of classification uncertainty. Furthermore, based on the estimated model parameters, typical electricity consumption curves for each category can be reconstructed, providing intuitive and reliable data support for power operators to formulate differentiated service strategies, demand-side response plans, or energy storage configuration plans.
[0048] Through steps S1 to S4 described above, this embodiment constructs a complete electricity load pattern recognition process. This process solves the balance problem between time-series correlation and noise robustness through a binary model structure, and solves the computational efficiency problem under large-scale data through a variational inference algorithm. Thus, while ensuring recognition accuracy, it achieves efficient and probabilistic analysis of massive smart meter data.
[0049] Please refer to Figure 2 , Figure 2 A detailed flowchart of step S1 provided in this embodiment of the application. Figure 1 Based on the embodiment, the preprocessing process in step S1 is further defined, and the method includes the following steps S11 to S12.
[0050] Step S11: Perform a natural logarithmic transformation on each total active power in the total active power time series.
[0051] The raw total active power data collected by smart meters typically exhibits a significant right-skewed distribution, meaning that electricity consumption is low most of the time, but extremely high peak loads occur during specific periods. This non-normal, heteroscedastic statistical characteristic deviates from the normal distribution assumption upon which subsequent Gaussian regression mixture models rely. Directly using the raw data for modeling may lead to biased parameter estimation or convergence difficulties. Therefore, this embodiment employs a natural logarithmic transformation to normalize the data.
[0052] Specifically, consider One user, using , , representing the first in the target area Given the active power readings of each user, the following observation vector of the original total active power exists:
[0053] in, For the first The number of time points for each user. The raw total active power data is then transformed using the following natural logarithmic transformation:
[0054] in, This represents the original total active power observation value. This represents the transformed power value. This is a preset translation constant.
[0055] By introducing a logarithmic function, the influence of high-amplitude peaks can be effectively compressed, and the resolution of low-amplitude regions can be stretched, thus making the transformed data distribution closer to a normal distribution. This also helps stabilize the variance, significantly improving the fitting accuracy and numerical stability of the subsequent probability model. It should be understood that the constants in the formula are mainly used to prevent undefined logarithmic operations or numerical overflow when the original power is zero or at a minimum. In this embodiment, it is preferred to set... This ensures that the transformed value is non-negative without excessively altering the relative proportions of the data. However, in other implementations, other positive real numbers, such as 0.1 or 0.01, can be selected based on the magnitude and noise level of the actual data, as long as numerical calculation anomalies are avoided and the reasonableness of the data distribution is maintained. This application does not impose strict limitations on this.
[0056] Step S12: Standardize the time axis of the total active power time series to a preset range.
[0057] Considering that smart meters for different users may have inconsistent sampling start times, missing recording durations, or adjusted sampling frequencies, direct analysis based on absolute timestamps can lead to misalignment of load curves in the time dimension, thus affecting the clustering algorithm's extraction of common patterns. To address this issue, this embodiment further standardizes each user's timeline to a preset interval. For example, by subtracting the minimum timestamp of the sequence from all sampling time points for a user, and then dividing by the difference between the maximum and minimum timestamps, all time points are linearly mapped to the unit interval [0,1]. The calculation formula is as follows:
[0058] This normalization process eliminates interference caused by differences in physical time scale and sampling density, enabling user curves with similar electricity consumption patterns but different sampling lengths to be compared and modeled within a unified mathematical space. Although this embodiment uses the [0,1] interval as the preferred standardization target, in practical applications, other fixed intervals can be selected according to the design requirements of the model input layer. The core purpose is to achieve dimensionless and aligned time dimensions to enhance the model's compatibility and generalization ability to different data sources. Through the combined preprocessing of logarithmic transformation and time standardization described above, this embodiment lays a solid data foundation for the subsequent establishment of a high-precision, robust Gaussian regression mixture model.
[0059] Furthermore, based on Figure 2 The specific method for establishing a Gaussian mixture regression model in step S2 after preprocessing the power time series obtained in the example is as follows: Based on the number of users ,structure 1 independent and identically distributed latent variable To indicate the first There are several electricity load categories for each user, assuming the number of electricity load categories is [number missing]. ,but The set of values for is {1,2,…, Further assumption: The first... Users from category The probability is Then we have: ,
[0060] and
[0061] Given from category The logarithmic total active power curve is used to model the total active power of user electricity consumption as follows:
[0062] in, , , It is A basis function matrix of dimension 1. For the first The number of time points for each user Let be the number of B-spline basis functions, and let its th... Line 1 The element of the column is the first The B-spline basis function at the th... Time points The value of ; It is the first A vector of basis function coefficients for each category; It is a random error vector that represents the error between the observed value and the trend value.
[0063] When constructing the main trend of the power curve, the choice of the order of the B-spline basis functions directly determines the model's ability to characterize the curve's smoothness and its numerical stability. This embodiment preferably uses cubic B-splines (i.e., order p=3), primarily because cubic B-splines possess the mathematical property of being second-order continuously differentiable. This property highly aligns with the physical essence of the power curve: in actual power consumption scenarios, due to the thermal inertia of electrical equipment, the transition process of motor startup, and the gradual nature of user behavior, the change in total active power is usually continuous and smooth, with very few abrupt changes in the first derivative. Compared to first-order or second-order B-splines, cubic B-splines ensure that the fitted curve not only has continuous function values at the nodes, but also continuous tangents and curvature, thus more realistically reproducing the dynamic evolution trajectory of power and avoiding artificial inflection points or unsmooth artifacts that may be introduced by lower-order basis functions. While theoretically higher-order (e.g., fourth or fifth-order) B-splines can provide greater smoothness, excessively high orders can lead to oversensitivity of the model to local noise when processing noisy smart meter data, resulting in Runge's phenomenon or overfitting. Furthermore, they significantly increase the condition number of the basis matrix, reducing the stability of numerical computation. Therefore, cubic B-splines achieve the optimal balance between ensuring physical plausibility and suppressing overfitting.
[0064] In one implementation, the random error vector It follows a matrix with a mean of 0 and a covariance matrix of... Gaussian processes are used to capture temporal correlations and sequence dependencies, namely:
[0065] in, For the error variance, This is a correlation matrix, whose purpose is to characterize the "memory" feature of changes in electrical quantity. Specifically, this correlation matrix... It is determined by the following covariance function:
[0066] in, It is a time-dependent decay parameter (i.e., time-series correlation parameter). and For two distinct time points, the formula defines an exponential kernel, which physically describes the rate at which electrical load loses its correlation with increasing time intervals. Parameters It plays a crucial regulatory role, directly relating to the dynamic characteristics of user electricity consumption behavior. Specifically, when When the value is small, the exponential term decays slowly, meaning that even with a large time interval, the electricity consumption between the two points remains strongly correlated. This corresponds to user groups with stable and slow-changing electricity consumption patterns, such as constantly running temperature and humidity control equipment or basic lighting loads; conversely, when the value is large, the exponential term decays slowly. When the value is large, the correlation decays rapidly over time, indicating a weak correlation between electricity consumption at adjacent times and a load exhibiting characteristics of drastic fluctuations or high-frequency switching. This typically corresponds to production lines with numerous start-up and shutdown operations or residential electricity consumption with high randomness. This parameter can be introduced into the model and learned. This application enables each cluster category to adaptively possess an independent temporal correlation structure, rather than forcing all users to share the same fixed correlation pattern. This flexibility allows the model to simultaneously accommodate various heterogeneous loading patterns, such as "slow" and "severe" patterns, significantly improving the accuracy and physical interpretability of clustering. Although this embodiment uses an exponential kernel function as the preferred option, in practical applications, depending on the smoothness requirements of the specific data, other positive definite kernel functions such as the squared exponential kernel (RBF) and the Matérn kernel can also be used instead. As long as the kernel function can effectively represent the dependencies in the time dimension and support parametric learning, it should be considered within the scope of protection of this application.
[0067] Please refer to Figure 3 , Figure 3 A detailed flowchart of step S3 provided in this embodiment of the application. Figure 1 Based on the example, the specific process of estimating the parameters of the Gaussian regression mixture model using the Bayesian variational inference algorithm is further defined. Specifically, step S3 includes steps S31 to S33.
[0068] Step S31: Fix the temporal correlation parameters, and update the variational posterior distribution of the mixed weights, the variational posterior distribution of each user category, the variational posterior distribution of the basis function coefficients of each category, and the variational posterior distribution of the error variance in sequence by minimizing the KL divergence.
[0069] Because Gaussian regression mixture models contain multiple coupled latent variables and parameters, directly solving for the joint posterior distribution is extremely difficult. In this embodiment, by temporarily treating the time-series correlation parameter δ as a known constant, the complex global optimization problem can be decomposed into a series of local optimization subproblems targeting individual variable blocks. Specifically, minimizing the KL divergence is equivalent to maximizing the lower bound of evidence (ELBO) under the mean-field assumption. The algorithm derives the optimal variational posterior distribution of the current target variable using the current expected values of other variables in a preset order.
[0070] To support efficient analytical solutions for the Bayesian variational inference algorithm, this embodiment makes specific selections regarding the prior distributions of each model parameter. As one implementation method, mixed weights... The prior distribution adopts the Dirichlet distribution, and the basis function coefficients of each category are... The prior distribution adopts a multivariate normal distribution (specifically an M-dimensional normal distribution), and the error variance is... The prior distribution employs an inverse gamma distribution. This prior configuration is not arbitrarily chosen but carefully designed based on the principle of conjugacy. Its core technical effect lies in ensuring that the variational posterior distribution has a closed analytical form, thereby completely avoiding time-consuming numerical integration or Markov chain Monte Carlo sampling. This enables this application to maintain extremely high computational efficiency and scalability when dealing with massive amounts of high-frequency data collected from smart meters, fundamentally solving the bottleneck problem of existing probabilistic clustering methods being difficult to implement in practice.
[0071] Specifically, the Dirichlet distribution is the conjugate prior of the classification distribution (i.e., the probability distribution of user category affiliation), ensuring that the posterior of the mixed weights remains a Dirichlet distribution, requiring only an update to its concentration parameter. The multivariate normal distribution, as the prior of the basis function coefficients, is conjugate with the Gaussian likelihood function, guaranteeing that the posterior of the basis function coefficients still follows a multivariate normal distribution, whose mean and covariance can be directly obtained through matrix operations. The inverse gamma distribution is the conjugate prior of the error variance, ensuring that the posterior of the error variance remains an inverse gamma distribution, and its shape and scale parameters can be analytically derived from sufficient statistics of the data. Thanks to this fully conjugate structure, all variational updates in step S31 can be transformed into simple algebraic operations, compressing the Bayesian inference process, which originally required hours or even days, to minutes or even seconds. By minimizing the KL divergence, the mixed weights are obtained sequentially. Variational posterior distribution, user category attribution The corresponding variational posterior distribution and the coefficients of the basis functions for each category The variational posterior distribution of and the variational posterior distribution of the error variance.
[0072] Step S32: Fix the variational posterior distributions obtained in step S31, and update the estimated values of the temporal correlation parameters by maximizing the lower bound of evidence.
[0073] Unlike the discrete or conjugate continuous variables in step S31, the time-series correlation parameter δ is directly embedded in the covariance matrix of the Gaussian process, and its corresponding variational posterior typically does not possess a standard analytical form. Therefore, this embodiment employs a numerical optimization method to handle this parameter. Specifically, while keeping all other variational distributions unchanged, the lower bound of evidence is considered as relating to... For a single-variable function, numerical optimization algorithms such as gradient ascent, Newton's method, or Brent's method are used to find the δ value that maximizes the lower bound of evidence. This step enables the model to adaptively learn the strength of the time-series correlation of electricity load: if the data shows long-range dependence, the optimization process will automatically adjust the algorithm accordingly. Push towards a smaller value; if the data fluctuates drastically and has short-term correlations, then It will be updated to a larger value.
[0074] In this embodiment, a hybrid inference strategy of "analytical update + numerical optimization" is adopted, which not only retains the efficiency of variational inference, but also overcomes the limitation of oversimplification of model structure by pure analytical methods, thus ensuring the accuracy of time series modeling.
[0075] Step S33: Repeat steps S31 and S32 until the change in the lower bound of evidence is less than the preset threshold.
[0076] This step defines the convergence termination condition of the algorithm. After each complete round of parameter updates, the absolute value of the difference between the current lower bound of evidence and the previous lower bound of evidence is calculated. When this difference is lower than a preset threshold (e.g., ...), the algorithm terminates. When the model evidence has stabilized and further iterations yield negligible benefits, the algorithm is considered convergent and outputs the final variational posterior distribution. This dynamic stopping criterion avoids the computational waste or underfitting risks that may result from a fixed number of iterations, ensuring the algorithm's robustness and adaptability on datasets of different sizes.
[0077] Please refer to Figure 4 , Figure 4 A flowchart illustrating the method for adaptively determining the optimal number of clusters provided in this embodiment. Figure 1 Based on the previous implementation, a data-driven model selection strategy is introduced to provide a reasonable search space for the algorithm. Specifically, the method for adaptively determining the optimal number of clusters includes the following steps S5 to S7.
[0078] Step S5: Preset a candidate set of cluster counts containing multiple positive integer values.
[0079] In practical applications, the actual number of clusters in electricity load patterns is usually unknown and may dynamically adjust with changes in season, region, or user group. Relying solely on manual experience to set a fixed number of clusters can easily lead to underfitting (missing important patterns) or overfitting (misclassifying noise as independent categories). Therefore, this embodiment introduces a data-driven model selection strategy, providing a reasonable search space for the algorithm by pre-setting a candidate set Q containing multiple positive integer values for the number of clusters (e.g., Q={2, 3, 4, 5}). It should be understood that the specific range of this candidate set can be flexibly set according to the data scale and prior knowledge of the actual business scenario, and this application does not impose strict limitations on it.
[0080] Step S6: Based on each candidate value of the number of clusters, perform the modeling and inference steps in the aforementioned embodiments to obtain the posterior distribution that satisfies the convergence termination condition, and calculate the deviation information criterion value based on the posterior distribution.
[0081] The modeling and inference steps involve establishing a Gaussian regression mixture model and estimating the parameters of the Gaussian regression mixture model using a Bayesian variational inference algorithm. The Deviation Information Criterion (DIC) is a model evaluation metric specifically designed for Bayesian hierarchical models. Its core advantage lies in its ability to simultaneously balance goodness of fit and complexity. Unlike traditional AIC (Akaike Information Criterion) or BIC (Bayesian Information Criterion), DIC fully utilizes the complete posterior distribution information obtained from variational inference, rather than relying solely on point estimation. Its calculation logic comprises two key parts: first, the model deviation calculated based on the posterior mean, which measures the model's fit to the observed data; a smaller deviation indicates a better fit. Second, the number of effective parameters, used to measure the actual complexity of the model. This value is obtained by estimating the variance of the posterior deviation and can automatically penalize models that, while having a high good fit, have redundant or overfitting parameters. In the Gaussian regression mixture model of this application, the model structure is relatively complex due to the introduction of Gaussian processes and B-spline basis functions. DIC can effectively identify model configurations that truly capture the intrinsic structure of the data rather than simply remembering noise. By traversing each K value in the candidate set Q, running the complete variational inference process until convergence, and recording the corresponding DIC value, an evaluation curve reflecting the change of model performance with complexity can be constructed.
[0082] Step S7: Select the candidate number of clusters that minimizes the deviation information criterion value as the optimal number of clusters.
[0083] This automated optimization mechanism transforms the originally subjective and time-consuming model parameter tuning process into an objective and reproducible computational flow. The K value corresponding to the minimum DIC represents the optimal balance between model interpretability and simplicity in the current dataset. For example, if DIC reaches its global minimum when K=4, it indicates that dividing users into 4 categories can adequately cover the main electricity consumption behavior patterns without introducing unnecessary additional classifications, thus ensuring the robustness and generalization ability of the clustering results.
[0084] After determining the optimal number of clusters, the electricity load category corresponding to the highest posterior probability is selected as the user's final category from the posterior probabilities of each user's category estimated based on this optimal number of clusters. This step completes the mapping from the probabilistic model to specific business labels. However, it should be noted that the output of this application is not limited to a single hard classification label. Thanks to the Bayesian variational inference framework, the model naturally outputs the complete probability distribution of each user's belonging to each category. This probabilistic feature has important practical application value: for users whose maximum probability is significantly higher than other categories (e.g., 0.95), it can be confirmed that they belong to a typical load pattern; while for users whose probabilities of each category are relatively close (e.g., 0.4 vs 0.35 vs 0.25), it indicates that the user's electricity consumption behavior has mixed characteristics or is at the category boundary, and their classification has a large degree of uncertainty. This uncertainty quantification information is crucial for refined power operation. For example, when formulating demand-side response incentive policies, standardized solutions can be pushed to users with high confidence, while more flexible trial strategies or manual review can be adopted for users with low confidence, thereby avoiding resource waste or user experience degradation caused by misclassification.
[0085] Furthermore, based on the variational posterior mean of the basis function coefficients of each category estimated by the optimal cluster size, typical electricity consumption curves for each category can be reconstructed, providing a visual basis for intuitively displaying and verifying the clustering results. In this embodiment, by integrating the DIC criterion and probabilistic output mechanism, not only is adaptive optimization of the model structure achieved, but also information-rich decision support is provided for downstream applications, significantly improving the overall practicality and intelligence level of the technical solution.
[0086] To further verify the effectiveness and feasibility of the proposed method in practical applications, this embodiment provides a comprehensive analysis case based on specific electricity consumption data. This case fully replicates the entire process from data preprocessing, model building, variational inference to adaptive model selection (e.g., ...). Figure 5 As shown in the figure, the purpose is to use specific numerical results to demonstrate the beneficial effects of the synergistic operation of the technical features described in the foregoing embodiments.
[0087] In this application scenario, 100 residential users within the target area are selected as the analysis subjects, with a data coverage period of one month and a smart meter sampling interval of 15 minutes. Therefore, each user theoretically has 2880 total active power observation points within the analysis period, and the original dataset constitutes a 100×2880 matrix. First, execute... Figure 2 The preprocessing steps described in the embodiment perform a natural logarithmic transformation on the original power sequence of each user to improve the normality of the data distribution and linearly map the time axis to the [0,1] interval to eliminate time scale differences.
[0088] Subsequently, a Gaussian regression mixture model was established based on the preprocessed data. For specific parameter configuration, cubic B-spline basis functions were selected to construct the main trend term, and 20 internal nodes were evenly distributed across the standardized time interval [0,1]. This resulted in the calculation of the number of basis functions M=22 (i.e., 20+3-1), meaning a 2880×22-dimensional basis function matrix was constructed for each user. The random error term was modeled using an exponential kernel function, and the time-series correlation parameter δ=10 was initialized. Simultaneously, according to... Figure 3 The prior distributions described in the example are as follows: the mixed weights follow a Dirichlet distribution with all parameters equal to 1, the basis function coefficients follow a 22-dimensional standard normal distribution, and the error variance follows an inverse gamma distribution with a shape parameter of 1 and a scale parameter of 0.1.
[0089] Next, execute as follows Figure 3 The Bayesian variational inference algorithm described in this embodiment estimates the model parameters. The algorithm initializes the user's soft-class labels using K-means clustering results and sets a convergence threshold of 10. -6 During the iteration process, the variational posterior update and evidence lower bound maximization steps are executed alternately until the change in the evidence lower bound between two adjacent iterations is less than a preset threshold, at which point the algorithm is considered to have converged.
[0090] Based on this, execute as follows Figure 4The adaptive model selection process described in this embodiment involves a preset candidate set of cluster sizes Q = {2, 3, 4, 5}. For each candidate K value in the set, the complete modeling and inference process described above is run independently. After the algorithm converges, the bias information criterion (DIC) value is calculated based on the obtained variational posterior distribution. In the actual calculation of this case, the DIC values corresponding to each candidate K value are as follows: DIC = 1500 when K = 2, DIC = 1450 when K = 3, DIC = 1420 when K = 4, and DIC = 1480 when K = 5. According to the principle of minimizing the bias information criterion, the DIC value corresponding to K = 4 is the lowest, indicating that dividing users into 4 categories under this dataset achieves the best balance between model fit and complexity. Therefore, the optimal number of clusters K* = 4 is determined. This result objectively reflects the inherent structural characteristics of the data and avoids the subjective bias that may be caused by manually specifying the K value.
[0091] Finally, based on the optimal clustering size K*=4, the model outputs the final clustering results, which include user category probability labels, typical electricity consumption curves for each category, and model fit evaluation results. Specifically, for each user, the category with the highest probability from the variational posterior probability distribution of their respective categories is selected as the final assignment label. For example, if a user's posterior category probability distribution is (0.85, 0.10, 0.03, 0.02), they are classified as category 1, and the probability value of 0.85 quantifies the confidence level of this classification result. Simultaneously, four typical electricity consumption curves are reconstructed using the variational posterior mean of the basis function coefficients for each category. These curves smoothly represent the common electricity consumption patterns of different user groups and can be used for subsequent refined service strategy formulation or demand-side response scheme design. Furthermore, the average curve is calculated based on the original power sequences of all users within each category, and compared with the aforementioned generated typical electricity consumption curves to obtain the model fit evaluation results. If the two shapes are highly similar, it indicates that the clustering has effectively captured the common pattern and the model fit is good; if the two shapes are highly different, it indicates that the clustering has not effectively captured the common pattern and the model fit is poor.
[0092] It should be understood that the specific values mentioned in this embodiment (such as the number of users 100, the sampling interval 15 minutes, the number of basis functions 22, the specific value of DIC, etc.) are merely exemplary parameters set to explain the technical solution of this invention, and are not intended to limit the scope of protection of this invention. In practical applications, the above parameters can be adjusted accordingly based on the data scale, computing resources, and business needs. As long as the method flow and core principles described in this invention are followed, they should all be covered within the scope of protection of this invention.
[0093] According to an embodiment of this application, an electronic device is provided, such as... Figure 6The diagram shown is a hardware structure schematic of an electronic device according to an embodiment of this application. The electronic device 100 includes a processor 10, a memory 20, and a communication interface 30. The processor 10, memory 20, and communication interface 30 are connected via lines. Figure 6 In the embodiment shown, the processor 10, memory 20, and communication interface 30 are connected to each other via a bus.
[0094] The memory 20 is used to store software programs, computer-executable program instructions, etc. The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the electronic device 100, etc.
[0095] The memory 20 can be a read-only memory (ROM), or other types of static storage devices that can store static information and instructions, or random access memory (RAM), or other types of dynamic storage devices that can store information and instructions, or electrically erasable programmable read-only memory (EEPROM). The specific type is not limited here.
[0096] For example, the aforementioned memory 20 can be Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM). This memory 20 can exist independently but is connected to the processor 10. Optionally, the memory 20 can also be integrated with the processor 10, for example, integrated within one or more chips.
[0097] In some embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and this remote memory may be connected to the electronic device 100 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0098] The processor 10 connects various parts of the electronic device 100 using various interfaces and lines. By running or executing software programs stored in the memory 20 and calling data stored in the memory 20, it performs various functions of the electronic device 100 and processes data, such as implementing the methods described in any embodiment of this application.
[0099] The processor 10 can be a field programmable gate array (FPGA), a digital signal processor (DSP), a central processing unit (CPU), or the like.
[0100] Processor 10 can be a single-core processor or a multi-core processor. For example, processor 10 can be composed of multiple FPGAs or multiple DSPs. Furthermore, processor 10 can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions). Processor 10 can be a standalone semiconductor chip or integrated with other circuits into a single semiconductor chip. For example, it can form a system-on-a-chip (SoC) with other circuits (such as encoding / decoding circuits, hardware acceleration circuits, or various bus and interface circuits), or it can be integrated as a built-in processor within an application-specific integrated circuit (ASIC). This ASIC with integrated processor can be packaged separately or together with other circuits.
[0101] The communication interface 30 can use a transceiver device, such as a transceiver, to enable communication between the electronic device 100 and other devices or communication networks.
[0102] This application also provides a non-volatile computer-readable storage medium storing computer-executable instructions that are executed by one or more processors, for example, to perform the steps of the power load pattern recognition method based on Bayesian variational inference described above.
[0103] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; under the concept of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of this application as described above, which are not provided in detail for the sake of brevity; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for identifying electricity load patterns based on Bayesian variational inference, characterized in that, include: Step S1: Obtain the total active power time series of the user and perform preprocessing to obtain the preprocessed power time series; Step S2: Establish a Gaussian regression mixture model. In the Gaussian regression mixture model, the power time series is represented by a main trend term consisting of a linear combination of B-spline basis functions plus a random error term following a Gaussian process. The covariance function of the Gaussian process is used to characterize the temporal correlation between the electricity consumption of the same user at different time points. Step S3: The parameters of the Gaussian regression mixture model are estimated using the Bayesian variational inference algorithm. The variational distribution and the temporal correlation parameters in the covariance function are updated iteratively by maximizing the lower bound of evidence. Step S4: Determine the electricity load category of each user based on the estimation results of the Bayesian variational inference algorithm.
2. The method according to claim 1, characterized in that, The preprocessing in step S1 includes: Perform a natural logarithmic transformation on each total active power in the total active power time series, and standardize its time axis to a preset interval.
3. The method according to claim 1, characterized in that, The B-spline basis functions are cubic B-spline basis functions.
4. The method according to claim 1, characterized in that, The mean of the Gaussian process is 0, and the covariance matrix is... ,in, For the error variance, This is the correlation matrix.
5. The method according to claim 4, characterized in that, The correlation matrix is determined by the following covariance function: in, , is the time-series correlation parameter, and These are two different points in time.
6. The method according to claim 1, characterized in that, Step S3 specifically includes: Step S31: Fix the time-series correlation parameters, and update the variational posterior distribution of the mixed weights, the variational posterior distribution of each user category, the variational posterior distribution of the basis function coefficients of each category, and the variational posterior distribution of the error variance of the Gaussian process sequentially by minimizing the KL divergence. Step S32: Fix the variational posterior distributions obtained in step S31, and update the estimated values of the time-series correlation parameters by maximizing the lower bound of evidence; Step S33: Repeat steps S31 and S32 until the change in the lower bound of evidence is less than the preset threshold.
7. The method according to claim 6, characterized in that, The prior distribution of the mixed weights adopts a Dirichlet distribution, the prior distribution of the basis function coefficients adopts a multivariate normal distribution, and the prior distribution of the error variance adopts an inverse gamma distribution.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: Pre-set a candidate set of cluster counts containing multiple positive integer values; Based on each candidate value for the number of clusters, steps S2 and S30 are executed to obtain the posterior distribution that satisfies the convergence termination condition, and the deviation information criterion value is calculated based on the posterior distribution. The candidate value of the number of clusters that minimizes the deviation information criterion value is selected as the optimal number of clusters. From the posterior probabilities of each user category estimated based on the optimal number of clusters, the electricity load category corresponding to the highest posterior probability is selected as the user's final category.
9. An electronic device, characterized in that, The method includes at least one processor and a memory communicatively connected to the at least one processor, the memory storing instructions executable by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1 to 8.
10. A computer storage medium, characterized in that, The computer storage medium stores instructions or programs that, when executed by at least one processor, cause the at least one processor to perform the method as described in any one of claims 1 to 8.