A user-side power consumption prediction method based on multi-step state classification

By using a multi-level state classification method, electricity consumption data is clustered and processed by neural networks to identify the switching characteristics of electricity consumption levels. This solves the accuracy problem of traditional electricity consumption forecasting methods and achieves more accurate and stable electricity consumption forecasting.

CN122490128APending Publication Date: 2026-07-31HANGZHOU GOLD ELECTRONICS EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU GOLD ELECTRONICS EQUIP CO LTD
Filing Date
2026-04-17
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Traditional electricity consumption forecasting methods are prone to smoothing prediction errors and are susceptible to noise interference when dealing with the stepped, fixed fluctuation characteristics of electricity consumption on the user side, resulting in inaccurate prediction accuracy.

Method used

A multi-level state classification method is adopted. The center value of electricity consumption status is determined by cluster analysis, the continuous electricity consumption numerical sequence is mapped to discrete level labels, a neural network time series classification model is constructed, and the sparse attention mechanism is used to identify the electricity consumption level switching characteristics and predict the probability distribution of electricity consumption levels.

Benefits of technology

It improves the accuracy of electricity consumption forecasting, enhances the system's noise resistance and robustness, and enables accurate capture and stable reproduction of complex electricity consumption patterns.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122490128A_ABST
    Figure CN122490128A_ABST
Patent Text Reader

Abstract

This application provides a user-side electricity consumption prediction method based on multi-level state classification. By transforming continuous electricity consumption prediction into discrete level state classification, it effectively solves the prediction distortion problem of traditional regression models at the moment of electricity consumption jump, significantly enhancing the system's noise robustness. Furthermore, it combines a time-series classification model built on a neural network, performing level-based clustering on the preprocessed raw electricity consumption data to determine the center value of the electricity consumption state. A sparse attention mechanism is used to identify and extract information contributing to the switching of electricity consumption levels, and the probability vector output by the model is used to reconstruct the predicted electricity consumption value. This significantly reduces the processing complexity of long-sequence electricity consumption data while achieving accurate capture and stable reconstruction of complex user-side electricity consumption patterns.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of power system automation and artificial intelligence application technology, specifically to a user-side electricity consumption prediction method based on multi-level state classification. Background Technology

[0002] Traditional electricity consumption forecasting methods mainly include statistical methods such as time series analysis and regression analysis, as well as deep learning methods based on artificial neural networks. User-side electricity consumption behavior exhibits significant "discrete switching characteristics" at the microscale. Influenced by the start-up and shutdown of electrical equipment, industrial production shifts, and lifestyle habits, measured electricity consumption data often shows discontinuous, step-like, fixed fluctuations. When processing such fixed-amplitude data, regression models are prone to smoothing prediction errors at the edges of these steps and are easily affected by subtle noise, leading to inaccurate predictions at critical points.

[0003] Therefore, how to combine the stepped distribution characteristics of user-side electricity consumption to propose a prediction method that can accurately identify state transitions and effectively filter sampling noise has become a key issue that needs to be addressed in current user-side management. Summary of the Invention

[0004] This application aims to improve the accuracy of user-side electricity consumption prediction by providing a user-side electricity consumption prediction method based on multi-level state classification.

[0005] To achieve this objective, the following technical solution is adopted in this application:

[0006] A user-side electricity consumption prediction method based on multi-level state classification is provided, including the following steps:

[0007] S1. Based on the characteristics of electricity consumption distribution and cluster analysis, the preprocessed raw electricity consumption data is clustered in a step-by-step manner to determine the center value of electricity consumption status.

[0008] S2, based on the central value, the original continuous sequence of electricity consumption values ​​is mapped and converted into a discrete sequence of gear labels;

[0009] S3. Construct a time series classification model based on a neural network, and take the electricity consumption time series data within the preset time window that slides to the current time and the discrete data obtained by step S2 as input, and output the probability distribution of electricity consumption level at each time of the predicted day.

[0010] Preferably, in step S1, the method for preprocessing the acquired raw electricity consumption data includes the following steps:

[0011] A1. After extracting historical electricity consumption data for the target area and removing outliers, calculate the historical electricity consumption data. mean and standard deviation Then based on 3 Guidelines, markings exceeding Historical electricity consumption data within the numerical range are used to verify the numerical boundaries and the reasonableness of the scenario;

[0012] A2, for missing time-series data, by locating the valid data points before and after the missing time period, and using the time linear interpolation method to calculate the missing values, the missing data is filled in.

[0013] Preferably, in step S1, the method for determining the center value of the power consumption state includes the following steps:

[0014] B1. Obtain the sum of squares within groups for different numbers of cluster centers, and then plot the sum of squares within groups for different numbers of cluster centers on the same coordinate axis with the number of cluster centers as the horizontal axis and the sum of squares within groups as the vertical axis.

[0015] Find the inflection point in the curve, and determine the optimal number of cluster centers based on the number of cluster centers closest to that inflection point. ;

[0016] B2, based on the optimal number of cluster centers K-means clustering analysis was performed on the preprocessed historical electricity consumption data to obtain the cluster center values ​​for different electricity consumption tiers. .

[0017] Preferably, in step S2, the method of mapping the original continuous electricity consumption numerical sequence into a discrete gear tag sequence based on the center value obtained in step S1 includes the following steps:

[0018] S21, calculate the Euclidean distance between the original electricity consumption value and each cluster center value, and extract the minimum Euclidean distance between each original electricity consumption value and each cluster center value;

[0019] S22, convert the original continuous electricity consumption data sequence The mapping is converted into a discrete gear position label sequence. ;

[0020] in, Indicates the first The original electricity consumption value; express The minimum Euclidean distance among the Euclidean distances to the cluster center values.

[0021] Preferably, in step S3, the method for outputting the probability distribution of electricity consumption at different times of the day includes the following steps:

[0022] S31, extract the feature information of electricity consumption time series data, and construct multi-dimensional feature input through standardization processing and feature concatenation;

[0023] S32, a time-series classification model based on neural network pre-training uses multi-dimensional feature input as model input to predict the classification probability distribution of each electricity consumption level at the next time step. The prediction method specifically includes the following steps:

[0024] S321, sparsification processing is performed on the multidimensional feature input;

[0025] S322, Identify and extract feature information that contributes to the switching of power consumption levels from the sparse attention results after sparsification.

[0026] S323, the generative decoder predicts the future power consumption status based on the extracted feature information that contributes to the switching of power consumption levels, and outputs the classification probability distribution of each power consumption level at the next moment by combining the classification layer.

[0027] Preferably, in step S321, the method for sparsifying the multidimensional feature input includes the following steps:

[0028] S3211, Input multidimensional features Linear projection is performed to generate the query matrix Q and the key matrix respectively. And the value matrix V;

[0029] S3212, Evaluate each query vector With all keys sparsity ;

[0030] S3213, for all query vectors sparsity Sort the ratings in descending order and select the highest rating. The active queries form a sparse query matrix. ;

[0031] S3214, using a sparse query matrix The sparse attention result was calculated. .

[0032] Preferably, the method for outputting the classification probability distribution of each power consumption level at the next moment includes the following steps:

[0033] S3231 converts the extracted feature information that contributes to the switching of power consumption levels into a feature vector representation. Then, the input is fed into a fully connected layer to represent the feature vector. Mapped to the dimension of the optimal number of cluster centers The classification space;

[0034] S3232, the next step is calculated using the Softmax function. The probability vector of each power consumption level at any given time. , Let represent the probability of time t corresponding to the j-th electricity consumption level. .

[0035] Preferably,

[0036]

[0037] ;

[0038] express The time corresponds to the first Unnormalized scores for each electricity consumption level;

[0039] for function.

[0040] Preferably, the user-side electricity consumption prediction method based on multi-level state classification provided in this application further includes the following steps:

[0041] S4. Restore the probability distribution of each electricity consumption level to the predicted electricity consumption value. The method is as follows:

[0042] The probability vector output from the model Select the element with the largest value and use the category index corresponding to that element as... Final predicted power consumption level label for each moment ;

[0043] Pick The corresponding center value is denoted as As the final electricity consumption forecast .

[0044] Preferably, the user-side electricity consumption prediction method based on multi-level state classification provided in this application further includes the following steps:

[0045] S4. Restore the probability distribution of each electricity consumption level to the predicted electricity consumption value. The method is expressed by the following formula:

[0046]

[0047] This represents the probability of corresponding to the i-th power consumption level at time t;

[0048] This represents the cluster center value for the i-th electricity consumption level;

[0049] The optimal number of cluster centers for the original electricity consumption data.

[0050] This application effectively solves the prediction distortion problem of traditional regression models at the moment of electricity consumption jumps by transforming continuous electricity consumption prediction into discrete step-level state classification, significantly enhancing the system's noise robustness. Furthermore, it combines a time-series classification model based on neural networks, performing step-level clustering on the preprocessed raw electricity consumption data to determine the center value of the electricity consumption state. A sparse attention mechanism is used to identify and extract information contributing to the switching of electricity consumption levels, and the probability vector output by the model is then utilized. To restore the predicted electricity consumption value While significantly reducing the complexity of processing long power consumption sequences, it also achieves accurate capture and stable reconstruction of complex power consumption patterns on the user side. Attached Figure Description

[0051] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly described below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0052] Figure 1 This is a flowchart illustrating the implementation steps of a user-side electricity consumption prediction method based on multi-level state classification provided in an embodiment of this application. Detailed Implementation

[0053] The technical solution of this application will be further described below with reference to the accompanying drawings and specific embodiments.

[0054] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual images. They should not be construed as limiting the scope of this application. To better illustrate the embodiments of this application, some components in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0055] In the accompanying drawings of the embodiments of this application, the same or similar reference numerals correspond to the same or similar components. In the description of this application, it should be understood that if terms such as "upper," "lower," "left," "right," "inner," and "outer" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting this application. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.

[0056] In the description of this application, unless otherwise expressly specified and limited, the term "connection" or similar designation indicating a connection between components should be interpreted broadly. For example, it can refer to a fixed connection, a detachable connection, or an integral part; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can refer to the internal communication between two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0057] This application provides a user-side electricity consumption prediction method based on multi-level state classification, such as... Figure 1 As shown, the steps include:

[0058] S1. Based on the characteristics of electricity consumption distribution and cluster analysis, the preprocessed raw electricity consumption data is clustered in a step-by-step manner to determine the center value of electricity consumption status.

[0059] S2, based on the center value, maps the original continuous sequence of electricity consumption values ​​into a discrete sequence of gear labels;

[0060] S3, construct a time series classification model based on neural networks, and take the electricity consumption time series data within the preset time window that slides to the current time and the discrete data obtained by step S2 as input, and output the probability distribution of electricity consumption level at each time of the predicted day.

[0061] S4, restore the probability distribution of each electricity consumption level to the predicted electricity consumption value.

[0062] In this application, the method for preprocessing the acquired raw electricity consumption data includes the following steps:

[0063] A1. Extract historical electricity consumption data for the target area over the past year. This historical data should include electricity consumption data for each time of day within the past year, with a preferred sampling frequency of 48 points per day (sampling once every half hour). Then, after removing outliers from the historical electricity consumption data, calculate the historical electricity consumption data. mean and standard deviation Then based on 3 Guidelines, markings exceeding Historical electricity consumption data within the numerical range are used to verify the numerical boundaries and the reasonableness of the scenario;

[0064] in,

[0065]

[0066] Indicates the first Real-time collected electricity consumption data;

[0067] This indicates the number of samples of electricity consumption data collected.

[0068] In this embodiment, based on the excess of the marker The method for verifying the reasonableness of historical electricity consumption data within a given range and considering numerical boundaries and scenarios is as follows:

[0069] First, the marked data is compared with the total rated power limit of known electrical equipment in the target area; if the marked data value exceeds the preset multiple of the total rated power limit (set to 1.2 times here), the data is determined to be a false spike value caused by a data acquisition failure and is removed; if it does not exceed the limit, the data is retained and enters the scenario rationality verification.

[0070] Secondly, the rate of change between the marked data and the data at adjacent normal times is calculated; if the rate of change exceeds the threshold of the maximum power change rate that the switching of electrical equipment can achieve, the data is determined to be a non-physical jump and is discarded.

[0071] A2, for missing time-series data, by locating the valid data points before and after the missing time period, and using the time linear interpolation method to calculate the missing values, the missing data is filled in.

[0072] In this embodiment, the method for identifying time-series missing data is as follows:

[0073] Based on a preset 30-minute sampling period, the difference between the timestamps of historical electricity consumption data is first calculated. If the time difference between two adjacent sampling points exceeds the preset sampling period, it is determined that there is missing time-series data in that period. Secondly, the start and end times of all data that do not meet the continuity condition are recorded to form a missing period index table.

[0074] The method for locating valid data points before and after the missing time period is as follows:

[0075] Starting from the identified missing time point, search backwards to find the nearest data point with complete battery values ​​that passes the validity check; this is recorded as the forward valid point. .

[0076] Search backward from the identified missing termination time point to obtain the nearest valid sampled data point to the missing time period, and record it as the backward valid data point. .

[0077] The method of calculating missing values ​​and filling in missing data using time linear interpolation is expressed as follows:

[0078]

[0079] In the formula, represent Missing data at any given moment , These represent the start and end times of the missing time period, respectively. , These represent the effective electricity consumption data values ​​at the start and end times of the missing time period, respectively.

[0080] In this embodiment, the method for determining the center value of electricity consumption status by performing tiered clustering on the preprocessed raw electricity consumption data based on electricity distribution characteristics and cluster analysis includes the following steps:

[0081] B1, Obtain the optimal number of cluster centers for K-means clustering. The method to obtain it is as follows:

[0082] Obtain the within-group sum of squares for different numbers of cluster centers, and then plot the within-group sum of squares on the same coordinate axis with the number of cluster centers as the x-axis and the within-group sum of squares as the y-axis.

[0083] Within-group sum of squares It is calculated using the following formula:

[0084]

[0085] Indicates the first Cluster groups; Indicates the number of cluster centers; Indicates the first Historical electricity consumption data in each cluster; Indicates the first The cluster center values ​​of each cluster group.

[0086] Find the inflection point in the curve, and determine the optimal number of cluster centers based on the number of cluster centers closest to that inflection point. .

[0087] The method for finding inflection points in a curve is as follows:

[0088] By calculating the rate of change of the sum of squares within groups with the number of cluster centers k, the inflection point where the curve changes from a steep decline to a gradual flattening is identified; when the increase in the value of k no longer significantly reduces the value of the sum of squares within groups, and the curve begins to show a straight line appearance, the starting point where the rate of change changes drastically is defined as the inflection point.

[0089] B2, based on the optimal number of cluster centers K-means clustering analysis was performed on the preprocessed historical electricity consumption data to obtain the cluster center values ​​corresponding to different electricity consumption tiers. .

[0090] In this embodiment, the first Cluster center values The calculation method is explained below:

[0091] First, based on the minimum distance principle, each data point in the preprocessed historical electricity consumption data X is assigned to the cluster group containing its nearest centroid. That is, if data point x is the nearest centroid to the nearest centroid, then the cluster group is assigned to the nearest centroid to the nearest centroid. If the distance to the cluster centers is the shortest, then it is assigned to the th cluster. Clusters .

[0092] Secondly, for each cluster group The cluster center value of the group is updated by calculating the arithmetic mean of all electricity consumption data points within the group. Its mathematical formula is:

[0093]

[0094] in, This represents the total number of electricity consumption data points contained in the i-th cluster, where x represents the electricity consumption data belonging to that cluster.

[0095] Repeat the above division and calculation process until the cluster center value of each electricity consumption level is obtained. Once no further significant changes occur, or the preset maximum number of iterations is reached, the final output is a stable set of cluster center values. .

[0096] In step S2, the method of mapping the original continuous electricity consumption sequence into a discrete gear tag sequence based on the center value obtained in step S1 includes the following steps:

[0097] S21, calculate the Euclidean distance between the original electricity consumption value and each cluster center value, and extract the minimum Euclidean distance between each original electricity consumption value and each cluster center value;

[0098] The formula for calculating the Euclidean distance between the original electricity consumption value and the cluster center value is expressed as follows:

[0099]

[0100] S22, convert the original continuous electricity consumption data sequence The mapping is converted into a discrete gear position label sequence. ;

[0101]

[0102] in, Indicates the first The original electricity consumption value; express The minimum Euclidean distance among the Euclidean distances to each cluster center value; Indicates the first Cluster center values; This indicates the number of optimal cluster centers.

[0103] In step S3, the method for constructing a time-series classification model based on a neural network, and for the model to output the probability distribution of electricity consumption at different times of the day, includes the following steps:

[0104] S31, extract the feature information of electricity consumption time series data, and construct multi-dimensional feature input through standardization processing and feature concatenation;

[0105] Preferably, the feature information includes one or more of the following: historical electricity consumption features, meteorological features, and temporal features. Historical electricity consumption features include historical electricity consumption data for F consecutive days prior to the forecast date, and electricity consumption tier labels (referring to the electricity consumption tier labels obtained after clustering). The window length F is 7 days or 14 days to ensure that the model input fully covers the intra-weekly fluctuation patterns. Meteorological features include one or more of the following: temperature, humidity, cloud cover, and irradiance on the forecast date. Temporal features include one or more of the following: month, date, time, day of the week, and whether it is a holiday or public holiday on the forecast date.

[0106] Preferably, the standardization process includes differentiated feature processing of categorical and numerical features to enhance data structure and unify format. For unordered categorical features such as weekdays, regular rest days, and statutory holidays, one-hot encoding is used to convert them into binary numerical vectors. For example, weekdays are mapped as follows: Ordinary rest days are mapped as Statutory holidays are mapped as .

[0107] For ordered categorical features such as day of the week, time of day, and month, sinusoidal encoding is used to extend them into continuous periodic values. The calculation formula is as follows:

[0108]

[0109]

[0110] In the formula, The numerical value represents the feature corresponding to the ordered category. This represents the total number of categories for an ordered categorical feature. Taking the weekday feature as an example... They correspond to Monday through Sunday in sequence. It is 7.

[0111] Based on continuous numerical characteristics such as historical electricity consumption and weather, the following methods are adopted: Value standardization transforms continuous numerical values ​​into dimensionless standard values ​​with a mean of 0 and a standard deviation of 1. The calculation formula is as follows:

[0112]

[0113] In the formula, Representing the The eigenvalues ​​of a continuous numerical characteristic with dimensions. Representing the The average value of a continuous numerical feature with dimensions at various historical moments. Represents standard deviation. Indicates the first Dimensionless standard values ​​of continuous numerical characteristics with dimensions.

[0114] The method for constructing a multi-dimensional feature input space by concatenating the standardized feature values ​​is briefly described below:

[0115] At each sampling time, according to a preset time window, the standardized numerical feature vector and the embedded classification feature vector are concatenated sequentially to construct the multidimensional feature input for that time.

[0116] .

[0117] in, This represents the standardized historical electricity consumption data at time t; The label represents the power consumption level at time t; This represents the standardized meteorological characteristic data at time t; This represents the embedded temporal feature data at time t; This represents a splicing operation.

[0118] S32, a time-series classification model based on neural network pre-training, uses multi-dimensional feature input as model input and predicts the classification probability distribution of each power consumption level at the next time step.

[0119] In this embodiment, the Informer model is preferably used as the time-series classification model. The Informer model first uses a sparse self-attention mechanism to sparsify the multi-dimensional feature input, identifies and extracts information that makes a key contribution to the switching of electricity consumption levels, and then uses a generative decoder to predict the electricity consumption status at future times in parallel. The classification layer then outputs the classification probability distribution of each electricity consumption level at the next time.

[0120] The computational process of the sparse self-attention mechanism is as follows:

[0121] First, input the multidimensional features Linear projection is performed to generate the query matrix Q and the key matrix respectively. And the value matrix V,

[0122]

[0123]

[0124]

[0125] in, , , These represent the learnable weight matrices.

[0126] Specifically, the query matrix Q is generated as follows:

[0127] The constructed multidimensional feature input matrix With the preset learnable weight matrix Perform matrix multiplication. This process aims to map the original electricity consumption characteristics, time characteristics, and meteorological characteristics into a high-dimensional query feature space.

[0128] Key matrix The generation principle of the value matrix V is the same as that of the query matrix Q, and will not be repeated here.

[0129] Then, each query vector is evaluated based on KL divergence. sparsity of all bonds K , The larger the value, the stronger the query vector. The more distinctive and representative it is.

[0130]

[0131] in, Representative key matrix Length; Representative key matrix The dimension; This represents the index number of the key matrix K on the time axis. ; This represents the transpose of the key vector at the j-th time step in the key matrix k;

[0132] The first query vectors This represents the vector in the i-th row of the query matrix Q.

[0133] Then, for all query vectors sparsity Sort the ratings in descending order and select the highest rating. The active queries form a sparse query matrix. ;

[0134] The expression is:

[0135]

[0136] in, The sparsity score represents the number of samples after sorting in descending order. The set of indices of the highest m query vectors in the original query matrix Q; Represents the first element in the original query matrix Q. The query vector of the row. .

[0137] Finally, using a sparse query matrix The sparse attention result was calculated. .

[0138]

[0139] for function.

[0140] After extracting the key feature information that contributes to the switching of electricity consumption levels, the generative decoder predicts the electricity consumption status at future moments based on the extracted feature information, and combines it with the classification layer to output the classification probability distribution of each electricity consumption level at the next moment.

[0141] In this embodiment, the generative decoder prediction process includes the decoder receiving multi-dimensional feature input, extracting features through a multi-head probabilistic sparse self-attention layer, and outputting the feature representation within the future prediction window in one go.

[0142] Specifically, firstly, the extracted feature information that contributes to the switching of electricity consumption levels is converted into a feature vector representation. The method is as follows:

[0143] The contributing feature information output by the sparse attention mechanism is residually concatenated with the multidimensional feature input sequence and then input to the normalization layer to convert it into a feature vector representation H. This ensures that gradient vanishing does not occur during feature information propagation. The calculation formula is as follows:

[0144]

[0145] Then, the feature vector is represented The input is fed into a fully connected layer to represent the feature vector. Mapped to the dimension of the optimal number of cluster centers The classification space is defined by the following method:

[0146]

[0147] in, represent Time corresponds to Unnormalized scores for each electricity consumption level; Represents the learnable weight matrix; This represents a learnable bias term.

[0148] Then, the next step is calculated using the Softmax function. The probability vector of each power consumption level at any given time. , Let represent the probability of time t corresponding to the j-th electricity consumption level. The specific method is as follows:

[0149]

[0150] In this embodiment, the multidimensional feature dataset includes training sample pairs consisting of standardized multidimensional feature inputs and corresponding measured electricity consumption level labels. Specifically, a single training sample pair uses a hybrid feature vector (multidimensional feature input) that integrates historical electricity consumption features, meteorological features, time features, etc., as the model input, and uses the measured electricity consumption levels corresponding to the 48 sampling times (sampling once every 30 minutes) throughout the entire prediction day as the output labels for supervised learning.

[0151] The training process of the temporal classification model is supervised by the cross-entropy loss function, and the model's gradient is updated and weights are configured based on the loss function value. If the performance does not improve after 30 consecutive training iterations, training stops, the parameters of the best-performing model are saved, and the target neural network model is obtained.

[0152] In this embodiment, the loss function used is The expression is as follows:

[0153]

[0154] in, represent Time of the first A real category of electricity consumption levels; represent The probability of the i-th electricity consumption level category predicted at any given time.

[0155] The following is a brief description of the method for training the time-series classification model in this embodiment:

[0156] First, the training set samples are input into the time-series classification model, features are extracted using a probabilistic sparse self-attention mechanism, and the predicted probability distribution is obtained at the output layer. The difference between the predicted distribution and the true distribution is calculated using the cross-entropy loss function formula. ;

[0157] Then, for the cross-entropy loss function To minimize the loss function, the backpropagation algorithm is used to calculate the loss function on the weight matrices of each layer of the model. The gradient of the model is calculated and the model parameters are dynamically updated in conjunction with the preset learning rate.

[0158] Furthermore, during training, the model's classification accuracy is simultaneously evaluated on the validation set. An early stopping mechanism is introduced: if the loss function value on the validation set no longer decreases or the classification accuracy no longer improves within 30 consecutive training iterations, the model is considered to have reached convergence and training is forcibly stopped to prevent overfitting.

[0159] Then, the trained time-series classification model is used to output the classification probability distribution of the predicted electricity consumption levels for each time period of the day. The prediction process has been explained above and will not be repeated here.

[0160] After the model outputs the classification probability distribution of the predicted electricity consumption tiers for each time of day, as follows: Figure 1 As shown, the user-side electricity consumption prediction method based on multi-level state classification provided in this embodiment further includes the following steps:

[0161] S4, the probability distribution of each electricity consumption level is restored to the predicted electricity consumption value, using the following method:

[0162] The probability vector output from the model Select the element with the largest value and use the category index corresponding to that element as... Final predicted power consumption level label for each moment ;

[0163] Pick The corresponding center value is denoted as As the final electricity consumption forecast .

[0164] Preferably, a method for restoring the probability distribution of each electricity consumption level to the predicted electricity consumption value is also provided, specifically expressed by the following formula:

[0165]

[0166] This represents the probability of corresponding to the i-th power consumption level at time t;

[0167] This represents the cluster center value for the i-th electricity consumption level;

[0168] The optimal number of cluster centers for the original electricity consumption data.

[0169] This application effectively solves the prediction distortion problem of traditional regression models at the moment of electricity consumption jumps by transforming continuous electricity consumption prediction into discrete step-level state classification, significantly enhancing the system's noise robustness. Furthermore, it combines a time-series classification model based on neural networks, performing step-level clustering on the preprocessed raw electricity consumption data to determine the center value of the electricity consumption state. A sparse attention mechanism is used to identify and extract information contributing to the switching of electricity consumption levels, and the probability vector output by the model is then utilized. To restore the predicted electricity consumption value While significantly reducing the complexity of processing long power consumption sequences, it also achieves accurate capture and stable reconstruction of complex power consumption patterns on the user side.

[0170] It should be stated that the above-described specific embodiments are merely preferred embodiments and technical principles applied in this application. Those skilled in the art should understand that various modifications, equivalent substitutions, and variations can be made to this application. However, such variations, as long as they do not depart from the spirit of this application, should be within the scope of protection of this application. Furthermore, some terminology used in this application's specification and claims is not limiting but merely for ease of description.

Claims

1. A user-side electricity consumption prediction method based on multi-level state classification, characterized in that, Including the following steps: S1. Based on the characteristics of electricity consumption distribution and cluster analysis, the preprocessed raw electricity consumption data is clustered in a step-by-step manner to determine the center value of electricity consumption status. S2, based on the central value, the original continuous sequence of electricity consumption values ​​is mapped and converted into a discrete sequence of gear labels; S3. Construct a time series classification model based on a neural network, and take the electricity consumption time series data within the preset time window that slides to the current time and the discrete data obtained by step S2 as input, and output the probability distribution of electricity consumption level at each time of the predicted day.

2. The user-side electricity consumption prediction method based on multi-level state classification according to claim 1, characterized in that, Step S1, the method for preprocessing the acquired raw electricity consumption data includes the following steps: A1. After extracting historical electricity consumption data for the target area and removing outliers, calculate the historical electricity consumption data. mean and standard deviation Then based on 3 Guidelines, markings exceeding Historical electricity consumption data within the numerical range are used to verify the numerical boundaries and the reasonableness of the scenario; A2, for missing time-series data, by locating the valid data points before and after the missing time period, and using the time linear interpolation method to calculate the missing values, the missing data is filled in.

3. The user-side electricity consumption prediction method based on multi-level state classification according to claim 1, characterized in that, In step S1, the method for determining the center value of the power consumption state includes the following steps: B1. Obtain the sum of squares within groups for different numbers of cluster centers, and then plot the sum of squares within groups for different numbers of cluster centers on the same coordinate axis with the number of cluster centers as the horizontal axis and the sum of squares within groups as the vertical axis. Find the inflection point in the curve, and determine the optimal number of cluster centers based on the number of cluster centers closest to that inflection point. ; B2, based on the optimal number of cluster centers K-means clustering analysis was performed on the preprocessed historical electricity consumption data to obtain the cluster center values ​​for different electricity consumption tiers. .

4. The user-side electricity consumption prediction method based on multi-level state classification according to claim 1, characterized in that, In step S2, the method of mapping the original continuous electricity consumption sequence into a discrete gear tag sequence based on the center value obtained in step S1 includes the following steps: S21, calculate the Euclidean distance between the original electricity consumption value and each cluster center value, and extract the minimum Euclidean distance between each original electricity consumption value and each cluster center value; S22, convert the original continuous electricity consumption data sequence The mapping is converted into a discrete gear position label sequence. ; in, Indicates the first The original electricity consumption value; express The minimum Euclidean distance among the Euclidean distances to the cluster center values.

5. The user-side electricity consumption prediction method based on multi-level state classification according to claim 1, characterized in that, Step S3, the method for outputting the probability distribution of electricity consumption at different times of the day includes the following steps: S31, extract the feature information of electricity consumption time series data, and construct multi-dimensional feature input through standardization processing and feature concatenation; S32, a time-series classification model based on neural network pre-training uses multi-dimensional feature input as model input to predict the classification probability distribution of each electricity consumption level at the next time step. The prediction method specifically includes the following steps: S321, sparsification processing is performed on the multidimensional feature input; S322, Identify and extract feature information that contributes to the switching of power consumption levels from the sparse attention results after sparsification. S323, the generative decoder predicts the future power consumption status based on the extracted feature information that contributes to the switching of power consumption levels, and outputs the classification probability distribution of each power consumption level at the next moment by combining the classification layer.

6. The user-side electricity consumption prediction method based on multi-level state classification according to claim 5, characterized in that, Step S321, the method for sparsifying the multidimensional feature input includes the following steps: S3211, Input multidimensional features Linear projection is performed to generate the query matrix Q and the key matrix respectively. And the value matrix V; S3212, Evaluate each query vector With all keys sparsity ; S3213, for all query vectors sparsity Sort the ratings in descending order and select the highest rating. The active queries form a sparse query matrix. ; S3214, using a sparse query matrix The sparse attention result was calculated. .

7. The user-side electricity consumption prediction method based on multi-level state classification according to claim 5, characterized in that, The method for outputting the classification probability distribution of each power consumption level at the next moment includes the following steps: S3231 converts the extracted feature information that contributes to the switching of power consumption levels into a feature vector representation. Then, the input is fed into a fully connected layer to represent the feature vector. Mapped to the dimension of the optimal number of cluster centers The classification space; S3232, the next step is calculated using the Softmax function. The probability vector of each power consumption level at any given time. , Let represent the probability of time t corresponding to the j-th electricity consumption level. .

8. The user-side electricity consumption prediction method based on multi-level state classification according to claim 7, characterized in that, ; express The time corresponds to the first Unnormalized scores for each electricity consumption level. for function.

9. The user-side electricity consumption prediction method based on multi-level state classification according to claim 1, characterized in that, It also includes the following steps: S4. Restore the probability distribution of each electricity consumption level to the predicted electricity consumption value. The method is as follows: The probability vector output from the model Select the element with the largest value and use the category index corresponding to that element as... Final predicted power consumption level label for each moment ; Pick The corresponding center value is denoted as As the final electricity consumption forecast .

10. The user-side electricity consumption prediction method based on multi-level state classification according to claim 1, characterized in that, It also includes the following steps: S4. Restore the probability distribution of each electricity consumption level to the predicted electricity consumption value. The method is expressed by the following formula: This represents the probability of corresponding to the i-th power consumption level at time t; This represents the cluster center value for the i-th electricity consumption level; The optimal number of cluster centers for the original electricity consumption data.