Electricity consumption prediction method based on user behavior probability and bidirectional long short-term memory network
Patent Information
- Application Number
- CN202610944264.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-29
- Publication Date
- 2026-10-13
AI Technical Summary
[0004]1.行为因素表征不足:现有方法大多仅使用历史电量、环境参数和时间特征,难以准确反映设备使用行为的持续性、随机性与突发性,导致对随机扰动较强对象的预测精度不足;
[0044]1.本发明通过统一待预测对象的边界识别方式,提高了预测对象定义的一致性,减少了因计量边界不一致导致的数据偏差;
Smart Images

Figure CN122905261A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power system and artificial intelligence technology, specifically relating to a power prediction method based on user behavior probability and bidirectional long short-term memory network. Background Technology
[0002] Currently, power forecasting is widely used in power grid dispatching, load management, demand response, energy-saving control, and energy optimization. Existing technologies typically employ the following methods: ① Traditional statistical forecasting methods: These mainly include time series analysis, exponential smoothing, grey forecasting, and regression analysis. These methods have low computational complexity and are suitable for objects with strong regularity and relatively stable fluctuations, but their adaptability to complex nonlinear relationships and sudden behavioral disturbances is limited. ② Machine learning forecasting methods: These mainly include support vector machines, random forests, and gradient boosting trees. These methods can enhance nonlinear fitting capabilities by introducing environmental, meteorological, and time variables, thereby improving forecast accuracy to some extent. However, they are less effective for long-term time-series dependent information. The utilization of information and bidirectional temporal features is still insufficient; ③ Deep learning prediction methods: In recent years, convolutional neural networks, long short-term memory networks, bidirectional long short-term memory networks and their combined models have been gradually applied to the field of power generation prediction; convolutional networks are good at extracting local features, and LSTM-type networks are good at handling temporal dependencies, but a single model often cannot simultaneously take into account random behavior features, environmental influences and long and short temporal coupling information; ④ Multi-source data-driven prediction methods: Existing research has begun to simultaneously introduce historical power generation, environmental parameters, external meteorological information and temporal features to improve the model's adaptability to complex working conditions; however, most methods still mainly use conventional input variables and lack specific modeling for user behavior persistence, activity intensity and behavior randomness;
[0003] The existing technology has the following main shortcomings:
[0004] 1. Insufficient representation of behavioral factors: Most existing methods only use historical electricity consumption, environmental parameters and time characteristics, which are difficult to accurately reflect the continuity, randomness and suddenness of equipment usage behavior, resulting in insufficient prediction accuracy for objects with strong random disturbances;
[0005] 2. High cost of obtaining occupancy status: If the number of people or activity status is collected directly, it usually requires the additional deployment of sensors or video monitoring equipment, which has problems such as high implementation costs and great privacy risks;
[0006] 3. Limited one-way temporal series modeling capability: Although traditional LSTM can learn temporal dependencies, it does not make sufficient use of the joint forward and backward information, making it difficult to fully extract contextual features in complex temporal series.
[0007] 4. Model parameters rely on empirical settings: The network parameters, learning rate, and training structure of deep learning prediction models are usually set by human experience, which can easily lead to local optima and affect prediction stability and generalization ability. Therefore, it is necessary to provide a power prediction method based on user behavior probability and bidirectional long short-term memory network to achieve high-precision prediction, improve adaptability to random behavior disturbances, and enhance prediction stability. Summary of the Invention
[0008] The purpose of this invention is to overcome the shortcomings of the prior art and provide a power prediction method based on user behavior probability and bidirectional long short-term memory network, which achieves high-precision prediction, improves adaptability to scenarios with random behavior disturbances, and enhances prediction stability.
[0009] The objective of this invention is achieved as follows: a power prediction method based on user behavior probability and bidirectional long short-term memory network, comprising the following steps:
[0010] Step 1: Identify the electricity users to be predicted, collect historical electricity consumption time series data, electricity consumption information of the previous period, environmental data and external meteorological data corresponding to the target users, and complete the collection of multi-source time series data with hourly as the unified time granularity;
[0011] Step 2: Use spatial carbon dioxide monitoring concentration as a proxy variable for occupancy to indirectly characterize the intensity of activities or occupancy status within the space, replacing human monitoring; construct a conventional influencing factor input system and a user behavior probability input system;
[0012] Step 3: Establish a user behavior probability model based on the proportion of usage duration of each electrical device during the target time period to reflect the operating intensity and behavior continuity of the device during that time period; use the Pearson correlation coefficient method to complete the redundancy screening of candidate input variables, perform normalization transformation on the screened input and output datasets, and complete the construction of time series samples according to a fixed time window;
[0013] Step 4: Establish a bidirectional long short-term memory (Bi-LSTM) prediction model, utilize the network's bidirectional time series extraction capability to mine forward and backward load correlation features, and predict the electricity consumption for the target period; introduce the whale optimization algorithm to perform global iterative optimization of the key hyperparameters of the Bi-LSTM network, obtain the optimal electricity consumption prediction model, and output the electricity consumption prediction results for the target period based on the optimized model.
[0014] In step 1, the electricity consumption objects to be predicted are uniformly divided into physical boundaries and metering and statistical boundaries based on the topology of the distribution branches, so as to achieve uniform statistical standards for all collected data and ensure that the input features and output electricity sequences match one-to-one in terms of time scale and metering objects.
[0015] In this invention, during the process of dividing the boundary of the prediction object, there is a problem that different electricity users have both combined access and independent access. To address this, the distribution branch relationship is used for unified division to ensure that the prediction object is consistent with the metering boundary.
[0016] The historical electricity time series data in step 1 represents the measured electricity consumption sequence of the electricity user to be predicted within a continuous historical statistical period;
[0017] The electricity consumption information of the previous time period refers to the electricity consumption or power value of the time period immediately preceding the target time period, and is used to characterize short-term inertial characteristics;
[0018] The environmental data includes air temperature, carbon dioxide concentration, air humidity, and PM2.5 concentration;
[0019] The external meteorological data includes one or more of the following: external air temperature, external air humidity, solar irradiance, wind speed, rainfall status, and air pressure.
[0020] The construction of the multi-source time-series data sample set in step 1 is as follows:
[0021] Perform time-scale interpolation alignment on raw data with different sampling frequencies to unify the sampling interval;
[0022] Hierarchical imputation of missing values: isolated single-point missing values are imputed using nearest-time interpolation; short-term continuous trend missing values are imputed using smoothing estimation with moving average method.
[0023] Outlier hierarchical correction: Single-point extreme outlier data is corrected using the threshold truncation method; for extreme outliers, i.e., cases with multiple adjacent outliers or large outlier deviations, the median replacement method is used.
[0024] The cleaned and calibrated multi-source data are concatenated into an original multi-source feature vector according to a unified timestamp. Based on a preset time-series sliding window and prediction step size, the time-series samples are structured to generate a multi-source time-series sample set.
[0025] The method for constructing the relevant proxy variables in step 2 is as follows:
[0026] Extract the raw carbon dioxide monitoring concentration values and standardize them;
[0027] By relying on the concentration change rate between adjacent time periods to characterize the dynamic change trend of spatial occupancy status, dynamic change information is enhanced; and an occupancy intensity index that integrates the absolute value of concentration and the concentration change rate is constructed to balance the contribution of absolute level and change trend.
[0028] A threshold determination method is introduced, which uses predicted hierarchical thresholds to discretely divide the space occupancy status into multi-level state variables.
[0029] In this invention, during the behavioral factor modeling process, the number of actions alone cannot reflect the differences in energy intensity. Therefore, a user behavior probability model based on the duration ratio is used to improve the explanatory power of behavioral features for changes in electricity consumption.
[0030] The conventional influencing factor input system in step 2 includes historical electricity consumption, time characteristics, environmental parameters, external meteorological parameters, and occupancy-related proxy variables. Its construction method is as follows: Let the first... The regular input feature vector at each time step is: ,in, This represents the historical electricity consumption for the current time period. This is the electricity consumption information for the previous time period; This refers to the concentration of carbon dioxide. Air temperature; Air humidity; This refers to the particulate matter concentration. Wind speed; Solar irradiance; It is a time-related feature;
[0031] The user behavior probability input system includes historical electricity consumption and user behavior probability sequences, and its construction method is as follows: Let the first... The behavioral input feature vector at each time step is: ,in, For user behavior probability;
[0032] The two types of input systems are merged to form an integrated combined input system for the model input: ,Right now: .
[0033] The construction rule for the user behavior probability model in step 3 is as follows: Let the target time period be... arrive The total number of devices is , No. The usage duration of each device during this period is To differentiate the actual power consumption differences between high-power and low-power devices under the same operating time, the rated power of the device is introduced as a weight, and the power-weighted behavior probability is defined as follows: ,in, The total duration of the target period; For the first The rated power of each device; For the first The actual usage duration of each device within the target time period; in the above formula, the numerator is the sum of the weighted actual power consumption duration of all devices within the target time period, and the denominator is the sum of the theoretical maximum power consumption duration of all devices running at full load throughout the entire period, which serves as the normalization benchmark. The closer the value is to 1, the greater the continuous high-intensity operation of high-power equipment during the target period and the greater its contribution to the electricity load.
[0034] With state variables Indicates equipment At any moment The switching states, where: Then, under discrete-time conditions, the device duration can be expressed as: Discretize the target time period at equal intervals; within the target time period, there are a total of If there are 1 sampling point, then: Therefore, the probability of behavior can also be written as: This definition method is based on the summation of discrete 0-1 state variables of the device switch to the equivalent power-on time, and completes the equivalent conversion of behavior probability in the discrete time dimension. It relies on probability values to more accurately represent the operating intensity and continuity of power consumption behavior of the device in the target time period.
[0035] In step 3, Pearson correlation input features are used to quantify the linear correlation between the features and the target electricity level. Valid input features are then selected based on the correlation coefficient threshold. Specifically, this involves using several sets of collected data... Calculate the correlation coefficient. In the formula, They are respectively The mean of the experimental values;
[0036] The data normalization process employs the Min-Max extreme value normalization algorithm to achieve full feature dimension normalization, specifically as follows: ,in, For input values; This is the point of maximum value; It is the point of minimum value; This is the expected standardized value;
[0037] The time series sample construction is based on a fixed input window length and prediction step size, reorganizing one-dimensional time series features into a time series sample matrix adapted to the Bi-LSTM input format. Specifically, let the window length be... The predicted step size is After screening The feature vector at time t is The input sample is: .
[0038] In this invention, during the multi-source variable input process, environmental variables and meteorological variables have different dimensions and significant differences in correlation. Feature screening and normalization preprocessing improve the consistency of input data.
[0039] The establishment of the Bi-LSTM prediction model in step 4 is as follows: The Bi-LSTM network extracts the bi-directional temporal hidden states sequentially through forward LSTM and backward LSTM. After weighting by the weight matrix, activation function mapping, and bias term compensation, the bi-directional hidden states are fused to obtain the final output feature vector at a single time step. : ,in, For activation functions; This is the weight matrix of the forward LSTM; For the first The forward LSTM hides the state at each time step; This is the weight matrix for the backward LSTM; For the first The backward LSTM hidden state at each time step; This is a bias term.
[0040] In step 4, the whale optimization algorithm is used to optimize the parameters of the Bi-LSTM model. The optimization targets include: the number of hidden layer units in the Bi-LSTM, the model learning rate, the batch size, and the number of training iterations. Proportion, temporal input window length; using validation set prediction error as a population fitness index. After multiple rounds of population iteration, the parameter combination with the minimum fitness value is selected as the optimal parameter combination. , Based on the optimal parameter combination Reconstructing the Bi-LSTM power prediction model;
[0041] The sample to be predicted is input into the optimized model, and the electricity prediction result for the target time period is calculated through the model mapping function: ,in, Indicates The optimized Bi-LSTM mapping function.
[0042] In this invention, Bi-LSTM has a large number of parameters during model training, which can easily lead to low training efficiency and local optima. Therefore, the whale optimization algorithm is introduced to search for parameters, and chaotic mapping initialization and adaptive weight adjustment are used to improve the optimization effect.
[0043] The beneficial effects of this invention are:
[0044] 1. This invention improves the consistency of the definition of the predicted object and reduces data deviation caused by inconsistent measurement boundaries by unifying the boundary identification method of the object to be predicted;
[0045] 2. By introducing user behavior probability features, this invention enables the model to characterize the persistence of device use and the intensity of behavior, thereby enhancing the ability to identify random behavioral disturbances.
[0046] 3. This invention reduces implementation costs and improves the engineering feasibility of the solution by using carbon dioxide concentration instead of direct human monitoring;
[0047] 4. This invention improves the modeling capability of complex temporal relationships by constructing a Bi-LSTM model and utilizing both forward and backward temporal features.
[0048] 5. This invention improves the quality of model parameter configuration and enhances prediction accuracy and result stability by introducing the whale optimization algorithm to perform a global search of model parameters;
[0049] 6. The method of the present invention can directly serve scenarios such as short-term power forecasting, load management, demand response, and energy optimization, and has good application value; the present invention has the advantages of achieving high-precision forecasting, improving adaptability to scenarios with random behavioral disturbances, and enhancing forecast stability. Attached Figure Description
[0050] Figure 1 This is a flowchart of the present invention.
[0051] Figure 2 This is a schematic diagram of the LSTM and Bi-LSTM structures of the present invention.
[0052] Figure 3 This is a flowchart of the WO-optimized Bi-LSTM of the present invention. Detailed Implementation
[0053] The present invention will now be further described with reference to the accompanying drawings.
[0054] Example 1
[0055] like Figure 1-3 As shown, the power prediction method based on user behavior probability and bidirectional long short-term memory network includes the following steps:
[0056] Step 1: Identify the object to be predicted, obtain historical electricity data, electricity consumption information of the previous period, environmental data and external meteorological data, and construct a multi-source time series data sample set according to the hourly time scale;
[0057] In this embodiment, the physical boundary and measurement boundary of the object to be predicted are first determined in order to unify the data collection criteria and ensure the consistency of the input variables and the output power sequence in terms of time scale and measurement object.
[0058] After identifying the object to be predicted, the corresponding raw time-series data is collected. The raw time-series data includes at least historical electricity consumption data, electricity consumption information of the previous period, environmental data, and external meteorological data.
[0059] Among them, historical electricity data represents the actual electricity consumption of the object to be predicted over multiple consecutive historical periods; the electricity consumption information of the previous period represents the electricity or power value of the period immediately preceding the target period, used to characterize short-term inertial characteristics; environmental data includes air temperature, carbon dioxide concentration, air humidity, PM2.5 concentration, etc.; external meteorological data includes one or more of the following: external air temperature, external air humidity, solar irradiance, wind speed, rainfall status, and air pressure.
[0060] Preferably, all raw data are aligned according to a uniform time interval. If the original sampling granularity is different, a time scale transformation is performed first. The total electricity consumption for the target time period can be expressed as: ,in, For the first Total electricity consumption for each target time period; For the first Within the target time period, the first The electrical charge values of each original sampling point; For the first The number of original sampling points included within each target time period.
[0061] For missing values, the nearest-time interpolation method can be used for repair. For missing observations at a given time point, the following can be used: ;
[0062] If the moving average method is used, then: ,in, These are the missing values to be imputed; These are the data values of adjacent times before and after the time to be interpolated; The length of the sliding window; The number of times before the current moment Data values at each time point.
[0063] Specifically, the two missing value handling methods mentioned above are applicable to different situations and can be flexibly selected according to the actual missing value situation: the nearest-time interpolation method is suitable for isolated or sporadic single-point missing values, which directly interpolates using the valid data immediately before and after the missing time, is simple to calculate, and can better preserve local trends; the moving average method is suitable for short-term continuous missing values with a certain continuous trend, which smooths the estimation of missing values by using the mean within the historical window, and has good robustness to noise. In practical applications, the nearest-time interpolation method can be used first to handle isolated missing points, and then the moving average method can be used to complete continuous missing segments; if the missing value situation is relatively simple, only one method can be used for processing.
[0064] Outliers can be handled using threshold truncation or median replacement methods. Let the variable... The upper and lower thresholds are respectively and The correction value can then be written as: ,in, These are the corrected data values; The original data value; The threshold for outliers; This is the threshold for outliers.
[0065] When using the median replacement method to handle outliers, for those that satisfy... or The abnormal observation point is selected with a length of [missing information] centered on that time. A sliding window is used, and the median of all valid data points within the window (excluding outliers) is taken as the replacement value. That is, after obtaining the cleaned data of various types, they are concatenated according to a unified time index to construct a multi-source time series sample set; let the first... The original multi-source feature vector at each time step is: .
[0066] Compared to the threshold truncation method, the median replacement method is more robust to extreme outliers, especially suitable for situations with multiple adjacent outliers or large deviations between outliers; the threshold truncation method is more suitable for handling single extreme outliers, and is simple to operate and computationally efficient; in practical applications, the appropriate method can be selected according to the distribution characteristics and number of outliers.
[0067] ,in, This represents the historical electricity consumption for the current time period. This is the electricity consumption information for the previous time period; Air temperature; This refers to the concentration of carbon dioxide. Air humidity; This refers to the particulate matter concentration. Wind speed; For example, is the solar irradiance; the rest are other optional variables; the left side of the equation is the th... The original multi-source feature vector at each time point, with each component on the right side of the equals sign corresponding to the observations from various data sources.
[0068] Furthermore, to construct supervised learning samples, let the input time window length be... The predicted step size is Then the first Each input sample can be constructed as: The corresponding prediction target is: ,in, For multi-source time-series input samples; The target period's electricity consumption; To predict step size Target electricity consumption values for each time period within the period;
[0069] The supervised learning sample set constructed above constitutes the multi-source time series sample set in step 1; in other words, the multi-source time series sample set is formed by processing the cleaned multi-source time series data according to a fixed time window. and prediction step size After sampling, each sample contains The multidimensional feature input sequence at each time point and the corresponding target charge are conceptually consistent.
[0070] Step 2: Use carbon dioxide concentration as a proxy variable for occupancy to indirectly characterize the intensity of activity or occupancy status within a space, replacing personnel monitoring; construct two types of input systems, including a conventional influencing factor input system and a user behavior probability input system;
[0071] In this embodiment, ① the relevant proxy variables are used to construct
[0072] Considering that direct personnel number monitoring usually requires cameras, infrared counters or access control statistical devices, which not only increases deployment costs but also easily raises privacy issues, this implementation uses carbon dioxide concentration as a proxy variable for occupancy to indirectly characterize the intensity of activity or occupancy level.
[0073] The carbon dioxide concentration value can be directly retrieved by using the proxy variable: The standardized carbon dioxide concentration is expressed as: ,in, This represents the mean of the historical CO2 concentration series. These are the minimum and maximum values of the historical CO2 concentration sequence.
[0074] Enhance dynamic change information by utilizing the rate of change between adjacent time periods. This represents the difference in CO2 concentration between adjacent time periods, used to reflect the dynamic trend of space occupancy status. Define the occupancy intensity index: ,in, and These are weighting coefficients used to balance the contribution of absolute levels and trends of change. and Satisfy constraints ,and In practical applications, when the absolute value of carbon dioxide concentration is relatively stable, the concentration can be appropriately increased. When there is frequent movement of people in the space and the concentration change rate contains more occupancy information, the concentration can be appropriately increased. ; default value .
[0075] By introducing a threshold determination method, the occupancy state is discretized into multi-level state variables: ,in, The level of occupancy status; This is a preset threshold.
[0076] Specifically, the methods for determining the thresholds at each level are as follows: Based on the historical statistical distribution of the occupancy intensity index, the percentile method is used to delineate the grading boundaries; taking a three-level division as an example, the 33rd percentile of the historical data can be taken as the first threshold. The 66th percentile is the second threshold. When the occupancy intensity index is less than It is determined to be in a low-occupancy state, between and The period between is a medium occupancy state, greater than The time frame indicates a high occupancy rate; in actual engineering projects, the quantile threshold can be adjusted based on building type, operational patterns, and expert experience.
[0077] ② Construction of a conventional influencing factor input system
[0078] The conventional influencing factor input system is mainly used to express the correlation between electricity changes and historical load, environmental factors, and external disturbance factors; let the first... The regular input feature vector at each time step is: ,in, For time features, it can include time number, weekday feature, weekday / holiday identifier, etc.
[0079] ③ Construction of User Behavior Probability Input System
[0080] The user behavior probability input system is mainly used to enhance the expression of behavior persistence and equipment operating intensity in response to changes in power consumption; let the first... The behavioral input feature vector at each time step is: ,in, This represents the probability of user behavior.
[0081] The two types of input systems are merged to form a combined input system: ,Right now: .
[0082] Step 3: Establish a user behavior probability model based on the usage duration ratio of each device within the target time period to reflect the operating intensity and behavior persistence of the device within that time period; use the Pearson correlation coefficient method to screen candidate input variables, and normalize and construct time series samples for the screened input and output data;
[0083] In this embodiment, ① a user behavior probability model is established.
[0084] To more accurately describe the impact of device usage behavior on power consumption, this invention does not use the simple number of times an action occurs to define the probability of behavior, but instead uses the proportion of device usage time within a target period to define the probability of user behavior.
[0085] Let the target time period be arrive The total number of devices is , No. The usage duration of each device during this period is To differentiate the actual power consumption differences between high-power and low-power devices under the same operating time, the rated power of the device is further introduced as a weight, defining a power-weighted behavior probability: ,in, The total duration of the target period; For the first The rated power of each device; For the first The actual usage duration of each device within the target time period; in the above formula, the numerator is the sum of the weighted actual power consumption duration of all devices within the target time period, and the denominator is the sum of the theoretical maximum power consumption duration of all devices running at full load throughout the entire period, which serves as the normalization benchmark. The closer the value is to 1, the greater the continuous high-intensity operation of high-power equipment during the target period and the greater its contribution to the electricity load.
[0086] With state variables Indicates equipment At any moment The switching states, where: Then, under discrete-time conditions, the device duration can be expressed as: Discretize the target time period at equal intervals; within the target time period, there are a total of If there are 1 sampling point, then: Therefore, the probability of behavior can also be written as: This definition method is based on the summation of discrete 0-1 state variables of the device switch to the equivalent power-on time, and completes the equivalent conversion of behavior probability in the discrete time dimension. It relies on probability values to more accurately represent the operating intensity and continuity of power consumption behavior of the device in the target time period.
[0087] Furthermore, the rate of change in behavior can also be defined: Define the behavioral inertia term: ,in, The length of the sliding window; For the first The device is The rate of change of behavior at any given moment reflects the instantaneous trend of change in the probability of behavior; The term represents the behavioral inertia, indicating that... The time is the end point, and the length is The mean rate of change of behavior within a time window is used to capture the persistent characteristics of short-term device behavior. Larger values can smooth out short-term disturbances and highlight persistent behavioral trends; this can further enhance the model's expression of short-term behavioral inertia.
[0088] ② Pearson correlation coefficient input feature screening
[0089] The Pearson correlation coefficient is currently the most accurate statistical method for measuring the strength of the relationship between two variables. and Correlation quantification analysis, utilizing several sets of collected data. Calculate the correlation coefficient, see the formula. In the formula, They are respectively The mean of the experimental values; correlation coefficient .
[0090] Specifically, the present invention employs The threshold for feature retention is defined as the absolute value of the Pearson correlation coefficient between a feature and the target quantity. When the characteristic is considered to have a valid linear correlation with the target electricity level, it is retained; when If the linear correlation between the feature and the target power is not significant, it is discarded. This threshold takes into account both the integrity of feature retention and the effectiveness of redundant screening. In actual engineering, it can be appropriately adjusted according to data quality and the number of features.
[0091] ③ Data normalization processing
[0092] Since the different variables have different scales, in order to avoid large-scale variables dominating model training, the selected input data is normalized using Min-Max normalization: ,in, For input values; This is the point of maximum value; It is the point of minimum value; This is the expected standardized value.
[0093] ④ Construction of time series samples
[0094] After normalization, the data is reorganized into three-dimensional time-series samples suitable for Bi-LSTM input; let the window length be... The predicted step size is After screening The feature vector at time t is The input sample is: .
[0095] The data is divided into training, validation, and test sets according to the time series. The first 90% is used for model training and validation, and the last 10% is used for testing. The training set is used to train the model to learn the hidden features or patterns in the data, while the test set is used to test the model after training.
[0096] During model training, a validation set separate from the training set is used to verify model performance. This validation process allows for the adjustment of model hyperparameters and configurations, serving as an evaluation to indicate whether training is proceeding normally. In this invention, 20% of the data in the training set is used for validation.
[0097] Step 4: Establish a bidirectional long short-term memory network (Bi-LSTM) prediction model to predict the electricity consumption during the target period; use the whale optimization algorithm to optimize the parameters of the Bi-LSTM model to obtain the optimized electricity consumption prediction model, and use the optimized Bi-LSTM model to output the electricity consumption prediction results for the target period.
[0098] In this embodiment, ① Bi-LSTM prediction model is established.
[0099] The Long Short-Term Memory (LSTM) network model, serving as the benchmark for the proposed FNET model, is a variant of the Recurrent Neural Network (RNN). Compared to RNNs, LSTMs can handle long-term dependencies and the vanishing gradient problem. Cell states and gate structures are fundamental concepts of LSTMs, where cell states are used to pass information and address the short-term memory problem. LSTMs have three gate structures: the input gate, the forget gate, and the output gate, each with its specific function. The forget gate determines whether information should be discarded or retained. The input gate updates the cell state. The output gate computes the value of the next hidden state, which contains the previously input data. The following equations give the general equations of LSTM: , , , , , ,in, The output vector of the forget gate controls the degree to which historical memories are retained; The input gate output vector controls the degree to which new information is written. These are candidate memory units, containing the new information currently being input; The updated unit state is composed of historical memories and new information; The output vector of the output gate represents the output range of the control unit's state. The current hidden state (i.e., the final output) is used as the input for the next time step; The activation function is Sigmoid; the weight matrix of the forget gate is... ; Indicates the input at the current time. and the hidden layer state at the previous time step The vector formed; It is the bias term of the forget gate; This represents the weight matrix of the input gate; It is the bias term of the input gate; The weight matrix representing the candidate memory units; It is the bias term for candidate memory units; The weight matrix representing the output gate; The bias term represents the output gate.
[0100] Examining the input vector in only one direction may result in the loss of key feature information during training, thus failing to comprehensively evaluate the sequence information. To address this issue, a bidirectional LSTM (BILSTM) is employed to collect both the forward and backward directions of the time series data representation, utilizing both forward and backward information simultaneously. Therefore, BILSTM generates the final output vector in the following manner. : ,in, For activation functions; This is the weight matrix of the forward LSTM; For the first The forward LSTM hides the state at each time step; This is the weight matrix for the backward LSTM; For the first The backward LSTM hidden state at each time step; This is a bias term.
[0101] ② Model loss function and training objective
[0102] Let the actual value be The predicted value is Then, the mean squared error or the mean absolute error can be used as the loss function, where, Mean square error, The mean absolute error, The total number of samples involved in the calculation; , If a regularization term is introduced, the objective function can be expressed as: ,in, For the set of model parameters; is the regularization coefficient.
[0103] When training with the Adam optimization algorithm, the parameter update formula is: , , , , ,in, For gradient; These are model parameters; The learning rate; and These are the exponential moving average estimates of the first moment (mean) and second moment (uncorrected variance) of the gradient, respectively; and This is the corresponding deviation correction value, used to correct deviations in the initial stage; and For the exponential decay rate of the first and second moments; A tiny positive number added to prevent the denominator from being zero.
[0104] ③ Whale optimization algorithm for Bi-LSTM parameter optimization
[0105] To further improve the performance of the Bi-LSTM model, this invention employs the whale optimization algorithm. The key parameters of Bi-LSTM were optimized; the optimized parameters included: number of hidden layer units, learning rate, batch size, and number of training epochs. Ratio, time window length.
[0106] Let the current population have the first The position vectors of each individual are: ,in, The number of hidden units; The learning rate; Batch size; For the number of training rounds; for parameter; This represents the length of the time window.
[0107] The prey-encircling process in the whale optimization algorithm is represented as: , ,in, This is the distance vector from the current individual to the optimal solution; This represents the position vector of the globally optimal individual in the current iteration. For the current number The position vectors of each individual; This is the new position vector of the individual after the encirclement action is updated; and This is the control coefficient vector.
[0108] The coefficient vector is defined as: , , ,in, It is a random number; This represents the current iteration number; This represents the maximum number of iterations; the coefficient here... and The meaning is exactly the same as the coefficient vector defined in the process of surrounding prey; The control parameter decreases linearly from 2 to 0 with the number of iterations.
[0109] When an individual performs a spiral update, the update method is as follows: ,in, The constant is the helical constant. The position of the spiral motion is controlled by a random number. The shape constant of the helix determines the shape of the logarithmic helix; It is the radial scaling factor of the spiral motion, which controls how the distance between the individual and the prey (optimal solution) changes with iteration.
[0110] If a random search mechanism is considered, the update would be: , ,in, The location of the randomly selected individual.
[0111] Each candidate parameter combination A corresponding Bi-LSTM model is trained, and the fitness value is calculated based on the validation set error; the fitness function can be defined as: ,in, For the first The position vectors corresponding to each candidate parameter combination have function values evaluated by the prediction errors (such as RMSE or MAE) of the Bi-LSTM model trained with that set of parameters on the validation set. The smaller the fitness value, the better the prediction performance of the candidate parameter combination. After multiple iterations, the parameter combination with the smallest fitness value is the optimal parameter combination. This is used to finally construct the optimized Bi-LSTM power prediction model; These are the root mean square error of the validation set and the mean absolute percentage error of the validation set, respectively.
[0112] After multiple iterations, the optimal parameter combination was obtained: Based on this, an optimized Bi-LSTM power prediction model was constructed.
[0113] ④ Output the prediction results using the optimized model.
[0114] Use the optimal parameter combination Retrain the Bi-LSTM model and input the sample to be predicted into the model to obtain the electricity prediction result for the target time period: ,in, Indicates The optimized Bi-LSTM mapping function.
[0115] ⑤ Model performance evaluation
[0116] To evaluate model performance, one can compare predicted results with actual values. , and The evaluation is conducted using indicators such as [list of indicators], and the specific formula is as follows, with the mean absolute error being: ;
[0117] The root mean square error is: ;
[0118] The mean absolute percentage error is: ;
[0119] The coefficient of determination is: ,in:
[0120] when , and smaller and The closer the value is to 1, the better the model's predictive performance.
[0121] In summary, this step completed the establishment of a Bi-LSTM-based power prediction model, parameter optimization, and final prediction output, forming a complete power prediction method.
[0122] This invention, through the aforementioned four steps, achieves a complete power generation prediction process, from multi-source data acquisition, occupancy agent construction, behavioral probability modeling, correlation screening, normalization processing, and time-series sample construction, to Bi-LSTM prediction and whale optimization. This method not only preserves the conventional influence of historical power generation and environmental factors but also enhances the characterization of continuous behavioral characteristics through user behavior probability enhancement, thereby improving the accuracy and stability of power generation prediction for the target time period.
[0123] This invention is a power generation prediction method based on user behavior probability and bidirectional long short-term memory network. In use, this invention uniformly divides the load objects to be predicted, integrates historical power generation, environmental information, external meteorological information and user behavior probability features, and combines Bi-LSTM and whale optimization algorithm to achieve high-precision prediction of power generation for the target period, improving the model's adaptability and prediction stability to random behavior disturbance scenarios. This invention has the advantages of achieving high-precision prediction, improving adaptability to random behavior disturbance scenarios, and enhancing prediction stability.
[0124] Example 2
[0125] like Figure 1-3 As shown, the power prediction method based on user behavior probability and bidirectional long short-term memory network includes the following steps:
[0126] Step 1: Collect historical electricity consumption data, electricity consumption information of the previous period, environmental data and external meteorological data corresponding to the object to be predicted, and construct a multi-source time series database according to the hourly time scale;
[0127] In this embodiment, the determination of the object to be predicted adopts the power distribution branch relationship to uniformly divide the physical boundary and metering boundary, so as to unify the data collection scope and ensure the consistency of the input variable and the output power sequence in terms of time scale and metering object.
[0128] The historical electricity data represents the actual electricity consumption of the object to be predicted over multiple consecutive historical periods.
[0129] The electricity consumption information of the previous time period refers to the electricity consumption or power value of the time period immediately preceding the target time period, and is used to characterize short-term inertial characteristics;
[0130] The environmental data includes air temperature, carbon dioxide concentration, air humidity, and PM2.5 concentration;
[0131] The external meteorological data includes one or more of the following: external air temperature, external air humidity, solar irradiance, wind speed, rainfall status, and air pressure.
[0132] The construction of the multi-source time-series data sample set is as follows:
[0133] Step 1.1: Align all raw data according to a uniform time interval. If the original sampling granularity is different, perform time scale conversion first.
[0134] Step 1.2: For isolated or sporadic single missing values, the nearest-time interpolation method is used for imputation; for short-term continuous missing values with a certain continuous trend, the moving average method is used for smoothing estimation.
[0135] Step 1.3: For single extreme outliers, use the threshold truncation method; for extreme outliers, i.e., when there are multiple adjacent outliers or the outliers have large deviations, use the median replacement method.
[0136] Step 1.4: Concatenate the cleaned data according to a unified time index to obtain the original multi-source feature vector; then sample the original multi-source feature vector according to a fixed time window and prediction step size to obtain the multi-source time series sample set.
[0137] Step 2: Construct occupancy-related proxy variables using carbon dioxide concentration to indirectly characterize the intensity of activity or occupancy status within a space, replacing direct human monitoring;
[0138] In this embodiment, the construction of the occupancy-related proxy variable specifically involves:
[0139] Step 2.1: Directly obtain the carbon dioxide concentration value using the proxy variable and standardize it;
[0140] Step 2.2: Enhance dynamic change information by utilizing the rate of change between adjacent time periods to reflect the dynamic trend of space occupancy status; and define an occupancy intensity index to balance the contribution of absolute level and change trend.
[0141] Step 2.3: Introduce a threshold determination method to discretize the occupancy state into multi-level state variables.
[0142] Step 3: Construct two types of input systems: one is the input system of conventional influencing factors, including historical electricity consumption, time characteristics, environmental parameters, external meteorological parameters, and occupancy-related proxy variables; the other is the input system of user behavior probability, including historical electricity consumption and user behavior probability sequences.
[0143] In this embodiment, the conventional influencing factor input system includes historical electricity consumption, time characteristics, environmental parameters, external meteorological parameters, and occupancy-related proxy variables. Its construction method is as follows: Let the first... The regular input feature vector at each time step is: ,in, It is a time-related feature;
[0144] The user behavior probability input system includes historical electricity consumption and user behavior probability sequences, and its construction method is as follows: Let the first... The behavioral input feature vector at each time step is: ,in, For user behavior probability;
[0145] The two types of input systems are merged to form a combined input system: ,Right now: .
[0146] Specifically, the historical electricity consumption involved in both types of input systems refers to the actual electricity consumption sequence of the object to be predicted over multiple consecutive historical periods. This is different from the meaning of "electricity consumption information of the previous period" in step 1, which only refers to the electricity consumption value of the period immediately preceding the target period. It is included in the conventional influencing factor input system as a separate feature characterizing short-term inertia.
[0147] The historical electricity data in both input systems comes from the same source, namely the multi-source time-series database constructed in step 1. However, they play different roles in modeling: in the conventional influencing factor input system, the historical electricity sequence serves as a time-series context feature to extract historical patterns of load changes; in the user behavior probability input system, historical electricity and user behavior probability sequences together constitute the input, focusing on expressing the electricity change pattern driven by behavior, so as to enhance the model's ability to identify continuous energy consumption behavior.
[0148] Step 4: Establish a user behavior probability model based on the proportion of usage duration of each device within the target time period to reflect the operating intensity and behavior persistence of the device during that time period;
[0149] In this embodiment, the establishment of the user behavior probability model is as follows: Let the target time period be... arrive The total number of devices is , No. The usage duration of each device during this period is The probability of user behavior is then defined as: ,in, The total duration of the target period;
[0150] With state variables Indicates equipment At any moment The switching states, where: Then, under discrete-time conditions, the device duration can be expressed as: Therefore, the probability of behavior can also be written as: This definition method can more accurately reflect the operating intensity of the equipment during the target period.
[0151] Step 5: Use the Pearson correlation coefficient method to screen candidate input variables, and normalize the screened input and output data and construct time series samples;
[0152] In this embodiment, the Pearson correlation input feature screening specifically involves: utilizing several sets of collected data. Calculate the correlation coefficient. In the formula, They are respectively The mean of the experimental values;
[0153] The data normalization process specifically involves: using Min-Max normalization. ,in, For input values; This is the point of maximum value; It is the point of minimum value; This is the expected standardized value;
[0154] The construction of the time series samples is specifically as follows: Let the window length be... The predicted step size is After screening The feature vector at time t is The input sample is: .
[0155] Step 6: Establish a bidirectional long short-term memory network Bi-LSTM prediction model, so that the model can simultaneously utilize forward and backward temporal information to perform deep temporal modeling of multidimensional input features;
[0156] In this embodiment, the establishment of the Bi-LSTM prediction model is as follows: A Bi-LSTM is used to collect the forward and backward directions of the time series data representation, utilizing both forward and backward information simultaneously. Therefore, BILSTM generates the final output vector in the following manner. : ,in, For activation functions; This is the weight matrix of the forward LSTM; For the first The forward LSTM hides the state at each time step; This is the weight matrix for the backward LSTM; For the first The backward LSTM hidden state at each time step; This is a bias term.
[0157] Step 7: The parameters of the Bi-LSTM model are optimized using the whale optimization algorithm, and population diversity and search efficiency are improved through chaotic mapping initialization and adaptive weight adjustment;
[0158] In this embodiment, the whale optimization algorithm is used to optimize the parameters of the Bi-LSTM model. The optimized parameters include: the number of hidden layer units, the learning rate, the batch size, and the number of training epochs. The ratio and time window length; after multiple iterations, the parameter combination with the minimum fitness value is the optimal parameter combination. , Based on this, an optimized Bi-LSTM power prediction model was constructed.
[0159] Specifically, adopt Chaotic mapping is used to initialize the initial population of the whale optimization algorithm, replacing the traditional random initialization method and improving the uniformity and diversity of the population distribution. The iterative formula for chaotic mapping is: ,in, For the first Chaotic variables in the next iteration; For control parameters, when When the system enters a completely chaotic state, the generated sequence has the characteristics of ergodicity, non-periodicity, and sensitivity to initial conditions.
[0160] The specific initialization steps are as follows:
[0161] The first step is to optimize each parameter dimension. ( (where the parameter space dimension is used), and an initial seed is randomly generated. ;
[0162] The second step is to Starting from the above formula, iterate... Next, the generation length is chaotic sequence ;
[0163] The third step is to linearly map the chaotic sequence to the first... Search range of dimensional parameters ;in, and The first The lower and upper bounds of the dimension parameter.
[0164] After the above three steps, the initial population matrix is obtained. Compared to purely random initialization, chaotic initialization can more evenly cover the parameter search space and avoid the population from being overly concentrated in local areas.
[0165] Control parameters in the standard whale optimization algorithm The linear decreasing trend from 2 to 0 determines the transition between global search and local exploitation for an individual. Based on this, this invention introduces an adaptive linear decreasing strategy, the calculation formula of which is: ,in, This represents the current iteration number; This represents the maximum number of iterations. These are the upper and lower bounds of the control parameters, respectively.
[0166] In each iteration, the random vector and Based on the current renew: , ,in, A random vector within [0,1]; parameters The impact of these changes on search behavior is reflected in the following three stages.
[0167] In the early stages of iteration Approaching 2, corresponding If the probability is greater than 1, the individual will move away from the current best individual and make a large-scale random walk. The algorithm mainly explores the global area, which effectively avoids the population from gathering in a local area too early.
[0168] In the middle of the iteration, Drop to around 1 Fluctuating around 1, the ratio of global exploration to local development tends to be balanced, and the algorithm completes a smooth transition from "broad search" to "fine convergence".
[0169] In the later stages of the iteration Approaching 0, The probability is less than 1. Individuals continue to move closer to the current best individual. The algorithm mainly focuses on local fine-tuning to accelerate convergence to the global optimal parameter combination.
[0170] Specifically, when When an individual performs a random walk update, it randomly selects a reference individual from the population instead of the current best individual as the guiding target, thus expanding the search scope; when At this time, the individual takes the current best individual as the guiding target, performs encirclement contraction or spiral update, and gradually reduces the distance to the optimal solution.
[0171] This is by The dynamic switching mechanism driven by linear decrease enables the whale optimization algorithm to balance exploration breadth and convergence accuracy within a limited number of iterations, significantly improving its ability to optimize Bi-LSTM hyperparameters.
[0172] Step 8: Input the data for the period to be predicted into the optimized Bi-LSTM model and output the power prediction results for the target period.
[0173] In this embodiment, the output prediction result specifically refers to: using the optimal parameter combination. Retrain the Bi-LSTM model and input the sample to be predicted into the model to obtain the electricity prediction result for the target time period: ,in, Indicates The optimized Bi-LSTM mapping function.
[0174] This invention is a power generation prediction method based on user behavior probability and bidirectional long short-term memory network. In use, this invention uniformly divides the load objects to be predicted, integrates historical power generation, environmental information, external meteorological information and user behavior probability features, and combines Bi-LSTM and whale optimization algorithm to achieve high-precision prediction of power generation for the target period, improving the model's adaptability and prediction stability to random behavior disturbance scenarios. This invention has the advantages of achieving high-precision prediction, improving adaptability to random behavior disturbance scenarios, and enhancing prediction stability.
Claims
1. A power prediction method based on user behavior probability and bidirectional long short-term memory network, characterized in that: Includes the following steps: Step 1: Identify the electricity users to be predicted, collect historical electricity consumption time series data, electricity consumption information of the previous period, environmental data and external meteorological data corresponding to the target users, and complete the collection of multi-source time series data with hourly as the unified time granularity; Step 2: Use spatial carbon dioxide monitoring concentration as a proxy variable for occupancy to indirectly characterize the intensity of activities or occupancy status within the space, replacing human monitoring; construct a conventional influencing factor input system and a user behavior probability input system; Step 3: Establish a user behavior probability model based on the proportion of usage duration of each electrical device during the target time period to reflect the operating intensity and behavior continuity of the device during that time period; use the Pearson correlation coefficient method to complete the redundancy screening of candidate input variables, perform normalization transformation on the screened input and output datasets, and complete the construction of time series samples according to a fixed time window; Step 4: Establish a bidirectional long short-term memory (Bi-LSTM) prediction model, utilize the network's bidirectional time series extraction capability to mine forward and backward load correlation features, and predict the electricity consumption for the target period; introduce the whale optimization algorithm to perform global iterative optimization of the key hyperparameters of the Bi-LSTM network, obtain the optimal electricity consumption prediction model, and output the electricity consumption prediction results for the target period based on the optimized model.
2. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 1, characterized in that: In step 1, the electricity consumption objects to be predicted are uniformly divided into physical boundaries and metering and statistical boundaries based on the topology of the distribution branches, so as to achieve uniform statistical standards for all collected data and ensure that the input features and output electricity sequences match one-to-one in terms of time scale and metering objects.
3. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 2, characterized in that: The historical electricity time series data in step 1 represents the measured electricity consumption sequence of the electricity user to be predicted within a continuous historical statistical period; The electricity consumption information of the previous time period refers to the electricity consumption or power value of the time period immediately preceding the target time period, and is used to characterize short-term inertial characteristics; The environmental data includes air temperature, carbon dioxide concentration, air humidity, and PM2.5 concentration; The external meteorological data includes one or more of the following: external air temperature, external air humidity, solar irradiance, wind speed, rainfall status, and air pressure.
4. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 3, characterized in that: The construction of the multi-source time-series data sample set in step 1 is as follows: Perform time-scale interpolation alignment on raw data with different sampling frequencies to unify the sampling interval; Hierarchical imputation of missing values: isolated single-point missing values are imputed using nearest-time interpolation; short-term continuous trend missing values are imputed using smoothing estimation with moving average method. Outlier hierarchical correction: Single-point extreme outlier data is corrected using the threshold truncation method; for extreme outliers, i.e., cases with multiple adjacent outliers or large outlier deviations, the median replacement method is used. The cleaned and calibrated multi-source data are concatenated into an original multi-source feature vector according to a unified timestamp. Based on a preset time-series sliding window and prediction step size, the time-series samples are structured to generate a multi-source time-series sample set.
5. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 1, characterized in that: The method for constructing the relevant proxy variables in step 2 is as follows: Extract the raw carbon dioxide monitoring concentration values and standardize them; By relying on the concentration change rate between adjacent time periods to characterize the dynamic change trend of spatial occupancy status, dynamic change information is enhanced; and an occupancy intensity index that integrates the absolute value of concentration and the concentration change rate is constructed to balance the contribution of absolute level and change trend. A threshold determination method is introduced, which uses predicted hierarchical thresholds to discretely divide the space occupancy status into multi-level state variables.
6. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 5, characterized in that: The conventional influencing factor input system in step 2 includes historical electricity consumption, time characteristics, environmental parameters, external meteorological parameters, and occupancy-related proxy variables. Its construction method is as follows: Let the first... The regular input feature vector at each time step is: ,in, This represents the historical electricity consumption for the current time period. This is the electricity consumption information for the previous time period; This refers to the concentration of carbon dioxide. Air temperature; Air humidity; This refers to the particulate matter concentration. Wind speed; Solar irradiance; It is a time-related feature; The user behavior probability input system includes historical electricity consumption and user behavior probability sequences, and its construction method is as follows: Let the first... The behavioral input feature vector at each time step is: ,in, For user behavior probability; The two types of input systems are merged to form an integrated combined input system for the model input: ,Right now: .
7. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 1, characterized in that: The construction rule for the user behavior probability model in step 3 is as follows: Let the target time period be... arrive The total number of devices is , No. The usage duration of each device during this period is To differentiate the actual power consumption differences between high-power and low-power devices under the same operating time, the rated power of the device is introduced as a weight, and the power-weighted behavior probability is defined as follows: ,in, The total duration of the target period; For the first The rated power of each device; With state variables Indicates equipment At any moment The switching states, where: Then, under discrete-time conditions, the device duration can be expressed as: Discretize the target time period at equal intervals; within the target time period, there are a total of If there are 1 sampling point, then: Therefore, the probability of behavior can also be written as: This definition method is based on the summation of discrete 0-1 state variables of the device switch to the equivalent power-on time, and completes the equivalent conversion of behavior probability in the discrete time dimension. It relies on probability values to more accurately represent the operating intensity and continuity of power consumption behavior of the device in the target time period.
8. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 7, characterized in that: In step 3, Pearson correlation input features are used to quantify the linear correlation between the features and the target electricity level. Valid input features are then selected based on the correlation coefficient threshold. Specifically, this involves using several sets of collected data... Calculate the correlation coefficient. In the formula, They are respectively The mean of the experimental values; The data normalization process employs the Min-Max extreme value normalization algorithm to achieve full feature dimension normalization, specifically as follows: ,in, For input values; This is the point of maximum value; It is the point of minimum value; This is the expected standardized value; The time series sample construction is based on a fixed input window length and prediction step size, reorganizing one-dimensional time series features into a time series sample matrix adapted to the Bi-LSTM input format. Specifically, let the window length be... The predicted step size is After screening The feature vector at time t is The input sample is: .
9. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 1, characterized in that: The establishment of the Bi-LSTM prediction model in step 4 is as follows: The Bi-LSTM network extracts the bi-directional temporal hidden states sequentially through forward LSTM and backward LSTM. After weighting by the weight matrix, activation function mapping, and bias term compensation, the bi-directional hidden states are fused to obtain the final output feature vector at a single time step. : ,in, For activation functions; This is the weight matrix of the forward LSTM; For the first The forward LSTM hides the state at each time step; This is the weight matrix for the backward LSTM; For the first The backward LSTM hidden state at each time step; This is a bias term.
10. The power prediction method based on user behavior probability and bidirectional long short-term memory network as described in claim 9, characterized in that: In step 4, the whale optimization algorithm is used to optimize the parameters of the Bi-LSTM model. The optimization targets include: the number of hidden layer units in the Bi-LSTM, the model learning rate, the batch size, and the number of training iterations. Proportion, temporal input window length; using validation set prediction error as a population fitness index. After multiple rounds of population iteration, the parameter combination with the minimum fitness value is selected as the optimal parameter combination. , Based on the optimal parameter combination Reconstructing the Bi-LSTM power prediction model; The sample to be predicted is input into the optimized model, and the electricity prediction result for the target time period is calculated through the model mapping function: ,in, Indicates The optimized Bi-LSTM mapping function.