Regional electricity consumption prediction method and device, computer equipment and readable storage medium

By acquiring electricity consumption and environmental resource information of the target area, and using a hybrid model of LSTM and Transformer for cross-modal processing, the problem of inaccurate regional electricity consumption prediction in existing technologies is solved, achieving accurate prediction of future electricity consumption and improved adaptability to complex scenarios.

CN120822652APending Publication Date: 2025-10-21CHN ENERGY NEW ENERGY TECHNOLOGY RESEARCH INSTITUTE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510729882.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-10-21

AI Technical Summary

Technical Problem

Existing regional electricity consumption forecasting methods cannot accurately predict regional electricity consumption.

Method used

By acquiring electricity consumption information and various environmental resource information of the target area, electricity consumption characteristics and environmental resource characteristics are extracted, and cross-modal processing is performed using a hybrid model of LSTM and Transformer to predict electricity consumption in future time periods.

Benefits of technology

It enables accurate prediction of electricity consumption in target areas over future time periods, improving adaptability to complex scenarios and prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120822652A_ABST
    Figure CN120822652A_ABST
Patent Text Reader

Abstract

The invention relates to a regional electricity consumption prediction method and device, computer equipment and a readable storage medium. The method comprises the following steps: acquiring power consumption information and multiple pieces of environment resource information of a target area in a preset time period; extracting electricity consumption characteristics in a plurality of time intervals from the electricity consumption information, and extracting environment resource characteristics from the environment resource information; the electricity consumption characteristics in the multiple time intervals are converted into electricity consumption state characteristics, the multiple environment resource characteristics are converted into environment state characteristics, the electricity consumption state characteristics are used for representing the time dependence relation between the electricity consumption characteristics in the multiple time intervals, and the environment state characteristics are used for representing the time dependence relation between the electricity consumption characteristics in the multiple time intervals. The environment state feature is used for representing an environment dependency relationship among the plurality of environment resource features; and predicting regional power consumption of the target region in a future time period according to the power consumption state characteristics and the environment state characteristics. The method can accurately predict the power consumption of the target area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of smart grid technology, and in particular to a method, device, computer equipment, and readable storage medium for predicting regional electricity consumption. Background Art

[0002] Electricity consumption forecasting is the foundation for efficient, economical, and environmentally friendly operation of energy systems, connecting supply and demand and supporting the functioning of modern society. Therefore, predicting electricity consumption within a specific area is a crucial component of smart grids.

[0003] In traditional technology, the method for predicting regional electricity consumption includes: determining a target time period for which electricity consumption needs to be predicted, and determining multiple reference time periods before the target time period from multiple time periods contained in a preset historical period, obtaining electricity consumption characteristics of the target time period and each reference time period, the electricity consumption characteristics of each time period including reference electricity consumption at multiple time scales and multiple time intervals before the time period, and the reference electricity consumption is obtained by wavelet transforming the original electricity consumption of each time period contained in the historical period; processing the electricity consumption characteristics of the target time period and the electricity consumption characteristics of each reference time period according to a pre-constructed electricity consumption prediction model based on a long short-term memory network to obtain the predicted electricity consumption of the target time period.

[0004] However, the current regional electricity consumption forecasting method cannot accurately predict regional electricity consumption. Summary of the Invention

[0005] Based on this, it is necessary to provide an accurate regional electricity consumption prediction method, device, computer equipment, computer-readable storage medium and computer program product to address the above technical problems.

[0006] In a first aspect, the present application provides a method for predicting regional electricity consumption, the method comprising:

[0007] Obtaining electricity consumption information and multiple environmental resource information of the target area during a preset time period;

[0008] Extracting electricity consumption characteristics in multiple time intervals from electricity consumption information, and extracting environmental resource characteristics from environmental resource information;

[0009] Converting the electricity consumption characteristics in multiple time intervals into electricity consumption state characteristics, and converting the multiple environmental resource characteristics into environmental state characteristics, wherein the electricity consumption state characteristics are used to characterize the time dependency between the electricity consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependency between the multiple environmental resource characteristics;

[0010] According to the power consumption state characteristics and environmental state characteristics, the regional power consumption of the target area in the future time period is predicted.

[0011] In one embodiment, the environmental resource information includes at least one of climate resource information, population resource information, production resource information, and resource allocation intervention information; and extracting environmental resource characteristics from the environmental resource information includes:

[0012] In the case where the environmental resource information includes climate resource information, population resource information, production resource information, and resource allocation intervention information, extracting climate resource characteristics from the climate resource information, extracting population resource characteristics from the population resource information, and extracting production resource characteristics from the production resource information;

[0013] Convert multiple environment resource features into environment state features, including:

[0014] The climate resource characteristics, population resource characteristics, production resource characteristics and resource allocation intervention information are spliced ​​together to obtain the environmental splicing characteristics;

[0015] Convert the environment stitching features into environment state features.

[0016] In one embodiment, before converting the power consumption characteristics in the multiple time intervals into power consumption state characteristics, the method further includes:

[0017] Position coding is performed on the power consumption characteristics in multiple time intervals to obtain time series position coding characteristics in multiple time intervals, and period coding is performed on multiple time intervals to obtain period coding characteristics;

[0018] Convert the power consumption characteristics in multiple time intervals into power consumption status characteristics, including:

[0019] The power consumption features, cycle encoding features, and time series position encoding features are processed through the LSTM (Long Short-Term Memory) branch to obtain the power consumption status features.

[0020] Convert multiple environment resource features into environment state features, including:

[0021] The Transformer branch processes multiple environmental resource features and temporal position encoding features to obtain environmental state features.

[0022] In one embodiment, the regional electricity consumption prediction method is performed by an electricity consumption prediction model, and the electricity consumption prediction model includes an LSTM branch and a Transformer branch;

[0023] Based on the power consumption state characteristics and environmental state characteristics, the target area's regional power consumption in the future time period is predicted, including:

[0024] Obtain fusion weight information, the first prediction accuracy of the LSTM branch, and the second prediction accuracy of the Transformer branch;

[0025] updating the fusion weight information according to the first prediction accuracy and the second prediction accuracy;

[0026] According to the updated fusion weight information, the power consumption state characteristics and the environmental state characteristics are weighted to generate fusion characteristics;

[0027] Based on the fusion features, the regional electricity consumption of the target area in the future time period is predicted.

[0028] In one embodiment, the method further comprises:

[0029] For any first feature among the electricity consumption feature and the environmental resource feature, obtaining a first electricity consumption prediction value generated by the electricity consumption prediction model after processing the second feature, and a second electricity consumption prediction value generated by the electricity consumption prediction model after processing the first feature and the second feature, wherein the second feature is at least one feature among the electricity consumption feature and the environmental resource feature other than the first feature;

[0030] Detecting average marginal contribution information of the first feature according to the first power consumption prediction value and the second power consumption prediction value;

[0031] According to the average marginal contribution information, target features whose importance is higher than a preset importance threshold are screened from the electricity consumption characteristics and environmental resource characteristics, where the target features are used to predict the regional electricity consumption in the future time period in the next iteration round of the electricity consumption prediction model.

[0032] In one embodiment, the method further comprises:

[0033] Obtain the structural parameters, preset segment convergence factor, and branch complexity of the Transformer branch in the current iteration round;

[0034] Based on a preset segmented convergence factor, the branch complexity and the second prediction accuracy are processed to obtain convergence impact information;

[0035] Based on the convergence impact information, the structural parameters of the Transformer branch in the current iteration round are updated.

[0036] In a second aspect, the present application further provides a regional electricity consumption prediction device, the device comprising:

[0037] An acquisition module is used to obtain power consumption information and multiple environmental resource information of a target area in a preset time period;

[0038] A feature extraction module is used to extract power consumption features in multiple time intervals from power consumption information, and to extract environmental resource features from environmental resource information;

[0039] a processing module, configured to convert power consumption characteristics in multiple time intervals into power consumption state characteristics, and to convert multiple environmental resource characteristics into environmental state characteristics, wherein the power consumption state characteristics are used to characterize the temporal dependencies between the power consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependencies between the multiple environmental resource characteristics;

[0040] The prediction module is used to predict the regional power consumption of the target area in the future time period based on the power consumption state characteristics and the environmental state characteristics.

[0041] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0042] Obtaining electricity consumption information and multiple environmental resource information of the target area during a preset time period;

[0043] Extracting electricity consumption characteristics in multiple time intervals from electricity consumption information, and extracting environmental resource characteristics from environmental resource information;

[0044] Converting the electricity consumption characteristics in multiple time intervals into electricity consumption state characteristics, and converting the multiple environmental resource characteristics into environmental state characteristics, wherein the electricity consumption state characteristics are used to characterize the time dependency between the electricity consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependency between the multiple environmental resource characteristics;

[0045] According to the power consumption state characteristics and environmental state characteristics, the regional power consumption of the target area in the future time period is predicted.

[0046] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:

[0047] Obtaining electricity consumption information and multiple environmental resource information of the target area during a preset time period;

[0048] Extracting electricity consumption characteristics in multiple time intervals from electricity consumption information, and extracting environmental resource characteristics from environmental resource information;

[0049] Converting the electricity consumption characteristics in multiple time intervals into electricity consumption state characteristics, and converting the multiple environmental resource characteristics into environmental state characteristics, wherein the electricity consumption state characteristics are used to characterize the time dependency between the electricity consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependency between the multiple environmental resource characteristics;

[0050] According to the power consumption state characteristics and environmental state characteristics, the regional power consumption of the target area in the future time period is predicted.

[0051] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:

[0052] Obtaining electricity consumption information and multiple environmental resource information of the target area during a preset time period;

[0053] Extracting electricity consumption characteristics in multiple time intervals from electricity consumption information, and extracting environmental resource characteristics from environmental resource information;

[0054] Converting the electricity consumption characteristics in multiple time intervals into electricity consumption state characteristics, and converting the multiple environmental resource characteristics into environmental state characteristics, wherein the electricity consumption state characteristics are used to characterize the time dependency between the electricity consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependency between the multiple environmental resource characteristics;

[0055] According to the power consumption state characteristics and environmental state characteristics, the regional power consumption of the target area in the future time period is predicted.

[0056] The above-mentioned regional electricity consumption prediction method, apparatus, computer equipment, computer-readable storage medium, and computer program product obtain electricity consumption information and multiple environmental resource information of a target area during a preset time period;

[0057] Extract electricity consumption characteristics in multiple time intervals from electricity consumption information, and extract environmental resource characteristics from environmental resource information; convert electricity consumption characteristics in multiple time intervals into electricity consumption state characteristics, and convert multiple environmental resource characteristics into environmental state characteristics, wherein electricity consumption state characteristics are used to characterize the time dependency between electricity consumption characteristics in multiple time intervals, and environmental state characteristics are used to characterize the environmental dependency between multiple environmental resource characteristics; predict regional electricity consumption in the target area in the future time period based on electricity consumption state characteristics and environmental state characteristics. Throughout the process, the present application breaks through the linear assumption limitation of traditional methods. First, electricity consumption characteristics in multiple time intervals are extracted from electricity consumption information, and environmental resource characteristics are extracted from environmental resource information. Then, by performing local time series modeling on electricity consumption characteristics and global modeling on environmental resource characteristics, the time dependency between electricity consumption characteristics in multiple time intervals and the environmental dependency between multiple environmental resource characteristics are obtained, effectively improving the adaptability to complex scenarios. Furthermore, by performing cross-modal processing on the obtained electricity consumption state characteristics and environmental state characteristics, the electricity consumption in the target area in the future time period can be accurately predicted. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.

[0059] Figure 1 This is a diagram showing an application environment of a method for predicting regional electricity consumption in one embodiment;

[0060] Figure 2 1 is a flow chart of a method for predicting regional electricity consumption in one embodiment;

[0061] Figure 3 is a flow chart of a method for predicting regional electricity consumption in another embodiment;

[0062] Figure 4 is a structural block diagram of a regional power consumption prediction device in one embodiment;

[0063] Figure 5 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are used to explain this application and are not intended to limit this application.

[0065] The regional electricity consumption prediction method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 via a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104 or placed on the cloud or other network servers.

[0066] The user triggers the regional power consumption prediction control on the regional power consumption prediction interface of the terminal 102. The terminal 102 responds to the trigger request of the regional power consumption prediction control, obtains the power consumption information and multiple environmental resource information of the target area in the preset time period, generates a regional power consumption prediction request, and sends the regional power consumption prediction request to the server 104. The server 104 obtains the power consumption information and multiple environmental resource information of the target area in the preset time period in the regional power consumption prediction request; extracts the power consumption characteristics in multiple time intervals from the power consumption information, and extracts the environmental resource characteristics from the environmental resource information; converts the power consumption characteristics in multiple time intervals into power consumption state characteristics, and converts the multiple environmental resource characteristics into environmental state characteristics, wherein the power consumption state characteristics are used to characterize the time dependency between the power consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependency between multiple environmental resource characteristics; predicts the regional power consumption of the target area in the future time period based on the power consumption state characteristics and the environmental state characteristics. Furthermore, the predicted power consumption information of the target area can be pushed to the terminal 102 for viewing or display by the terminal 102 holder.

[0067] Terminal 102 may include, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, smart car devices, and projectors. Portable wearable devices may include smart watches, smart bracelets, and head-mounted devices. Head-mounted devices may include virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, and the like. Server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services.

[0068] In an exemplary embodiment, Figure 2 As shown in the figure, a regional electricity consumption prediction method is provided, which is applied to Figure 1 The server 104 in FIG. 1 is used as an example for explanation.

[0069] S100: Obtaining power consumption information and multiple environmental resource information of a target area in a preset time period.

[0070] The target area refers to a specific geographic area of ​​interest in research, analysis, or forecasting, such as a city or province, and is the subject of related activities. The preset time period can include multiple time periods. In this application, the preset time period includes the current time period and multiple historical time periods. The historical time periods can be divided into time periods such as days, weeks, and months.

[0071] Electricity consumption information refers to the electricity consumed by a specific area or device over a period of time. Environmental resource information refers to environmental resource knowledge collected and processed in a specific form and applied in environmental resource work. It can reflect environmental factors and their interactions, factors and human activities that influence the environment, and the impact on human health, safety, and living conditions. It covers multiple aspects such as landscape, geology, hydrology, and ecology. Environmental resource information is used to reflect the impact of external factors on electricity consumption by constructing comprehensive spatiotemporal characteristics.

[0072] Specifically, electricity consumption information and multiple environmental resource information, such as economic, climate, and policy information, are obtained for the target area in the current time period and multiple historical time periods. The reason for obtaining environmental resource information is that by incorporating multiple environmental resource information into the regional electricity consumption forecast process, the model's robustness to external events such as sudden policies, economic fluctuations, and extreme weather can be improved. Furthermore, the electricity consumption information and environmental resource information obtained for the target area in the current time period and multiple historical time periods need to be time-aligned. For example, when predicting electricity consumption at time t+1, the electricity consumption information and environmental resource information at and before time t are used.

[0073] In an exemplary embodiment, the method for obtaining multiple environmental resource information includes: 1. Remote sensing monitoring: using satellite or drone images to extract vegetation, water bodies, land cover and other information. 2. Sensor network: deploying ground equipment to collect real-time environmental information such as air, water quality, and soil. 3. Geographic information system: combining spatial data to extract information such as terrain, climate, and ecological distribution. In addition, climate information can also be supplemented based on weather forecasts. 4. Official statistical agencies: local statistical department websites, directly downloading official GDP (Gross Domestic Product) data and reports within the target area, or obtaining information such as the population size within the target area. 5. Social networking site notifications: obtaining information such as policies of the target area.

[0074] S200 , extracting electricity consumption characteristics in multiple time intervals from electricity consumption information, and extracting environmental resource characteristics from environmental resource information.

[0075] Among them, the electricity consumption feature is essentially a lag feature. The electricity consumption feature specifically refers to the time series in which the observation value of the past time point (such as the data at time t-1 and t-2) is used as the input feature of the current time point to capture the time dependency between the current value and the historical state. It can be considered that the lag feature is the core component of the time series feature and is specifically used to model time dependency.

[0076] Specifically, since the preset time period includes the current time period and multiple historical time periods, the electricity consumption information of the target area in the preset time period is actually time series information. At this time, the local dependence and periodicity of the time series are extracted to help the subsequent model capture the dynamic change pattern of historical electricity consumption, that is, the time series feature of the electricity consumption information is constructed to obtain the electricity consumption characteristics under multiple time intervals, that is, to generate the short-term dependence between the current electricity consumption and the historical electricity consumption in the time dimension. For example, the direct impact of yesterday's electricity consumption on today can be captured. In practical applications, the electricity consumption characteristics can be , is the value of electricity consumption in the historical period at time step tk.

[0077] Furthermore, if there is more than one type of environmental resource information, environmental resource features can be extracted for each type of environmental resource information to filter and process the most valuable information for model training. In practical applications, the means of extracting environmental resource features include: using a feature extraction model to extract features from the environmental resource information to obtain environmental resource features.

[0078] S300: Converting power consumption characteristics in multiple time intervals into power consumption state characteristics, and converting multiple environmental resource characteristics into environmental state characteristics.

[0079] Among them, the power consumption state feature is used to characterize the time dependency between power consumption features in multiple time intervals, and the environmental state feature is used to characterize the environmental dependency between multiple environmental resource features.

[0080] Specifically, electricity consumption features are used to capture the temporal dependencies between electricity consumption features across multiple time intervals, such as the temporal dependencies between current and historical time. Therefore, based on electricity consumption features, short-term fluctuations in electricity consumption during electricity consumption forecasting can be captured. At this point, the hidden state corresponding to the electricity consumption feature can be obtained. The hidden state is the short-term memory transferred during sequence processing, and the hidden state is the desired electricity consumption state feature. Furthermore, since there is more than one environmental resource feature, it is also possible to capture the associations between environmental resource features in different subspaces to generate environmental state features.

[0081] Furthermore, the present application uses a LSTM-Transformer hybrid power consumption prediction model to convert power consumption characteristics under multiple time intervals into power consumption state characteristics, and convert multiple environmental resource characteristics into environmental state characteristics. That is to say, by integrating the time series modeling capability of LSTM and the global dependency capture capability of Transformer, a hybrid model is constructed to improve prediction accuracy and robustness. Therefore, it can be considered that the LSTM branch and the Transformer branch are used as two branches. The LSTM branch converts the power consumption characteristics under multiple time intervals into power consumption state characteristics, and the Transformer branch converts multiple environmental resource characteristics into environmental state characteristics. Among them, the Transformer branch is a deep learning model, the core of which is to use the attention mechanism. The LSTM branch is a deep learning model for processing sequence data, also known as a long short-term memory network.

[0082] Among them, the LSTM branch captures local timing patterns (such as short-term electricity consumption fluctuations) and can model time dependencies; the Transformer branch learns the long-term correlations between external environmental resource characteristics (such as the cross-cycle relationship between economic indicators and electricity consumption).

[0083] S400 , predicting regional power consumption of a target area in a future time period based on power consumption state characteristics and environmental state characteristics.

[0084] Specifically, the power consumption state characteristics and the environmental state characteristics are processed through the power consumption prediction model to predict the power consumption information in the future time period, that is, to obtain the predicted power consumption information of the target area.

[0085] Furthermore, the power consumption state characteristics and the environmental state characteristics are processed by the power consumption prediction model, including: fusing the power consumption state characteristics and the environmental state characteristics to generate fused characteristics, and processing the fused characteristics by the power consumption prediction model.

[0086] The method of fusing the power consumption state feature with the environmental state feature to generate a fused feature includes: weighted fusion of the power consumption state feature and the environmental state feature to generate a fused feature. In the weighted fusion process, the present application introduces a dynamic feature fusion mechanism to automatically adjust the contribution weights of the power consumption state feature and the environmental state feature based on an adaptive strategy.

[0087] At this point, the generation process of fusion features is described as the following expression:

[0088]

[0089] in, is the power consumption status characteristic, is the environmental state characteristic, are dynamic weight parameters generated by a learnable network or attention mechanism.

[0090] After generating the fusion features, the prediction expression of the electricity consumption in the target area is:

[0091]

[0092] in, is the weight matrix of the fully connected layer, mapping high-dimensional features to prediction targets, d model The dimension of the electricity consumption prediction model, for example, the dimension can be 512; is a bias term used to adjust the benchmark for electricity consumption forecast.

[0093] In the above-mentioned regional electricity consumption prediction method, electricity consumption information and multiple environmental resource information of the target area in a preset time period are obtained; electricity consumption characteristics in multiple time intervals are extracted from the electricity consumption information, and environmental resource characteristics are extracted from the environmental resource information; electricity consumption characteristics in multiple time intervals are converted into electricity consumption state characteristics, and multiple environmental resource characteristics are converted into environmental state characteristics, wherein the electricity consumption state characteristics are used to characterize the time dependence between electricity consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependence between multiple environmental resource characteristics; based on the electricity consumption state characteristics and the environmental state characteristics, the regional electricity consumption of the target area in the future time period is predicted. Throughout the entire process, this application breaks through the linear assumption limitations of traditional methods. First, it extracts electricity consumption characteristics in multiple time intervals from electricity consumption information, and extracts environmental resource characteristics from environmental resource information. Then, by performing local time series modeling on electricity consumption characteristics and global modeling on environmental resource characteristics, it obtains the time dependency between electricity consumption characteristics in multiple time intervals and the environmental dependency between multiple environmental resource characteristics, effectively improving the adaptability to complex scenarios. Furthermore, by performing cross-modal processing on the obtained electricity consumption state characteristics and environmental state characteristics, it can accurately predict the electricity consumption in the target area in the future time period.

[0094] In an exemplary embodiment, the environmental resource information includes at least one of climate resource information, population resource information, production resource information, and resource allocation intervention information; extracting environmental resource features from the environmental resource information includes:

[0095] When the environmental resource information includes climate resource information, population resource information, production resource information and resource allocation intervention information, climate resource characteristics are extracted from the climate resource information, population resource characteristics are extracted from the population resource information and production resource characteristics are extracted from the production resource information.

[0096] Convert multiple environment resource features into environment state features, including:

[0097] The climate resource characteristics, population resource characteristics, production resource characteristics and resource allocation intervention information are spliced ​​together to obtain environmental splicing characteristics; the environmental splicing characteristics are converted into environmental state characteristics.

[0098] Among them, production resource characteristics refer to the economic information of the target area within the preset time period, such as GDP (Gross domestic product) and other information. Resource allocation intervention information refers to the policy information received by the target area within the preset time period. Resource allocation intervention information has two types of information, 0 and 1. When a policy is announced, the resource allocation intervention information corresponding to the policy is 1. Otherwise, the resource allocation intervention information corresponding to the policy is 0. For example, the resource allocation intervention information during the dual carbon policy period is marked as 1.

[0099] Specifically, by integrating multi-source heterogeneous data (production economy, climate (such as temperature, precipitation, etc.), population, and policies), we construct comprehensive spatiotemporal characteristics to reflect the impact of external factors on electricity consumption, thereby improving the model's robustness to external events such as sudden policies, economic fluctuations, and extreme weather.

[0100] In the process of integrating multi-source heterogeneous data, it is necessary to use sliding window statistics to compile the required indicator information and obtain environmental resource information. For example, by setting a fixed-length window and sliding it across the time series of the required indicator information, the environmental resource information can be obtained. Furthermore, the environmental resource information within the window can be analyzed, such as by using mean, variance, maximum, and minimum value analysis, to detect short-term fluctuations, trend changes, or cyclical characteristics of each environmental resource information. In other words, when environmental resource information includes climate resource information, population resource information, production resource information, and resource allocation intervention information, when extracting climate resource characteristics for climate resource information, population resource characteristics for population resource information, and production resource characteristics for production resource information, these extractions can be performed using methods such as mean, variance, maximum, and minimum value analysis to obtain the corresponding environmental resource characteristics for each environmental resource information. Furthermore, since resource allocation intervention information carries important information, feature extraction for resource allocation intervention information is not required.

[0101] Furthermore, since there is more than one piece of environmental resource information and more than one corresponding environmental resource feature, it is necessary to stitch together the various environmental resource features. For example, we can stitch together climate resource features, population resource features, production resource features, and resource allocation intervention information to obtain a stitched environmental feature. Finally, we convert the stitched environmental feature into an environmental state feature.

[0102] In an exemplary embodiment, when the sliding window method is used to obtain environmental resource information, the expression of the environmental splicing feature is:

[0103]

[0104] ,

[0105] Among them, k is the sliding window size; GDP is production resource information; POP is population resource information; wea is climate resource information; X GDP is the sliding window statistic of production resource information, i.e., production resource characteristics; X pop is the sliding window statistic of population resource information, i.e., population resource characteristics; X wea is the sliding window statistic of climate resource information, i.e., climate resource characteristics; PolicyFlag is the resource allocation intervention information; max(X GDP ) is the dynamic upper limit of the sliding window of GDP. GDP Close to max(X GDP ), reduce the corresponding window to avoid congestion, when X GDP When it is lower, expand the corresponding window to improve efficiency; max(X pop ) Similarly, it is the dynamic upper limit of the sliding window of POP. When X pop Close to max(X pop ), reduce the corresponding window to avoid congestion, when X pop When it is lower, expand the corresponding window to improve efficiency; max(X wea ) Similarly, the dynamic upper limit of the sliding window of wea, when X wea Close to max(X wea ), reduce the corresponding window to avoid congestion, when X wea When it is lower, the corresponding window is enlarged to improve efficiency.

[0106] In practical applications, when k=3, X GDP It can be a sliding average of quarterly production resource indicators (such as GDP), that is, the average of the GDP of the three months in the quarter is taken to smooth out the noise, rather than the maximum value of a single month.

[0107] After obtaining the above-mentioned population resource characteristics, production resource characteristics, and climate resource characteristics, it is also necessary to normalize the population resource characteristics, production resource characteristics, and climate resource characteristics, and then splice the normalized climate resource characteristics, population resource characteristics, production resource characteristics with the resource allocation intervention information to obtain the environmental splicing characteristics.

[0108] In one embodiment, in special scenarios, such as extreme climate or policy changes, the maximum value within the sliding window can be added as an auxiliary feature, but it needs to be clearly distinguished from the original sliding average.

[0109] In the above embodiment, by obtaining environmental resource information including at least one of climate resource information, population resource information, production resource information and resource allocation intervention information, the environmental resource characteristics can be extracted more comprehensively, so that the environmental resource characteristics of multiple dimensions can be spliced ​​together to obtain environmental splicing characteristics, and the process of converting the environmental splicing characteristics into environmental state characteristics is also more accurate.

[0110] In an exemplary embodiment, before S300, as shown in FIG. Figure 3 As shown, the method further includes:

[0111] S250 , position coding is performed on the power consumption characteristics in the multiple time intervals respectively to obtain time series position coding characteristics in the multiple time intervals, and period coding is performed on the multiple time intervals to obtain period coding characteristics.

[0112] Positional encoding is a vector representation technique used to assign position information to each element in sequence data. In self-attention-based models (such as the Transformer), which lack the ability to perceive sequence order, positional encoding supplements this information, enabling the model to understand the order and relative relationships of elements. This allows models like the Transformer to explicitly perceive the absolute position of each time step. Periodic encoding uses periodic functions (such as sine and cosine) to convert discrete position information into continuous vectors, allowing machine learning models or neural networks to capture and utilize periodic patterns. This encoding method aims to capture periodic patterns in sequence data and is often used in scenarios such as time series analysis.

[0113] Specifically, in this application, the power consumption characteristics in multiple time intervals are position-encoded respectively, and sequential dependency information is injected into the time series data to make up for the insufficient modeling of time series sequence by traditional neural networks.

[0114] The expression for positional encoding can be:

[0115]

[0116]

[0117] in, is the time interval of electricity consumption characteristics (such as electricity consumption data on day t), is the model dimension, which must be consistent with the input embedding dimension, i dimension index, dimension index i is the dimension index used to generate sine (Sin) and cosine (Cos) position encoding, and the range is , effectively controlling the encoding frequency. A unique code is generated for each time interval using the sine / cosine function. High-frequency dimensions (larger i) focus on adjacent time intervals, while low-frequency dimensions (smaller i) capture long-term trends. is the sine term, is the cosine term.

[0118] The above two expressions are both absolute position coding expressions, which generate the even and odd dimensional components of the position coding vector respectively; PE(t, 2i) uses the sine function to generate the even bit code, that is, it represents the position coding value at position t and dimension index 2i, and PE(t, 2i+1) uses the cosine function to generate the odd bit code, that is, it represents the position coding value at position t and dimension index 2i+1. PE(t, 2i) and PE(t, 2i+1) together constitute a complete temporal position representation, covering different time scales through trigonometric functions with decreasing frequency. The temporal position coding features referred to in this application include PE(t, 2i) and PE(t, 2i+1).

[0119] Furthermore, it is necessary to perform periodic coding on multiple time intervals to obtain periodic coding features. The periodic coding sinusoidally encodes the periodicity of years, quarters, and months. For example, the month information is encoded as a continuous vector. The specific formula for obtaining the periodic coding feature is as follows:

[0120]

[0121] in Monthly value, used to encode annual periodicity (such as peak electricity consumption in winter). The formula for this problem is to fix the frequency term and map the month to a trigonometric function period. This formula converts the discrete time (month) into a continuous vector, solving the high-dimensional sparsity problem of traditional one-hot encoding.

[0122] Different from the power consumption feature, the power consumption feature directly extracts the sliding window value of the power consumption information (such as , etc.), is used to capture short-term timing dependencies. The periodic encoding feature is expressed by the formula Generation is used to explicitly encode monthly periodicity (such as peak electricity consumption in winter). In other words, the electricity consumption features come from the original electricity consumption information, and the period encoding features come from the month label. There is no direct calculation relationship between the two. However, both the period encoding features and the electricity consumption features will participate in the subsequent electricity consumption prediction process.

[0123] Furthermore, the period coding feature may also be part of the environmental resource feature (such as quarterly and monthly information, etc.) and integrated into the environmental resource feature.

[0124] Based on the above S250, Figure 3 As shown, S300 includes:

[0125] S320: Process the power consumption feature, the period coding feature, and the time series position coding feature through the LSTM branch to obtain the power consumption state feature.

[0126] Specifically, electricity consumption features and time series position encoding features jointly model short-term and long-term time patterns through a complementary mechanism: electricity consumption features (capturing short-term dependencies) directly characterize the autocorrelation and patterns in the short term by introducing past values ​​of the time series (such as data at moments t-1, t-2, etc.) as inputs of the current values. That is, the lag term describes the linear relationship between the current value and the historical value, effectively capturing short-term fluctuation trends; time series position encoding features (capturing long-term dependencies) assign a unique vector to each position in the sequence, enabling the model to perceive global order and periodicity. In models such as [1], position encoding encodes the absolute or relative position information of the time step through sine / cosine functions or learnable parameters. For example, in weekly data, time series position encoding features can distinguish the periodic patterns of weekdays and weekends, capturing long-term trends.

[0127] Therefore, electricity consumption characteristics capture recent dynamic changes (such as daily peak electricity consumption). Through the LSTM branch, electricity consumption characteristics are processed to quickly respond to short-term fluctuations. In addition, the time series position encoding features provide global context (such as seasonal cycles), allowing the LSTM branch to learn complex interactions across time steps and understand long-term trends. Combining the time series position encoding features with the electricity consumption feature input can enhance the LSTM branch's perception of periodic patterns. At this time, the LSTM branch can both predict short-term mutations (such as sudden electricity demand) and capture long-term patterns (such as the annual electricity consumption cycle), significantly improving the comprehensiveness and accuracy of time pattern modeling.

[0128] Furthermore, the power consumption features and time series position coding features are further combined with the period coding features, so that the LSTM branch can capture the peak power consumption within the period.

[0129] At this time, in the LTSM branch, the power consumption characteristics, cycle coding characteristics and time sequence position coding characteristics are input .in, is the electricity consumption characteristic, is the periodic encoding feature, It is a temporal position coding feature and a complete position coding vector containing sine and cosine combinations of all dimensions. For example, i traverses from 0 to 255 to generate a 512-dimensional position coding.

[0130] When the time series position coding features, power consumption features and period coding features are input to the LSTM branch, the LSTM gating mechanism (forget gate, input gate, output gate) is used to filter noise and memorize long-term dependencies (such as power consumption trends for multiple consecutive days). At the same time, the time series position coding features and period coding features are fed into the time sequence information to enhance the model's perception of the absolute position of the time step. At this time, the LSTM generates a hidden state. ,in, is the time step, is the LSTM hidden layer dimension. The LSTM hidden state is the short-term memory transmitted in sequence processing. That is, the LSTM hidden state is updated by the input gate, forget gate, and output gate. It is used to capture the information of the current time step and affect subsequent calculations. The LSTM hidden state is also the power consumption status feature.

[0131] Based on the above S250, Figure 3 As shown, S300 includes:

[0132] S340: Process multiple environmental resource features and temporal position coding features through the Transformer branch to obtain environmental state features.

[0133] Specifically, in the transformer branch, the environmental resource features, periodic coding features, and temporal position coding features corresponding to the input environmental resource information are input. , where environmental resource information includes at least one of climate resource information, population resource information, production resource information, and resource allocation intervention information. The transformer branch outputs the context vector , For the Transformer model dimension, it should be noted that the context vector output by the Transformer is a vector containing the context information of the input sequence obtained by the decoder after capturing the input sequence dependency through the self-attention mechanism based on the encoder output and the generated words when generating each output word. It is used to guide the decoder output. The context vector is also the environmental state feature of this application.

[0134] The transformer branch is actually based on the branch of the multi-head self-attention layer. That is, the input of the multi-head self-attention layer is the context resource feature, the period encoding feature and the temporal position encoding feature, and the output is the context vector H that integrates the global dependency relationship. TransThis layer calculates the attention weights of multiple subspaces in parallel to achieve a dynamic association between external environmental resource features and time steps (such as the impact of GDP growth on holiday electricity consumption patterns). It can be considered that the transformer branch captures feature associations in different subspaces in parallel through a multi-head mechanism. The self-attention weights reflect feature importance and solve the problem of heterogeneous data alignment of external features. The specific process processing in the transformer branch includes:

[0135] 1. Input processing flow: Embedding layer: External environmental resource characteristics (Economic indicators, policy markers, etc.) are mapped to dimensions through linear transformation Position encoding injection: the temporal position encoding feature With embedded Element-wise addition makes the model aware of temporal order.

[0136] 2. Multi-head self-attention calculation: Generate Q / K / V: through learnable weight matrix , , Project the input vector into query, key, and value respectively. , , For the The learnable weight matrix of the attention heads. For a single-head attention dimension, it is usually Multi-head parallel computing: Each attention head independently calculates the attention weight of the subspace: . Splicing and linear transformation: The output of all heads is spliced ​​and passed through the matrix Dimensionality reduction, get the context vector, that is, the environmental state feature H Trans ,in, .

[0137] 3. Output function: It captures the global dependencies between external environmental resource characteristics (such as the relationship between GDP growth and policy implementation) and preserves temporal order information through temporal position encoding features.

[0138] In the above embodiment, by performing position coding on the power consumption characteristics in multiple time intervals respectively to obtain time series position coding characteristics, and performing period coding on multiple time intervals to obtain period coding characteristics, the period coding characteristics and the time series position coding characteristics can be accurately fused with the power consumption characteristics to generate accurate power consumption state characteristics. Similarly, the time series position coding characteristics can be fused with multiple environmental resource characteristics to accurately convert multiple environmental resource characteristics into environmental state characteristics.

[0139] In an exemplary embodiment, a regional electricity consumption prediction method is performed by an electricity consumption prediction model, which includes an LSTM branch, a Transformer branch, and a fully connected layer; the regional electricity consumption prediction method includes: obtaining electricity consumption information and multiple environmental resource information of a target area in a preset time period; extracting electricity consumption features in multiple time intervals from the electricity consumption information, and extracting environmental resource features from the environmental resource information; converting the electricity consumption features in multiple time intervals into electricity consumption state features through the LSTM branch, and converting the multiple environmental resource features into environmental state features through the Transformer branch, wherein the electricity consumption state features are used to characterize the time dependency between the electricity consumption features in multiple time intervals, and the environmental state features are used to characterize the environmental dependency between the multiple environmental resource features; and then predicting the regional electricity consumption of the target area in the future time period based on the electricity consumption state features and the environmental state features through the fully connected layer of the electricity consumption prediction model. Furthermore, the electricity consumption prediction model in this application is a continuously updated model, and therefore, the electricity consumption prediction model can also be updated based on the difference between the predicted electricity consumption information and the preset theoretical electricity consumption information in the future time period.

[0140] In an exemplary embodiment, a regional power consumption prediction method is performed by a power consumption prediction model, which includes an LSTM branch and a Transformer branch. The method predicts the regional power consumption of a target area in a future time period based on power consumption state characteristics and environmental state characteristics, including:

[0141] Obtain fusion weight information, the first prediction accuracy of the LSTM branch, and the second prediction accuracy of the Transformer branch; update the fusion weight information based on the first prediction accuracy and the second prediction accuracy; perform weighted processing on the power consumption state characteristics and the environmental state characteristics based on the updated fusion weight information to generate fusion features; and predict the regional power consumption of the target area in the future time period based on the fusion features.

[0142] Specifically, the electricity consumption prediction model includes an LSTM branch for processing electricity consumption features and a Transformer branch for processing multiple environmental resource features.

[0143] In other words, the electricity consumption forecasting model combines the time series modeling capabilities of LSTM with the global dependency capture capabilities of Transformer to build a hybrid model to improve prediction accuracy and robustness. Specifically, the LSTM branch models time dependencies, capturing local time series patterns (such as short-term fluctuations in electricity consumption); while the Transformer branch learns long-term correlations between external features (such as the cross-period relationship between economic indicators and electricity consumption).

[0144] Furthermore, the electricity consumption prediction model can also use adaptive weighting to balance the modal features of the two branches, avoiding bias in a single model. Based on the task requirements, adaptive fusion weights are assigned to the electricity consumption state features output by the LSTM and the environmental state features output by the Transformer (for example, short-term predictions focus on the LSTM, and long-term predictions focus on the Transformer). This avoids modal conflicts caused by static weighting (such as automatically increasing the weight of environmental resource features during extreme weather conditions, or automatically increasing the weight of external features (such as policy markers) during policy implementation periods to enhance the short-term impact of emergencies). At this point, fused features are generated based on the fusion weights of the electricity consumption state features and the environmental state features.

[0145] Furthermore, in the process of adaptively assigning fusion weights to power consumption state features and environmental state features, the fusion weights can be adjusted according to real-time performance differences to ensure that the dominant branch dominates the prediction. A small learning rate is used to avoid frequent weight switching and improve training stability. The adjustment expression of the fusion weights includes: ,in, is the fusion weight of LSTM and Transformer; is the learning rate, which is used to control the weight adjustment step size; 、 is the prediction accuracy of LSTM and Transformer branches; Symbolic function.

[0146] Therefore, it can be considered that the process of generating fusion features based on the power consumption state characteristics and the environmental state characteristics includes: obtaining fusion weight information, the first prediction accuracy of the LSTM branch, and the second prediction accuracy of the Transformer branch; updating the fusion weight information according to the first prediction accuracy and the second prediction accuracy; and performing weighted processing on the power consumption state characteristics and the environmental state characteristics according to the updated fusion weight information to generate fusion features.

[0147] The first prediction accuracy of the LSTM branch and the second prediction accuracy of the Transformer branch can be obtained through independent verification evaluation. That is, for each branch, the LSTM and Transformer branches are run on the verification set respectively, and the prediction errors (such as MSE (Mean-square error) and MAPE (Mean absolute percentage error)) are calculated. Based on the prediction errors, the prediction accuracy is obtained. and F The LSTM branch mainly evaluates the predictive ability of short-term time series dependencies (such as daily / weekly electricity consumption fluctuations); the Transformer branch evaluates the modeling effect of external features (GDP, policies, etc.) on long-term trends.

[0148] In the above embodiment, by obtaining the first prediction accuracy of the LSTM branch and the second prediction accuracy of the Transformer branch, the fusion weight information can be adaptively updated to accurately generate fusion features based on the updated fusion weight information.

[0149] In an exemplary embodiment, the regional electricity consumption prediction method further includes:

[0150] For any first feature among the electricity consumption characteristics and environmental resource characteristics, obtain a first electricity consumption prediction value generated by the electricity consumption prediction model after processing the second feature, and a second electricity consumption prediction value generated by the electricity consumption prediction model after processing the first feature and the second feature, wherein the second feature is at least one feature of the electricity consumption characteristics and the environmental resource characteristics except the first feature; based on the first electricity consumption prediction value and the second electricity consumption prediction value, detect the average marginal contribution information of the first feature; based on the average marginal contribution information, screen the first feature whose importance is higher than the preset importance threshold from the electricity consumption characteristics and the environmental resource characteristics, wherein the first feature is used to predict the regional electricity consumption for the future time period in the next iteration round of the electricity consumption prediction model.

[0151] Specifically, the present application can identify high-influence features during the training process of the power consumption prediction model. Specifically, by detecting the average marginal contribution information of each feature, high-influence features during the training process of the power consumption prediction model can be identified. The features during the training process of the power consumption prediction model include power consumption features and any first feature of multiple environmental resource features.

[0152] The method for detecting the average marginal contribution information of each feature includes: obtaining a first power consumption prediction value generated by the power consumption prediction model after processing the second feature, and a second power consumption prediction value generated by the power consumption prediction model after processing the first and second features, and generating the average marginal contribution information of the first feature based on the first power consumption prediction value and the second power consumption prediction value. The average marginal contribution information is used to quantify the difference in prediction before and after the first feature takes effect. The expression of the average marginal contribution information includes:

[0153]

[0154] in, For the The average marginal contribution information of each feature. Represented as a collection of all features during model training (such as power consumption features and at least one feature from multiple environmental resource features) ). is a feature subset ( ), traverse all possible subset combinations. M is the total number of features. is the combined weight to ensure balanced contributions of all subsets. is used to calculate the model prediction value for a subset of features. It reflects the change in the value of the function F predicted by the model after adding element i to the set S.

[0155] Furthermore, based on the average marginal contribution information of each first feature, target features whose importance is higher than a preset importance threshold are screened from the electricity consumption features and multiple environmental resource features, that is, target average marginal contribution information whose average marginal contribution information is greater than a preset contribution threshold is screened, and the first feature corresponding to the target average marginal contribution information is determined as the target feature whose importance is higher than the preset importance threshold, wherein the target feature is used to predict the regional electricity consumption for the future time period in the next iteration round of the electricity consumption prediction model.

[0156] In the above embodiment, by detecting the average marginal contribution information of each feature, target features whose importance is higher than the preset importance threshold can be accurately screened from the electricity consumption features and environmental resource features, so as to select features for the prediction and training process of the model in the next round of iteration, thereby improving the accuracy of the model training and prediction process.

[0157] In an exemplary embodiment, the regional electricity consumption prediction method further includes:

[0158] Obtain the structural parameters, preset segmented convergence factor, and branch complexity of the Transformer branch in the current iteration round; based on the preset segmented convergence factor, process the branch complexity and the second prediction accuracy to obtain convergence impact information; based on the convergence impact information, update the structural parameters of the Transformer branch in the current iteration round.

[0159] Specifically, in order to explore the variation possibility of the Transformer structure, candidate models can be generated through random perturbations to avoid overfitting of a single structure. Through cross-cycle adaptability, it can adapt to different time scale characteristics (for example, the long-term impact of economic production indicators requires a deeper Transformer), and the number of attention heads can be randomly increased or decreased. ,Adjustment The optimization update formula of its model is: ,in, No. The structural parameters of the Transformer in the round iteration, To preset the segment convergence factor, control the attenuation rate of the mutation intensity, is a random weight coefficient that balances the accuracy of Transformer branch prediction and the weight of branch complexity. is the mean absolute percentage error on the validation set, is the branch complexity of the Transformer branch.

[0160] It can be seen from the above expression that this application processes the branch complexity and the second prediction accuracy based on the preset segment convergence factor to obtain the convergence impact information , and then based on the convergence impact information, the structural parameters of the Transformer branch in the current iteration round are updated to obtain the structural parameters of the next iteration round.

[0161] Wherein, based on the preset segmented convergence factor, the branch complexity and the second prediction accuracy are processed to obtain convergence influence information, including: performing weighted processing on the branch complexity and the second prediction accuracy to obtain weighted processing information , and based on the preset segmented convergence factor f(t), the weighted processing information is processed to obtain convergence influence information.

[0162] Furthermore, the segmented convergence factor is used to balance global exploration and local exploitation: in the early stage ( ) High exploration intensity, encouraging structural diversity. Late stage ( ) Low exploration intensity, focusing on parameter fine-tuning.

[0163]

[0164] in, is the current training round, Maximum number of training rounds, The convergence factor is a parameter used to adjust the convergence speed of the system or algorithm, controlling the mutation intensity of the attacker population to decay with the training process. When t≤0.5T max When t>0.5T, the cosine function is used to describe the change of f(t), which means that in the initial stage, f(t) may show a periodic vibration or fluctuation; when t>0.5T max When t exceeds 0.5T, an exponential decay function is used to describe the change of f(t). max After that, f(t) begins to decay gradually. When the convergence factor f(t) decreases gradually with time t, the mutation intensity of the attacker population is controlled to gradually weaken, making the algorithm converge to the optimal solution more stably.

[0165] In the above embodiment, by presetting a segmented convergence factor and processing the branch complexity and the second prediction accuracy, accurate convergence impact information can be obtained, and based on the convergence impact information, the structural parameters of the Transformer branch in the current iteration round are accurately updated to improve the prediction ability of the Transformer branch.

[0166] In an exemplary embodiment, the present application optimizes the power consumption prediction model through various measures, as follows:

[0167] 1. ICHOA (Chimp Optimization Algorithm) optimizes model structure and hyperparameters:

[0168] By dynamically balancing prediction accuracy and branch complexity, we optimize the hyperparameter configuration of the LSTM-Transformer hybrid model, ensuring the model achieves the optimal trade-off between high accuracy and low computational overhead. This approach improves generalization by avoiding overfitting (e.g., reducing the sensitivity of complex models to noisy data); accelerates training by reducing the dimensionality of the search space through parameter pruning and initialization strategies; and enhances interpretability by clarifying the contribution of key hyperparameters to prediction results (e.g., the impact of the number of attention heads on multi-source feature fusion).

[0169] 1.1 Search Space:

[0170] LSTM parameters: number of hidden units It is related to the ability to extract time series features. Too large a value will increase the amount of calculation and the number of stacking layers. Deep networks can model complex dependencies, but this can easily lead to gradient disappearance; Dropout rate It is an important regularization technical parameter in neural networks, used to prevent the model from overfitting. The value is 0.2~0.5, which is the core regularization parameter to prevent overfitting.

[0171] Transformer parameters: number of attention heads The multi-head mechanism captures heterogeneous features, but too many heads may cause redundancy; model dimension To align with the input feature dimension, it affects the global interaction ability; the feedforward layer dimension To determine the strength of nonlinear transformation, too small a value will result in insufficient feature expression.

[0172] Fusion weights of LSTM and Transformer , learning rate : Fusion weight , learning rate Too large will cause oscillation, too small will converge slowly, and it is necessary to integrate weights , learning rate Controls the optimization step size.

[0173] 1.2 Adversarial Learning Initialization: In order to expand the search diversity and avoid traditional random initialization falling into local optimality while accelerating convergence, we can explore both ends of the parameter space through adversarial solutions (such as testing small and large models at the same time). The role of adversarial solutions is to enhance the algorithm's exploration ability, avoid local optimality, and improve global search efficiency by introducing solutions that are opposite or complementary to the current solution in the parameter space. , generating the opposite solution: ,in, is the initial parameter individual, for example, the number of hidden units of LSTM is h=128, is the generated alternative solution. If the alternative solution outperforms the current solution (e.g., has lower loss), it is retained and considered to replace the current solution. If it is worse, the strategy determines whether to retain it (e.g., a probabilistic acceptance mechanism).

[0174] 1.3 Fitness Function: Through the fitness function, we can optimize both prediction error and computing resource consumption, and prevent the model from reducing efficiency due to redundant structures (such as too many attention heads). Jointly optimize prediction error and branch complexity:

[0175]

[0176] in, is the mean absolute percentage error (a measure of model prediction error), , , is the maximum value allowed in the search space and is used to normalize the complexity term. h is the number of hidden layers in the model, L is the number of neurons (or nodes) in each layer, hL represents the total number of model parameters, and d model is the dimension of the electricity consumption prediction model, 、 is the weight coefficient of the search space, for example,

[0177] In this application, the branch complexity is increased from the original complexity range [0, C max ] is mapped to [0, 1] to make it consistent with the dimension of the error term (such as MAPE, which usually ranges from [0, 100%]), making it easier to balance prediction accuracy and branch complexity through adaptive weighting.

[0178] 2. Dynamic role division and collaborative optimization:

[0179] By dynamically dividing the attacker and dispersal populations, the model structure and fusion parameters are optimized separately, achieving a balance between exploration and exploitation, improving the algorithm's global search capabilities and local convergence speed. This has the following effects: enhancing model robustness: the attacker population explores diverse model structures to avoid being trapped in local optima; accelerating parameter convergence: the dispersal population fine-tunes key parameters to improve prediction stability; and adaptive learning: the segmented convergence factor dynamically adjusts the optimization rhythm, balancing training efficiency and accuracy.

[0180] 2.1 Attacker Population: To explore the variation possibility of the Transformer structure, candidate models can be generated through random perturbations to avoid overfitting of a single structure. Through cross-cycle adaptability, it can adapt to different time scale characteristics (for example, the long-term impact of economic indicators requires a deeper Transformer), and the number of attention heads can be randomly increased or decreased. ,Adjustment In addition, the structural parameters of the Transformer branch in the current iteration round can be updated by presetting the segmented convergence factor, branch complexity and the second prediction accuracy of the Transformer branch. The updating process is the same as the above embodiment and will not be repeated here.

[0181] 2.2 Driver population: Adjust the fusion weight according to the real-time performance difference, ensure that the dominant branch dominates the prediction, and use a small learning rate Avoid frequent weight switching and improve training stability. Optimize LSTM parameters and fusion weights :

[0182]

[0183] in, is the fusion weight of LSTM and Transformer; is the learning rate, which is used to control the weight adjustment step size; 、 The prediction performance of LSTM and Transformer branches; Symbolic function.

[0184] 2.3 Convergence Control: Balancing Global Exploration and Local Exploitation through Segmented Convergence Factors: Early Stage ( ) High exploration intensity, encouraging structural diversity. Late stage ( ) Low exploration intensity, focusing parameter fine-tuning. The specific process is the same as the above embodiment and will not be repeated here.

[0185] 3. Forecast Output and Interpretability Analysis: Based on the optimized hybrid model, this system generates electricity consumption forecasts for the next N years and quantifies the forecast confidence intervals and key influencing factors, providing reliable and interpretable decision support. Its functions include: Accurate Forecasting: Utilizing the ICHOA-optimized LSTM-Transformer model to output baseline forecasts; Risk Quantification: Using Bootstrap Sampling to assess the model's robustness to noise and policy changes; Attribution Analysis: Identifying the core factors driving electricity consumption changes (such as GDP growth and climate anomalies).

[0186] 3.1 Power consumption forecast:

[0187]

[0188] The power consumption feature includes a sliding window of power consumption within a preset time period; Integrate economic, climate, and policy data for environmental resource characteristics; For the optimized LSTM-Transformer hybrid model, dynamic fusion weights Generate final predictions with ICHOA hyperparameters.

[0189] 3.2 Confidence Interval:

[0190] Quantify the potential impact of external interference (such as economic crises and extreme weather) on the forecast. When the width of the confidence interval increases significantly, it indicates that the model's prediction of the sample has high uncertainty. This application is sensitive to certain input features and uses a 95% confidence interval based on Bootstrap resampling to quantify the uncertainty of the forecast results. Bootstrap resampling refers to generating B new datasets of the same size as the original dataset by resampling with replacement. The model is trained on each resampled dataset to obtain B prediction models. The B models are used to predict the same input to obtain B prediction results. The B prediction results are sorted by size, and the 2.5% quantile is taken as the lower limit and the 97.5% quantile is taken as the upper limit.

[0191] The expression can be:

[0192]

[0193] in, Output the predicted value, the lower limit of the 95% confidence interval is , the upper limit of the 95% confidence interval is Bootstrap simulates the randomness of the data generation process, generating a large number of virtual samples to simulate the uncertainty of the data distribution. Each sample reflects a different random fluctuation of data noise. By analyzing the distribution of prediction results on these virtual samples, the impact of data noise on prediction uncertainty can be quantified.

[0194] 3.3 Feature Attribution: That is, in the above embodiment, features are screened by the average marginal contribution information of each feature, which will not be repeated here.

[0195] In an exemplary embodiment, the regional electricity consumption forecasting method of the present application extracts temporal dynamics through time series feature construction, integrates multi-source information through external feature fusion, and enhances sequential modeling through position encoding. These three methods work together to solve the following problems in electricity consumption forecasting:

[0196] 1. Time dependence: Electricity consumption characteristics and time series position coding features jointly model short-term and long-term time patterns.

[0197] 2. External environmental interference: After the climate, production, population and other indicators are integrated with policy markers, the model’s adaptability to emergencies is enhanced.

[0198] 3. Periodicity: Periodic codes explicitly describe fluctuations in fixed periods such as seasons and months.

[0199] Taking the LSTM-Transformer hybrid model as an example, the regional electricity consumption prediction method based on the electricity consumption prediction model includes:

[0200] S1. Obtaining electricity consumption information and multiple environmental resource information of a target area in a preset time period.

[0201] S2. Extracting electricity consumption characteristics in multiple time intervals from the electricity consumption information, and extracting environmental resource characteristics from the environmental resource information.

[0202] S3. Position-code the power consumption characteristics in multiple time intervals respectively to obtain time series position coding characteristics in multiple time intervals, and period-code the multiple time intervals to obtain period coding characteristics.

[0203] S4. Input the power consumption features, period encoding features, and time series position encoding features into the LSTM branch. The power consumption features + time series position encoding features jointly model short-term and long-term time patterns. The LSTM branch captures local time series patterns (such as short-term power consumption fluctuations) and can model time dependencies to generate power consumption status features.

[0204] S5. Input the environmental resource features and temporal position encoding features into the Transformer branch. The Transformer branch learns the long-term association of external environmental resource features (such as the cross-cycle relationship between economic indicators and electricity consumption) and generates environmental state features through the self-attention mechanism.

[0205] S6. Perform weighted fusion on the power consumption state characteristics and the environmental state characteristics to obtain fusion characteristics, wherein the weight of the weighted fusion is based on the first prediction accuracy of the LSTM branch and the second prediction accuracy of the Transformer branch, and is obtained by updating the weight in the previous cycle.

[0206] S7. Input the fused features into the fully connected layer, and the fully connected layer predicts the electricity consumption information in the future time period.

[0207] The solution of this application has the following advantages:

[0208] 1. This application proposes a deep fusion of multimodal features and a model architecture. Through a hybrid LSTM-Transformer architecture, combining the local temporal modeling capabilities of LSTM with the global attention mechanism of Transformer, it effectively improves adaptability to complex scenarios. This architecture supports cross-modal fusion of heterogeneous data from multiple sources (such as economic indicators and daily electricity consumption), breaking through the linear assumption limitations of traditional methods. It significantly reduces prediction errors in scenarios where sudden policy changes overlap with long-term economic trends, providing a more accurate modeling foundation for medium- and long-term electricity consumption forecasts.

[0209] 2. This application solution introduces a dynamic feature fusion module that automatically adjusts the contribution weights of time series features and external environmental features based on an adaptive strategy. In extreme climate or policy change scenarios, the model enhances forecast stability by strengthening the weights of key features. It also combines bootstrap resampling to generate confidence intervals, quantifying the impact of data noise on forecast results and providing risk-controlled decision support for power grid dispatch.

[0210] 3. This application solution uses an intelligent optimization algorithm to perform global hyperparameter search, avoiding the pitfalls of traditional methods that often fall into local optimality. Through a segmented convergence control mechanism, the computing resources required for model training are significantly reduced. The optimized lightweight version can be deployed on edge devices to achieve real-time prediction and response, significantly improving the efficiency of application in complex scenarios.

[0211] 4. This application proposes a feature contribution quantification and visualization technology to identify the marginal effects of core drivers (such as economic indicators and policy markers) on forecast results, providing a quantitative basis for policy adjustments. The model can trace the impact paths of key features, supporting refined decision-making in grid planning and resource scheduling. The validation scenarios cover provincial-level peak power demand warnings and emergency response, ensuring that forecast results are both highly accurate and interpretable.

[0212] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0213] Based on the same inventive concept, the embodiments of the present application also provide a regional power consumption prediction device for implementing the aforementioned regional power consumption prediction device method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations of one or more regional power consumption prediction device embodiments provided below can be referred to the limitations of the regional power consumption prediction device method above and will not be repeated here.

[0214] In an exemplary embodiment, Figure 4 As shown, a regional electricity consumption prediction device is provided, comprising: an acquisition module 100, a feature extraction module 200, a processing module 300 and a prediction module 400, wherein:

[0215] An acquisition module 100 is configured to acquire power consumption information and multiple environmental resource information of a target area during a preset time period;

[0216] A feature extraction module 200 is configured to extract power consumption features in multiple time intervals from power consumption information and to extract environmental resource features from environmental resource information;

[0217] Processing module 300, configured to convert power consumption characteristics in multiple time intervals into power consumption state characteristics, and to convert multiple environmental resource characteristics into environmental state characteristics, wherein the power consumption state characteristics are used to characterize the temporal dependencies between the power consumption characteristics in multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependencies between the multiple environmental resource characteristics;

[0218] The prediction module 400 is used to predict the regional power consumption of the target area in a future time period based on the power consumption state characteristics and the environmental state characteristics.

[0219] In one embodiment, the environmental resource information includes at least one of climate resource information, population resource information, production resource information, and resource allocation intervention information; the feature extraction module 200 is also used to extract climate resource features from the climate resource information, extract population resource features from the population resource information, and extract production resource features from the production resource information when the environmental resource information includes climate resource information, population resource information, production resource information, and resource allocation intervention information; the feature extraction module 200 is also used to splice the climate resource features, population resource features, production resource features, and resource allocation intervention information to obtain environmental splicing features; and convert the environmental splicing features into environmental state features.

[0220] In one embodiment, the regional electricity consumption prediction device also includes an encoding module, which is used to position-encode the electricity consumption characteristics in multiple time intervals respectively to obtain time series position coding characteristics in multiple time intervals, and period-encode the multiple time intervals to obtain period coding characteristics; the feature extraction module 200 is also used to process the electricity consumption characteristics, period coding characteristics and time series position coding characteristics through the LSTM branch to obtain electricity consumption state characteristics; the feature extraction module 200 is also used to process multiple environmental resource characteristics and time series position coding characteristics through the Transformer branch to obtain environmental state characteristics.

[0221] In one embodiment, the regional electricity consumption prediction method is executed by an electricity consumption prediction model, which includes an LSTM branch and a Transformer branch; the prediction module 500 is also used to obtain fusion weight information, a first prediction accuracy of the LSTM branch, and a second prediction accuracy of the Transformer branch; the fusion weight information is updated according to the first prediction accuracy and the second prediction accuracy; according to the updated fusion weight information, the electricity consumption state characteristics and the environmental state characteristics are weighted to generate fusion features; based on the fusion features, the regional electricity consumption of the target area in the future time period is predicted.

[0222] In one embodiment, the electricity consumption prediction model also includes a feature screening module, which is used to obtain, for any first feature among the electricity consumption features and environmental resource features, a first electricity consumption prediction value generated by the electricity consumption prediction model after processing the second feature, and a second electricity consumption prediction value generated by the electricity consumption prediction model after processing the first feature and the second feature, wherein the second feature is at least one feature other than the first feature among the electricity consumption features and the environmental resource features; based on the first electricity consumption prediction value and the second electricity consumption prediction value, detect the average marginal contribution information of the first feature; based on the average marginal contribution information, screen target features whose importance is higher than a preset importance threshold from the electricity consumption features and the environmental resource features, wherein the target features are used to predict regional electricity consumption for future time periods in the next iteration round of the electricity consumption prediction model.

[0223] In one embodiment, the power consumption prediction model also includes a model parameter update module, which is used to obtain the structural parameters, preset segmented convergence factor and branch complexity of the Transformer branch in the current iteration round; based on the preset segmented convergence factor, the branch complexity and the second prediction accuracy are processed to obtain convergence impact information; based on the convergence impact information, the structural parameters of the Transformer branch in the current iteration round are updated.

[0224] Each module in the aforementioned regional electricity consumption prediction device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0225] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 5As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data such as power consumption information and environmental resource information of the target area in a preset time period. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for predicting regional power consumption is implemented.

[0226] Those skilled in the art will understand that Figure 5 The structure shown in the figure is a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0227] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0228] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0229] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0230] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Among them, any reference to memory, database or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, artificial intelligence (AI) processors, and the like.

[0231] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0232] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A method for predicting regional electricity consumption, characterized in that: The method comprises: Obtaining electricity consumption information and multiple environmental resource information of the target area during a preset time period; Extracting power consumption characteristics in multiple time intervals from the power consumption information, and extracting environmental resource characteristics from the environmental resource information; Converting the power consumption characteristics in the multiple time intervals into power consumption state characteristics, and converting the multiple environmental resource characteristics into environmental state characteristics, wherein the power consumption state characteristics are used to characterize the time dependency relationship between the power consumption characteristics in the multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependency relationship between the multiple environmental resource characteristics; The regional power consumption of the target area in a future time period is predicted according to the power consumption state characteristics and the environmental state characteristics.

2. The method according to claim 1, characterized in that The environmental resource information includes at least one of climate resource information, population resource information, production resource information, and resource allocation intervention information; and extracting environmental resource characteristics from the environmental resource information includes: In a case where the environmental resource information includes climate resource information, population resource information, production resource information, and resource allocation intervention information, extracting climate resource characteristics from the climate resource information, extracting population resource characteristics from the population resource information, and extracting production resource characteristics from the production resource information; The converting the plurality of environmental resource features into environmental state features comprises: splicing the climate resource characteristics, the population resource characteristics, the production resource characteristics, and the resource allocation intervention information to obtain an environmental splicing characteristic; The environment stitching features are converted into environment state features.

3. The method according to claim 1, characterized in that Before converting the power consumption characteristics in the multiple time intervals into power consumption state characteristics, the method further includes: Performing position coding on the power consumption characteristics in the multiple time intervals to obtain time series position coding characteristics in the multiple time intervals, and performing period coding on the multiple time intervals to obtain period coding characteristics; The converting the power consumption characteristics in the multiple time intervals into power consumption state characteristics includes: The power consumption feature, the period coding feature, and the time series position coding feature are processed by the LSTM branch to obtain a power consumption state feature; The converting the plurality of environmental resource features into environmental state features comprises: The multiple environmental resource features and the temporal position coding features are processed through the Transformer branch to obtain environmental state features.

4. The method according to claim 1, wherein The regional electricity consumption prediction method is executed by an electricity consumption prediction model, and the electricity consumption prediction model includes an LSTM branch and a Transformer branch; The predicting, based on the power consumption state characteristics and the environmental state characteristics, the regional power consumption of the target area in a future time period includes: Obtaining fusion weight information, a first prediction accuracy of the LSTM branch, and a second prediction accuracy of the Transformer branch; updating the fusion weight information according to the first prediction accuracy and the second prediction accuracy; Performing weighted processing on the power consumption state feature and the environmental state feature according to the updated fusion weight information to generate a fusion feature; The regional electricity consumption of the target area in a future time period is predicted based on the fusion features.

5. The method according to claim 4, characterized in that The method further comprises: For any first feature of the power consumption feature and the environmental resource feature, obtaining a first power consumption prediction value generated by the power consumption prediction model after processing the second feature, and a second power consumption prediction value generated by the power consumption prediction model after processing the first feature and the second feature, wherein the second feature is at least one feature of the power consumption feature and the environmental resource feature other than the first feature; Detecting average marginal contribution information of the first feature based on the first power consumption prediction value and the second power consumption prediction value; Based on the average marginal contribution information, target features whose importance is higher than a preset importance threshold are screened from the electricity consumption features and the environmental resource features, wherein the target features are used to predict regional electricity consumption for a future time period in the next iteration round of the electricity consumption prediction model.

6. The method according to claim 4, characterized in that The method further comprises: Obtaining the structural parameters, preset segment convergence factor, and branch complexity of the Transformer branch in the current iteration round; Based on the preset segmented convergence factor, processing the branch complexity and the second prediction accuracy to obtain convergence impact information; Based on the convergence impact information, the structural parameters of the Transformer branch in the current iteration round are updated.

7. A regional electricity consumption prediction device, characterized in that: The device comprises: An acquisition module is used to obtain power consumption information and multiple environmental resource information of a target area in a preset time period; a feature extraction module, configured to extract power consumption features in multiple time intervals from the power consumption information, and extract environmental resource features from the environmental resource information; a processing module, configured to convert the power consumption characteristics in the multiple time intervals into power consumption state characteristics, and convert the multiple environmental resource characteristics into environmental state characteristics, wherein the power consumption state characteristics are used to characterize the time dependency between the power consumption characteristics in the multiple time intervals, and the environmental state characteristics are used to characterize the environmental dependency between the multiple environmental resource characteristics; The prediction module is used to predict the regional power consumption of the target area in a future time period based on the power consumption state characteristics and the environmental state characteristics.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.