Electric quantity prediction method and device, storage medium and electronic device

By filtering out non-stable data and optimizing ARIMA model parameters, the method improves electric quantity prediction accuracy by ensuring only stable data is used for training, addressing the limitations of existing methods that rely on historical data.

CN120316733APending Publication Date: 2025-07-15HUANENG ZHEJIANG ENERGY SALES CO LTD +3
View PDF -1 Cites 0 Cited by

Patent Information

Application Number
CN202510335704.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-07-15

Smart Images

  • Figure CN120316733A_ABST
    Figure CN120316733A_ABST
Patent Text Reader

Abstract

The invention discloses an electric quantity prediction method, and the method comprises the steps: obtaining a training sample; wherein the training sample comprises sample power consumption data; wherein the sample electricity consumption data records sample electricity quantity data at a plurality of sample moments; performing stability analysis on the sample power consumption data, and inputting the sample power consumption data into a to-be-trained statistical prediction model under the condition that the sample power consumption data is represented to be stable; performing electric quantity prediction based on the to-be-trained statistical prediction model and the sample electric quantity data, and determining sample electric quantity prediction values at a plurality of sample prediction moments; determining an autocorrelation parameter of the to-be-trained statistical prediction model based on the sample electric quantity prediction values at the plurality of sample prediction moments, and obtaining an electric quantity prediction model under the condition of determining that a training completion condition is satisfied based on the autocorrelation parameter; wherein the electric quantity prediction model is used for predicting the electric quantity. The problem that the accuracy of electric quantity prediction is low in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of power systems, and in particular, to a power consumption prediction method, device, storage medium, and electronic device. Background Art

[0002] With the development of power technology, predicting power consumption can optimize resource allocation and promote the long-term stable growth of the power system.

[0003] Currently, when predicting power consumption, it mainly relies on data mining technologies such as random forests. Random forest is an ensemble learning method that improves the accuracy and stability of classification by constructing multiple decision trees and integrating their prediction results. In the process of power consumption prediction, the random forest model can predict power consumption based on historical data such as users' power consumption, electricity bills, and power consumption types. However, the limitation of this method is that it only relies on historical data, and its prediction accuracy and effectiveness are limited.

[0004] Therefore, how to more accurately predict power consumption has become an urgent problem to be solved at present. Summary of the Invention

[0005] An embodiment of this application provides a power consumption prediction method to at least solve the problem of low accuracy in power consumption prediction in related technologies.

[0006] According to an embodiment of this application, a power consumption prediction method is provided, including: obtaining training samples; wherein, the training samples include sample power consumption data; wherein, the sample power consumption data records sample power consumption data at multiple sample times; performing stationarity analysis on the sample power consumption data, and when the sample power consumption data is characterized as stationary, inputting the sample power consumption data into a statistical prediction model to be trained; performing power consumption prediction based on the statistical prediction model to be trained and the sample power consumption data, and determining sample power consumption prediction values at multiple sample prediction times; determining the autocorrelation parameter of the statistical prediction model to be trained based on the sample power consumption prediction values at the multiple sample prediction times, and when it is determined that the training completion condition is met based on the autocorrelation parameter, obtaining a power consumption prediction model; wherein, the power consumption prediction model is used to predict power consumption.

[0007] In an exemplary embodiment, the performing stationarity analysis on the sample power consumption data includes: determining a significance probability value corresponding to the sample power consumption data; when the significance probability value is less than a set probability threshold, determining that the sample power consumption data is characterized as stationary.

[0008] In an exemplary embodiment, the method further includes: when the sample power consumption data represents non-stationarity, performing a first-order difference process on the sample power consumption data to obtain stationary sample power consumption data.

[0009] In an exemplary embodiment, determining the autocorrelation parameter of the statistical prediction model to be trained based on the predicted values of the sample power consumption at the multiple sample prediction times includes: obtaining the actual values of the sample power consumption at the multiple sample prediction times; determining the model residuals at the multiple sample times based on the actual values and the predicted values of the sample power consumption at the multiple sample times; determining a residual sequence based on the model residuals at the multiple sample times; analyzing the first-order autocorrelation of the residual sequence to determine the autocorrelation parameter of the statistical prediction model to be trained.

[0010] In an exemplary embodiment, the method further includes: when the autocorrelation parameter is within a set correlation threshold range, determining that the determination of the autocorrelation parameter meets the training completion condition.

[0011] In an exemplary embodiment, the method further includes: when the autocorrelation parameter is not within the set correlation threshold range, updating the model parameters of the statistical prediction model and continuing to train the statistical prediction model based on the updated model parameters until a power consumption prediction model is obtained when it is determined that the training completion condition is met based on the autocorrelation parameter.

[0012] In an exemplary embodiment, the method further includes: obtaining historical power consumption data corresponding to a target object; wherein the historical power consumption data records historical power consumption parameters at multiple historical times; performing a stationarity analysis on the historical power consumption data, and when the historical power consumption data represents stationarity, inputting the historical power consumption data into the power consumption prediction model; performing power consumption prediction based on the power consumption prediction model and the historical power consumption data to obtain a target power consumption prediction value within a preset time period.

[0013] According to another embodiment of the embodiments of the present application, there is also provided an electricity consumption prediction device, including: an acquisition module configured to acquire training samples; wherein, the training samples include sample electricity consumption data; wherein, the sample electricity consumption data records sample electricity quantity data at a plurality of sample moments; an analysis module configured to perform stationarity analysis on the sample electricity consumption data, and input the sample electricity consumption data into a statistical prediction model to be trained when the sample electricity consumption data is characterized as stationary; a training module configured to perform electricity consumption prediction based on the statistical prediction model to be trained and the sample electricity quantity data, and determine sample electricity quantity prediction values at the plurality of sample moments; the training module is further configured to determine the autocorrelation parameter of the statistical prediction model to be trained based on the sample electricity quantity prediction values at the plurality of sample prediction moments, and obtain an electricity consumption prediction model when it is determined that the training completion condition is satisfied based on the autocorrelation parameter; wherein, the electricity consumption prediction model is used to predict electricity consumption.

[0014] According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the above method when running.

[0015] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the above processor executes the above method through the computer program.

[0016] According to another aspect of the embodiments of the present application, there is also provided a computer program product, including a computer program, and the steps in any one of the above method embodiments are implemented when the computer program is executed by a processor.

[0017] In the embodiments of the present application, by using the sample electricity consumption data as training samples and performing stationarity analysis on the sample electricity consumption data, and inputting the sample electricity consumption data into the statistical prediction model to be trained only when the sample electricity consumption data is characterized as stationary, the influence of non-stationary data on the training process can be avoided. Further, a statistical prediction model is used to predict the sample electricity consumption data to obtain sample electricity quantity prediction values at the sample prediction moments. And by analyzing the autocorrelation parameter, it is ensured that an electricity consumption prediction model with better performance can be obtained. By performing electricity consumption prediction through the electricity consumption prediction model, the accuracy of electricity consumption prediction can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation of the present application. In the drawings:

[0019] Figure 1It is a hardware structure block diagram of a computer terminal for a power consumption prediction method according to an embodiment of the present application;

[0020] Figure 2 It is a flowchart of a power consumption prediction method according to an embodiment of the present application;

[0021] Figure 3 It is another flowchart of a power consumption prediction method according to an embodiment of the present application;

[0022] Figure 4 It is a schematic diagram of the first-order residual D-W value according to an embodiment of the present application;

[0023] Figure 5 It is a schematic diagram of the power consumption situation according to an embodiment of the present application;

[0024] Figure 6 It is a structure block diagram of a power consumption prediction device according to an embodiment of the present application. Specific implementation manners

[0025] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present application.

[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data used can be interchanged under appropriate circumstances so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices; "a plurality" means two or more.

[0027] The method embodiments provided by the embodiments of the present application can be executed on a computer terminal or a similar computing device or a cloud platform or an independent physical server or a software platform, where the above software platform runs through one or more servers. Taking running on a computer terminal as an example, Figure 1 It is a hardware structure block diagram of a power consumption prediction method according to an embodiment of the present application. As Figure 1As shown, a computer terminal may include one or more ( Figure 1 only one is shown in the figure) processors 102 and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Among them, the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA. Those of ordinary skill in the art can understand that Figure 1 the structure shown in the figure is only schematic and does not limit the structure of the computer terminal. For example, the computer terminal may further include more or fewer components than Figure 1 shown in the figure, or have different configurations with the same functions as Figure 1 shown in the figure or more functions than Figure 1 shown in the figure.

[0028] The memory 104 can be used to store computer programs. For example, software programs and modules of application software, such as the computer program corresponding to the method in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, implements the above method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor 102, and these remote memories may be connected to the computer terminal through a network. Examples of the above network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and their combinations.

[0029] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the computer terminal. In one instance, the transmission device 106 includes a network adapter (abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 may be a radio frequency (abbreviated as RF) module, which is used to communicate with the Internet wirelessly.

[0030] In this embodiment, a power prediction method is provided and applied to the above computer device. Figure 2 is a flowchart of the power prediction method according to the embodiments of the present application. The process includes the following steps:

[0031] Step S202: Obtain training samples; among them, the training samples include sample power consumption data; among them, the sample power consumption data records the sample power consumption data at multiple sample times.

[0032] It should be noted that a training sample refers to a data set used to train a model, which contains the features and corresponding labels (in supervised learning) for constructing the model. For the prediction of power users' power consumption data, the training samples mainly include sample power consumption data, that is, the power consumption data recorded by users at different time points (sample times).

[0033] Sample power consumption data is a type of time series data that records the power consumption of users at multiple time points. These time points can be hours, days, weeks, months, or years, depending on the data collection frequency and prediction requirements. Each data point in the data set consists of two parts: a timestamp (sample time) and the corresponding sample power consumption data.

[0034] The recording and collection of sample power consumption data are usually completed by smart meters, sensors, or the databases of power companies. These devices or systems regularly record the power consumption of users and transmit the data to a central database or data processing system. The data collection frequency and accuracy are crucial for the training and prediction effects of the model. For example, high-frequency collection (such as every hour or daily) can provide more detailed power consumption patterns, helping the model learn more complex consumer behaviors.

[0035] Before inputting the sample power consumption data into the model, data preprocessing can be performed, including data cleaning, missing value filling, outlier detection and processing, and data format conversion, etc. Data cleaning can remove irrelevant or incorrect data, while the processing of missing values and outliers ensures the integrity and consistency of the data, avoiding negative impacts on model training.

[0036] In some embodiments, the training samples can be representative and cover various situations of power consumption, including different consumption levels, different time patterns (such as differences between weekdays and rest days), and consumption changes in different seasons, etc. The representativeness of the samples ensures that the model can learn the general laws of power consumption, rather than just the performance under specific conditions, thereby improving the generalization ability of the model.

[0037] Step S204: Conduct a stationarity analysis on the sample power consumption data. When the sample power consumption data is characterized as stationary, input the sample power consumption data into the statistical prediction model to be trained.

[0038] It is understandable that the stationarity of time series data means that the distribution characteristics of the data remain unchanged over time, that is, the mean, variance, and autocovariance of the data do not change over time. Stationarity is a prerequisite for many time series prediction models (such as ARIMA (Autoregressive Integrated Moving Average)), because non-stationary data will lead to unstable model parameter estimation and inaccurate prediction results. The main goal of stationarity analysis is to ensure that the data meets the requirements of model training, thereby improving the prediction accuracy.

[0039] In some embodiments, it is possible to analyze whether the data exhibits non-stationary characteristics such as trends, seasonality, or random fluctuations. A trend represents a continuous increase or decrease over time, seasonality represents a regularly repeating pattern of the data over time, and random fluctuations are usually irregular short-term fluctuations. If the data has obvious non-stationary characteristics, further stationarity tests are required. Commonly used stationarity test methods include the Augmented Dickey-Fuller (ADF) test, the Phillips-Perron (PP) test, and the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test. Among them, the ADF test is one of the most commonly used methods. It is based on the null hypothesis of the unit root hypothesis and tests whether the time series is stationary by constructing an autoregressive model. If the p-value of the ADF test is less than the set threshold (usually 0.05), the null hypothesis is rejected, and the time series is considered stationary; otherwise, the data is considered non-stationary.

[0040] In an exemplary embodiment, the method further includes: when the sample electricity consumption data is characterized as non-stationary, performing first-order differencing on the sample electricity consumption data to obtain stationary sample electricity consumption data.

[0041] Among them, if the sample electricity consumption data is found to be non-stationary in the preliminary analysis or test, it can be made stationary through data transformation. Common transformation methods include differencing (such as first-order differencing, second-order differencing, etc.), logarithmic differencing, seasonal differencing, etc. The purpose of differencing is to remove trends or seasonality in the data, so that the statistical characteristics of the data remain consistent over time. After data transformation, a stationarity test needs to be performed again to confirm whether the transformed data has reached a stationary state. If the transformed data passes the stationarity test, then the data can be considered stationary.

[0042] It can be understood that when the sample electricity consumption data is confirmed to be stable, these sample electricity consumption data can be input into the ARIMA model or other suitable statistical prediction models for training. The ARIMA model, namely the autoregressive integrated moving average model, can handle non-stationary data. By performing differencing operations, the data is made stationary, and then predictions are made based on the characteristics of autoregression and moving average.

[0043] In an exemplary embodiment, the performing of the stationarity analysis on the sample electricity consumption data includes: determining the significance probability value corresponding to the sample electricity consumption data; and determining that the sample electricity consumption data represents stationarity when the significance probability value is less than the set probability threshold.

[0044] It should be noted that when performing stationarity analysis, the ADF test is used to determine whether a time series has a unit root, that is, whether it is non-stationary. The ADF test is a hypothesis test. Its null hypothesis (H0) is that the time series has a unit root, that is, it is non-stationary; the alternative hypothesis (Ha) is that the time series does not have a unit root, that is, it is stationary. The ADF test calculates a statistic (ADF statistic) and obtains a p-value, that is, the significance probability value, based on this statistic. The p-value is an indicator used to measure the likelihood of rejecting the null hypothesis. The smaller the p-value, the stronger the evidence for rejecting the null hypothesis (the time series does not have a unit root and is stationary).

[0045] When performing the ADF test, a probability threshold is set, usually chosen as 0.05 or 0.01. This threshold is the critical value for determining whether a time series is stationary. If the p-value obtained from the ADF test is less than this threshold, then we have sufficient evidence to reject the null hypothesis, that is, we consider the time series to be stationary; conversely, if the p-value is greater than or equal to the threshold, the null hypothesis cannot be rejected, and the time series may be non-stationary.

[0046] If the p-value is less than the set probability threshold, we can determine that the sample electricity consumption data represents stationarity. This means that the time series characteristics of the data (such as the mean and variance) are statistically stable and do not show trends or seasonal fluctuations that change over time. Stationarity is one of the prerequisites for the ARIMA model and other time series prediction models because most prediction models assume that the data is stationary so that the model parameters can be accurately estimated and future values can be predicted.

[0047] In some embodiments, an ADF stationarity test is performed on the sample electricity consumption data of a certain user, and the obtained p-value is 0.03. The set probability threshold is 0.05. Since 0.03 is less than the threshold 0.05, there is sufficient statistical evidence to reject the null hypothesis, that is, the time series has no unit root and is stationary. This indicates that these data can be directly used to train the ARIMA model without performing differencing operations to transform the data into a stationary state. However, if in the ADF test of another sample of electricity consumption data, the obtained p-value is 0.12, given that our set threshold is 0.05 and 0.12 is greater than 0.05, the null hypothesis cannot be rejected, which means the data may be non-stationary. In this case, we may need to perform first-order differencing or higher-order differencing operations on the data and conduct the ADF test again until the data becomes stationary.

[0048] Step S206: Based on the statistical prediction model to be trained and the sample electricity quantity data, perform electricity quantity prediction to determine the sample electricity quantity prediction values at multiple sample prediction times.

[0049] Among them, before performing electricity quantity prediction, it is first necessary to ensure that the statistical prediction model has been set with appropriate parameters, such as the autoregressive order (p), differencing order (d), and moving average order (q) in the ARIMA model. The selection of these parameters is based on the analysis of the characteristics of the sample electricity quantity data, such as stationarity analysis, autocorrelation analysis, etc. The setting of the model parameters directly affects the performance and prediction accuracy of the model.

[0050] The sample electricity quantity data contains the actual electricity consumption situations at multiple sample times, and these data are used as the input for model training. In the model training stage, the sample electricity quantity data is decomposed into a training set and a validation set (and possibly a test set), where the training set is used to adjust the model parameters, and the validation set is used to evaluate the performance of the model on unseen data. The model learns the electricity quantity data patterns in the training set to predict future electricity consumption situations.

[0051] After the parameter setting and data preparation are completed, the model starts training, that is, adjusts the internal parameters of the model by minimizing the prediction error. For the ARIMA model, the training process involves estimating autoregressive coefficients, differencing operations, and moving average coefficients to ensure that the model can accurately capture features such as trends, seasonality, and random fluctuations in the sample electricity quantity data. Training is an iterative process, and the model will repeatedly adjust the parameters until the prediction error reaches the minimum or meets other predetermined stopping conditions.

[0052] Once the model training is completed, power consumption can be predicted based on the model for future sample prediction times. The sample prediction time refers to the time points of power consumption that the model will predict, and these time points are usually after the last time point of the sample power data collection. The prediction process is that the model estimates the future power data based on the learned parameters and features. For the ARIMA model, the prediction is based on the autoregressive and moving average characteristics of the past power data of the model, combined with differencing operations to predict the sample power prediction values at future sample times.

[0053] After the prediction is completed, the model will output a predicted power value for each sample prediction time, that is, the sample power prediction value. These prediction values can be compared with the actual power consumption to evaluate the prediction accuracy of the model. In practical applications, the sample power prediction values can be used in multiple scenarios, such as helping electricity sales companies predict the future power demand of users, optimizing resource allocation, and formulating power consumption strategies.

[0054] After obtaining the sample power prediction values, the accuracy and reliability of the prediction can be further analyzed. This may include calculating prediction errors (such as mean square error or mean absolute error), and then performing residual analysis, as well as checking whether the prediction values conform to the expected business logic. For example, if a user's power consumption has been increasing continuously in the past few months, the model should predict an increase in power consumption in a future month, otherwise it may be necessary to re-examine the parameter settings or data preprocessing process of the model.

[0055] Step S208: Determine the autocorrelation parameter of the statistical prediction model to be trained based on the sample power prediction values at the multiple sample prediction times. When it is determined that the training completion condition is met based on the autocorrelation parameter, obtain a power prediction model; wherein, the power prediction model is used to predict power consumption.

[0056] In an exemplary embodiment, the determining the autocorrelation parameter of the statistical prediction model to be trained based on the sample power prediction values at the multiple sample prediction times includes: obtaining the actual sample power values at the multiple sample prediction times; determining the model residuals at the multiple sample times based on the actual sample power values and the sample power prediction values at the multiple sample times; determining a residual sequence based on the model residuals at the multiple sample times; analyzing the first-order autocorrelation of the residual sequence to determine the autocorrelation parameter of the statistical prediction model to be trained.

[0057] Among them, after the prediction, it is necessary to collect the actual power consumption data corresponding to multiple sample prediction times, that is, the actual sample power values. These actual values are the basis for evaluating the prediction accuracy of the model, and their comparison with the prediction values will be used to calculate the model residuals.

[0058] The model residual refers to the difference between the model's predicted value and the actual value, that is, the prediction error. For each sample moment, we need to calculate the difference between the predicted electricity value by the model and the actual electricity consumption to obtain the model residual. The model residuals can form a sequence, namely the residual sequence. This sequence contains the prediction errors at all sample prediction moments and is the basis for evaluating the model's prediction accuracy and residual autocorrelation. The residual sequence can reflect the stability of the model prediction and the distribution characteristics of the prediction errors.

[0059] To determine the autocorrelation parameter of the model, it is necessary to analyze the first-order autocorrelation of the residual sequence. The first-order autocorrelation refers to the correlation between each value in the residual sequence and the previous value in the sequence. If there is significant first-order autocorrelation among the residuals, it indicates that the model may not fully capture the dynamic characteristics of the data, and there is a dependence relationship among the prediction errors, thus affecting the model's prediction accuracy.

[0060] One of the most commonly used methods to analyze the first-order autocorrelation is the D-W (Durbin-Watson) test. The D-W test examines the first-order autocorrelation by calculating the ratio of the variance of the differences between adjacent residuals in the residual sequence to the variance of the entire residual sequence. The statistical value of the D-W test ranges from 0 to 4, where: a D-W value close to 2 indicates no autocorrelation; a D-W value close to 0 indicates positive first-order autocorrelation; a D-W value close to 4 indicates negative first-order autocorrelation.

[0061] By performing the D-W test on the residual sequence, it can be determined whether the residual sequence has significant first-order autocorrelation. If the D-W value deviates too far from 2, that is, the residual sequence shows positive or negative first-order autocorrelation, it may be necessary to readjust the model parameters or adopt other techniques (such as increasing the model order or changing the difference order) to reduce the autocorrelation, thereby improving the model's prediction performance.

[0062] The determination of the autocorrelation parameter is a crucial step in model training. If the model residuals show significant autocorrelation, it may indicate that some parameter settings of the model are inappropriate, or there is a structure in the data that has not been fully captured by the model. During the model training and tuning process, it is very important to continuously monitor the autocorrelation of the residuals to ensure that the model can provide accurate and stable prediction results.

[0063] In some embodiments, the ARIMA model is used to predict the daily power consumption of the user for the next month, and then we collect the actual power consumption data for this month. Next: Calculate the difference between the actual power consumption and the predicted power consumption for each predicted day to obtain the model residuals. Construct a residual sequence containing all the residuals of the predicted days. Use the D-W test to analyze the first-order autocorrelation of this residual sequence. If the D-W value is close to 2, it indicates that there is no significant first-order autocorrelation in the residual sequence, the prediction error of the model is independent, and the model parameters are set properly. If the D-W value is close to 0 or 4, it indicates that there is positive or negative first-order autocorrelation, and it may be necessary to adjust the model parameters (such as increasing the order of autoregression or moving average) to reduce the autocorrelation of the residual sequence, thereby improving the prediction accuracy of the model.

[0064] In the above embodiments, determining the autocorrelation parameter of the statistical prediction model is completed by analyzing the first-order autocorrelation of the residual sequence composed of the difference between the model predicted value and the true value. This process uses statistical tools such as the D-W test to ensure the independence of the model residuals, which is a key step in evaluating and improving the model prediction performance. In practical applications, continuously monitoring and adjusting the model to maintain a residual sequence with low autocorrelation is crucial for ensuring the stability and prediction accuracy of the model.

[0065] In an exemplary embodiment, the method further includes: when the autocorrelation parameter is within the set correlation threshold range, determining that the determination of the autocorrelation parameter meets the training completion condition.

[0066] In an exemplary embodiment, the method further includes: when the autocorrelation parameter is not within the set correlation threshold range, updating the model parameters of the statistical prediction model, and continuing to train the statistical prediction model based on the updated model parameters until, when it is determined based on the autocorrelation parameter that the training completion condition is met, a power consumption prediction model is obtained.

[0067] In an exemplary embodiment, during the process of model training, a set of initial parameters will be set. For example, in the ARIMA model, the autoregressive order (p), the differencing order (d), and the moving average order (q) are set. These parameters will be used for the preliminary training of the model to obtain preliminary power consumption prediction results and autocorrelation parameters. After the preliminary training of the model, the first-order autocorrelation parameter of the residuals, that is, the D-W value, is checked to evaluate whether the prediction error of the model is independent. If the D-W value is far from 2 (i.e., there is no autocorrelation), the residuals of the model prediction are independent and the model parameters are set properly. However, if the D-W value is too low (close to 0) or too high (close to 4), it indicates the existence of positive or negative first-order autocorrelation, and the model parameters may need to be adjusted. If the autocorrelation parameter is not within the set correlation threshold range (for example, the D-W value is not between 1.5 and 2.5), the model parameters need to be adjusted to reduce the autocorrelation of the residual sequence. For the ARIMA model, this may mean adjusting the autoregressive order (p), the differencing order (d), or the moving average order (q), or combining other techniques such as Box-Cox transformation, etc., to improve the performance of the model. After updating the model parameters, the model can be retrained and the autocorrelation parameter can be checked again. This is an iterative process that may need to be repeated multiple times until the autocorrelation parameter meets the preset threshold range. In each iteration, the adjustment of the model parameters is based on the feedback of the analysis results of the autocorrelation of the residual sequence, in order to obtain more stable prediction errors.

[0068] When the autocorrelation parameter falls within the set correlation threshold range, the model training is completed, that is, the residuals of the model prediction have good independence. The establishment of the training completion condition is usually based on the following criteria: the D-W value is close to 2, indicating that there is no significant autocorrelation between the residuals. The error metrics (such as the mean squared error MSE, the mean absolute error MAE, etc.) reach an acceptable level, indicating that the prediction accuracy of the model is relatively high. The prediction ability of the model performs well on the validation set, that is, the model can not only fit the training data, but also make reliable predictions on unseen data.

[0069] In an exemplary embodiment, the method further includes: obtaining historical power consumption data corresponding to the target object; wherein, the historical power consumption data records historical power consumption parameters at multiple historical times; performing stationarity analysis on the historical power consumption data, and when the historical power consumption data is characterized as stationary, inputting the historical power consumption data into the power consumption prediction model; performing power consumption prediction based on the power consumption prediction model and the historical power consumption data to obtain a target power consumption prediction value within a preset time period.

[0070] Among them, the electricity consumption data of target power users (such as industrial customers, commercial customers or residential users) at multiple historical moments can be collected. Historical electricity consumption data usually includes the electricity consumption records of users in the past period (such as several months or years), and these records reflect the historical electricity quantity parameters of users at different time points, such as total electricity consumption, average electricity consumption, peak electricity consumption, etc. These data can be obtained through the customer electricity consumption records of power companies, smart meter readings or other monitoring systems.

[0071] Before inputting the historical electricity consumption data into the electricity quantity prediction model, stationarity analysis is required to ensure that the data meets the training and prediction requirements of the model. Stationarity means that the statistical characteristics (such as mean, variance and autocovariance) of the time series remain unchanged over time and do not change systematically over time. Stationarity analysis usually includes: Trend analysis: Check whether there is a long-term trend in the time series, that is, a pattern of increasing or decreasing over time. Seasonal analysis: Analyze whether there are periodic patterns in the time series, such as seasonal changes in a year or differences between weekdays and weekends in a week. Unit root test: Use statistical tests (such as ADF test) to determine whether the time series has a unit root, that is, whether it is non-stationary.

[0072] If the historical electricity consumption data is determined to be stationary in these analyses, the data can be directly input into the model for training. If the data is non-stationary, it may be necessary to make the data stationary through differencing processing (such as first-order differencing or seasonal differencing). After confirming the stationarity of the data, the historical electricity consumption data can be used as the input for model training. This step is the basis for the model to learn data patterns and features. Through training, the model will be able to capture the electricity consumption habits, trends and seasonal changes of users, providing a basis for predicting future electricity usage. Further, use the electricity quantity prediction model to predict the electricity quantity within a certain future period. The preset time period refers to the future time period that we are interested in and need to predict, which can be a specific date range (such as the next quarter, next month, etc.).

[0073] In a specific application, assume that the goal is to predict the electricity consumption of a large manufacturing user in the next month. The process is as follows: Collect the daily electricity consumption data of this user in the past year as historical electricity consumption data. Use the ADF test to analyze the stationarity of the historical electricity consumption data. If the p-value of the ADF test is less than the preset threshold (such as 0.05), the data is considered stationary. Input the stationary historical electricity consumption data into the trained ARIMA model. Based on the ARIMA model, predict the daily electricity consumption in the next month to obtain the target electricity quantity prediction value.

[0074] In the above steps S202 - S208, by using the sample electricity consumption data as the training sample and conducting the stationarity analysis of the sample electricity consumption data, the sample electricity consumption data is input into the statistical prediction model to be trained only when the sample electricity consumption data is characterized as stationary, which can avoid the influence of non - stationary data on the training process. Further, a statistical prediction model is used to predict the sample electricity consumption data, and the predicted value of the sample electricity consumption at the sample moment is obtained. And by analyzing the autocorrelation parameters, it is ensured that a more optimal electricity consumption prediction model can be obtained. By using the electricity consumption prediction model to carry out electricity consumption prediction, the accuracy of electricity consumption prediction can be effectively improved.

[0075] In an exemplary embodiment, referring to Figure 3 as shown, it is a schematic flowchart of the electricity consumption prediction method of the present application:

[0076] During the electricity consumption prediction process, the user data is traversed and the stationarity test is carried out. For stationary data, the white noise test can be directly carried out. For non - stationary sequences, that is, non - stationary user data, it is converted into a stationary sequence through first - order differencing. After the first - order differencing is completed, the stationarity verification needs to be carried out again. After the stationarity verification passes, the white noise test can be carried out, and an ARIMA model is further constructed, and then the constructed ARIMA model is used to predict the electricity consumption of all users in the next month.

[0077] In the process of constructing the ARIMA model, steps such as selecting model parameters and fitting the model are involved. Specifically, the ARIMA model, that is, the Autoregressive Integrated Moving Average Model, is a statistical method for time - series prediction. It combines three parts: autoregressive (AR), differencing (I), and moving average (MA), and is applicable to the prediction and analysis of non - stationary time series. The ARIMA model can handle non - stationary time - series data. It makes the data stationary through differencing, and then combines the AR and MA models to predict future values. The "I" in the model represents differencing, which is used to make the time series stationary; the "AR" part uses past values for autoregression; the "MA" part focuses on the moving average of the prediction error. Due to its ability to handle non - stationary data and provide accurate predictions, the ARIMA model has been widely used in time - series prediction tasks in fields such as economics, finance, and meteorology. Through the autoregression and moving average of historical data, the ARIMA model can effectively capture the linear dependence relationship between data and be used to predict future trends.

[0078] Based on the fitted ARIMA model, predict the electricity consumption and store the prediction results. In the time series analysis using the ARIMA model, it is necessary to ensure that there is no autocorrelation among the model residuals (i.e., prediction errors). If there is autocorrelation among the residuals, the model's prediction may be inaccurate, and standard statistical inferences (such as confidence intervals and prediction intervals) may also fail.

[0079] The basic principle of the D-W (Durbin-Watson) test is to compare the adjacent differences among the residuals with their overall variance, which is a statistical test for detecting first-order autocorrelation in time series data. The test statistic D-W value ranges between 0 and 4. A D-W value close to 2 indicates no autocorrelation among the residuals (i.e., they are independent), while a D-W value close to 0 or 4 indicates positive or negative autocorrelation. The calculation of the D-W test is shown in the following formula:

[0080]

[0081] where d refers to the calculated D-W value, et is the residual at the t-th time, et-1 is the residual at the (t - 1)-th time, and ∑ is the sum from the 2nd time to the t-th time for t.

[0082] This application uses the above formula to calculate the D-W values of the first-order residuals of the users in the dataset. The results are shown in Figure 4 . It can be seen from Figure 4 that the results are basically close to 2, and the non-stationary time series of these users all become stationary time series after first-order differencing, indicating that a good effect can be achieved by establishing a user power consumption prediction model based on the ARIMA model.

[0083] Furthermore, in the actual business process, based on the power consumption prediction model established by ARIMA, the power consumption of potential high-value users can be predicted. As shown in Figure 5 , the predicted power consumption results of each sorted user are shown. The horizontal axis represents the user number, and the vertical axis represents the predicted power consumption result (kW·h). It can be seen from Figure 5 that the user numbers in the top 5 (the specific number of recommended users can be freely set) are 1416, 175, 174, 129, and 90 respectively, and the predicted power consumption is 611491 kWh, 566800 kWh, 449718 kWh, 124083 kWh, and 118477 kWh. By sorting the results of the user energy consumption prediction model, the top users with higher energy consumption next month can be screened out to complete the mining of potential high-value users.

[0084] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of the various embodiments of the present application.

[0085] The embodiment of the present application also provides a structural block diagram of a power consumption prediction device. Figure 6 It is a structural block diagram of the power consumption prediction device according to the embodiment of the present application; as Figure 6 shown, it includes:

[0086] An acquisition module 62, configured to acquire training samples; wherein, the training samples include sample power consumption data; wherein, the sample power consumption data records sample power consumption data at multiple sample times;

[0087] An analysis module 64, configured to perform stationarity analysis on the sample power consumption data, and when the sample power consumption data is characterized as stationary, input the sample power consumption data into a statistical prediction model to be trained;

[0088] A training module 66, configured to perform power consumption prediction based on the statistical prediction model to be trained and the sample power consumption data, and determine sample power consumption prediction values at the multiple sample times;

[0089] The training module 66 is further configured to determine the autocorrelation parameter of the statistical prediction model to be trained based on the sample power consumption prediction values at the multiple sample prediction times, and when it is determined that the training completion condition is met based on the autocorrelation parameter, obtain a power consumption prediction model; wherein, the power consumption prediction model is used to predict power consumption.

[0090] Through the above device, by using the sample power consumption data as training samples and performing stationarity analysis on the sample power consumption data, and only inputting the sample power consumption data into the statistical prediction model to be trained when the sample power consumption data is characterized as stationary, the influence of non-stationary data on the training process can be avoided. Further, a statistical prediction model is used to predict the sample power consumption data to obtain sample power consumption prediction values at the sample times. And by analyzing the autocorrelation parameter, it is ensured that a power consumption prediction model with better performance can be obtained. By performing power consumption prediction through the power consumption prediction model, the accuracy of power consumption prediction can be effectively improved.

[0091] In an exemplary embodiment, the analysis module 64 is further configured to determine a significance probability value corresponding to the sample power consumption data; and determine that the sample power consumption data represents stability when the significance probability value is less than a set probability threshold.

[0092] In an exemplary embodiment, the analysis module 64 is further configured to, when the sample power consumption data represents non - stability, perform a first - order difference process on the sample power consumption data to obtain stable sample power consumption data.

[0093] In an exemplary embodiment, the training module 66 is further configured to obtain the actual sample power values at the multiple sample prediction times; determine the model residuals at the multiple sample times based on the actual sample power values and the predicted sample power values at the multiple sample times; determine a residual sequence based on the model residuals at the multiple sample times; analyze the first - order autocorrelation of the residual sequence, and determine the autocorrelation parameter of the statistical prediction model to be trained.

[0094] In an exemplary embodiment, the training module 66 is further configured to determine that the determination of the autocorrelation parameter meets the training completion condition when the autocorrelation parameter is within a set correlation threshold range.

[0095] In an exemplary embodiment, the training module 66 is further configured to, when the autocorrelation parameter is not within the set correlation threshold range, update the model parameters of the statistical prediction model, and continue to train the statistical prediction model based on the updated model parameters until a power prediction model is obtained when it is determined that the training completion condition is met based on the autocorrelation parameter.

[0096] In an exemplary embodiment, the device further includes a prediction module; the prediction module is configured to obtain historical power consumption data corresponding to a target object; wherein the historical power consumption data records historical power parameters at multiple historical times; perform a stationarity analysis on the historical power consumption data, and when the historical power consumption data represents stability, input the historical power consumption data into the power prediction model; perform power prediction based on the power prediction model and the historical power consumption data to obtain a target power prediction value within a preset time period.

[0097] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein the above - mentioned program executes the method of any one of the above when running.

[0098] Optionally, in this embodiment, the above - mentioned storage medium may be set to store program codes for performing the following steps:

[0099] S1. Obtain training samples, where the training samples include sample power consumption data, and the sample power consumption data records sample power quantity data at multiple sample times.

[0100] S2. Conduct a stationarity analysis on the sample power consumption data. When the sample power consumption data is characterized as stationary, input the sample power consumption data into the statistical prediction model to be trained.

[0101] S3. Perform power quantity prediction based on the statistical prediction model to be trained and the sample power quantity data, and determine the sample power quantity prediction values at the multiple sample times.

[0102] S4. Determine the autocorrelation parameter of the statistical prediction model to be trained based on the sample power quantity prediction values at the multiple sample prediction times. When it is determined that the training completion condition is met based on the autocorrelation parameter, obtain a power quantity prediction model, where the power quantity prediction model is used to predict power quantity.

[0103] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0104] Optionally, the above electronic device may further include a transmission device and an input / output device, where the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0105] Optionally, in this embodiment, the above processor may be configured to execute the following steps through a computer program:

[0106] S1. Obtain training samples, where the training samples include sample power consumption data, and the sample power consumption data records sample power quantity data at multiple sample times.

[0107] S2. Conduct a stationarity analysis on the sample power consumption data. When the sample power consumption data is characterized as stationary, input the sample power consumption data into the statistical prediction model to be trained.

[0108] S3. Perform power quantity prediction based on the statistical prediction model to be trained and the sample power quantity data, and determine the sample power quantity prediction values at the multiple sample times.

[0109] S4. Determine the autocorrelation parameter of the statistical prediction model to be trained based on the sample power quantity prediction values at the multiple sample prediction times. When it is determined that the training completion condition is met based on the autocorrelation parameter, obtain a power quantity prediction model, where the power quantity prediction model is used to predict power quantity.

[0110] Optionally, in this embodiment, the above storage medium may include, but is not limited to: various media that can store program codes such as USB flash drives, read-only memories (ROM), random access memories (RAM), mobile hard disks, magnetic disks, or optical discs.

[0111] An embodiment of the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0112] Another embodiment of the present application also provides a computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0113] An embodiment of the present application also provides a computer program. The computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in any of the above method embodiments.

[0114] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and will not be elaborated herein.

[0115] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order from here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the present application is not limited to any specific combination of hardware and software.

[0116] The above are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for predicting electric quantity, characterized in that, Including: Obtain training samples; wherein, the training samples include sample power consumption data; wherein, the sample power consumption data records sample power quantity data at multiple sample moments; Perform stationarity analysis on the sample power consumption data, and when the sample power consumption data represents stationarity, input the sample power consumption data into a statistical prediction model to be trained; Perform power quantity prediction based on the statistical prediction model to be trained and the sample power quantity data, and determine sample power quantity prediction values at multiple sample prediction moments; Determine the autocorrelation parameter of the statistical prediction model to be trained based on the sample power quantity prediction values at the multiple sample prediction moments, and when it is determined that the training completion condition is satisfied based on the autocorrelation parameter, obtain a power quantity prediction model; wherein, the power quantity prediction model is used to predict power quantity.

2. The method according to claim 1, wherein The performing stationarity analysis on the sample power consumption data includes: Determine the significance probability value corresponding to the sample power consumption data; When the significance probability value is less than a set probability threshold, determine that the sample power consumption data represents stationarity.

3. The method according to claim 1, wherein The method further includes: When the sample power consumption data represents non-stationarity, perform first-order difference processing on the sample power consumption data to obtain stationary sample power consumption data.

4. The method according to claim 1, characterized in that The determining the autocorrelation parameter of the statistical prediction model to be trained based on the sample power quantity prediction values at the multiple sample prediction moments includes: Obtain the actual sample power quantity values at the multiple sample prediction moments; Determine the model residuals at the multiple sample moments based on the actual sample power quantity values and the sample power quantity prediction values at the multiple sample moments; Determine a residual sequence based on the model residuals at the multiple sample moments; Analyze the first-order autocorrelation of the residual sequence to determine the autocorrelation parameter of the statistical prediction model to be trained.

5. The method according to claim 1, characterized in that, The method further includes: When the autocorrelation parameter is within a set correlation threshold range, determine that the autocorrelation parameter determines that the training completion condition is satisfied.

6. The method according to claim 1, wherein The method further includes: When the autocorrelation parameter is not within the set correlation threshold range, update the model parameters of the statistical prediction model, and continue to train the statistical prediction model based on the updated model parameters until a power quantity prediction model is obtained when it is determined that the training completion condition is satisfied based on the autocorrelation parameter.

7. The method according to claim 1, characterized in that, The method further includes: Obtain historical power consumption data corresponding to a target object; wherein, the historical power consumption data records historical power quantity parameters at multiple historical moments; Perform stationarity analysis on the historical power consumption data, and when the historical power consumption data represents stationarity, input the historical power consumption data into the power quantity prediction model; Perform power quantity prediction based on the power quantity prediction model and the historical power consumption data to obtain target power quantity prediction values within a preset time period.

8. An electric quantity prediction device, characterized in that, Including: An acquisition module for obtaining training samples; wherein, the training samples include sample power consumption data; wherein, the sample power consumption data records sample power quantity data at multiple sample moments; An analysis module for performing stationarity analysis on the sample power consumption data, and inputting the sample power consumption data into a statistical prediction model to be trained when the sample power consumption data is characterized as stationary; A training module for performing power prediction based on the statistical prediction model to be trained and the sample power data, and determining the sample power prediction values at the multiple sample times; The training module is further configured to determine the autocorrelation parameter of the statistical prediction model to be trained based on the sample power prediction values at the multiple sample prediction times, and obtain a power prediction model when it is determined that the training completion condition is satisfied based on the autocorrelation parameter; wherein, the power prediction model is used to predict power.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when running, executes the method described in any one of claims 1 to 7 above.

10. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to execute the method described in any one of claims 1 to 7 through the computer program.