Attention-based electricity sales time series prediction method, system, device and storage medium

By using attention-based graph neural networks and blockchain data acquisition technology, combined with K-means clustering and cosine transform, a dynamic user profile is established, which solves the problem of insufficient attention at key nodes in the LSTM model and achieves high accuracy and adaptability in electricity sales forecasting.

CN121167640BActive Publication Date: 2026-05-22BEIJING LUOHE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING LUOHE TECH CO LTD
Filing Date
2025-10-29
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

Existing LSTM-based time-series forecasting schemes for electricity sales lack sufficient attention to the features of key time nodes when processing long-term time-series data. They struggle to effectively distinguish the degree of importance of different time nodes on electricity sales, resulting in a weak ability to capture sudden changes in electricity sales trends in complex scenarios with multiple intertwined factors, thus affecting forecast accuracy.

Method used

By employing a graph neural network based on an attention mechanism, combined with blockchain data collection, K-means clustering algorithm, and cosine transform, a dynamic user profile is established through cross-regional consensus rules to analyze the spatiotemporal patterns of user behavior and predict electricity sales.

Benefits of technology

It improves the accuracy and adaptability of electricity sales forecasting, can reflect changes in users' electricity consumption habits in a timely manner, breaks down regional data barriers, ensures the immutability and integrity of data, and accurately captures the spatiotemporal correlation patterns of user behavior.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121167640B_ABST
    Figure CN121167640B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of time series prediction, and provides a power sale time series prediction method, system and device based on attention and a storage medium, which solve the problem of power sale prediction accuracy under user power consumption habit change. The application collects power consumption behavior data and power quality data of intelligent terminals from a blockchain; based on the user behavior data, the power consumption types of the intelligent terminals are identified through a K-means clustering algorithm to generate a behavior feature vector; the power quality data is processed in a cosine transformation mode to obtain equipment operation characteristic values; the user behavior data realizes cross-region data sharing, and a corresponding user dynamic portrait is established; the behavior feature vector, the equipment operation characteristic values and the user dynamic portrait are processed and analyzed through a graph neural network based on an attention mechanism to obtain a user behavior space-time law; and the power sale of the user under the power consumption habit change is predicted according to the behavior space-time law. The application can improve the power sale prediction accuracy under the user power consumption habit change.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of time series prediction technology, and in particular to an attention-based method, system, device and storage medium for time series prediction of electricity sales. Background Technology

[0002] Accurate time-series forecasting of electricity sales is crucial in applications such as power market operation, grid dispatching, and optimal allocation of power resources. Electricity sales are influenced by various factors, including seasonal variations, holiday effects, economic activity, and weather conditions, exhibiting complex time-series fluctuations. To ensure the stability of power supply, reduce operating costs, and improve service quality, a time-series forecasting method capable of capturing the dynamic patterns of electricity sales changes under the influence of multiple factors is needed to meet the demand for accurate forecasting of electricity sales at different times and in different regions.

[0003] Currently, the most targeted technical solution for time-series electricity sales forecasting is the Long Short-Term Memory (LSTM) based scheme. This scheme constructs an LSTM model, utilizes its ability to process time-series data, inputs historical electricity sales data and related influencing factor data into the model for training, and then achieves time-series forecasting of future electricity sales.

[0004] However, the aforementioned LSTM-based time-series electricity sales forecasting scheme has certain shortcomings. When processing long-term time-series data, the LSTM model does not pay enough attention to the features of key time nodes (such as peak electricity consumption periods, policy adjustment nodes, etc.), making it difficult to effectively distinguish the degree of importance of different time nodes on electricity sales. As a result, in complex scenarios with multiple intertwined factors, it has a weak ability to capture sudden changes in electricity sales trends, thus affecting the prediction accuracy. Summary of the Invention

[0005] The purpose of this application is to provide an attention-based method, system, device, and storage medium for time-series prediction of electricity sales, in order to solve the problems of accuracy in predicting electricity sales under changes in user electricity consumption habits caused by insufficient attention to key nodes, difficulty in distinguishing the impact of nodes, and weak capture of sudden change trends in the prior art.

[0006] To address the aforementioned technical problems, in a first aspect, this application provides a time-series prediction method for electricity sales based on an attention mechanism, comprising:

[0007] Data on electricity consumption behavior and power quality of smart terminals are collected from the blockchain, and the electricity consumption behavior data includes user behavior data.

[0008] Based on the user behavior data, the power consumption type of the smart terminal is identified by the K-means clustering algorithm, and a behavior feature vector is generated based on the power consumption type.

[0009] The power quality data is processed using a cosine transform method to obtain equipment operating characteristic values;

[0010] Cross-regional data sharing of user behavior data is achieved through preset consensus rules, and corresponding dynamic user profiles are established based on the shared user behavior data.

[0011] By processing and analyzing the behavioral feature vector, the device operation feature value, and the information in the user dynamic profile using a graph neural network based on an attention mechanism, the spatiotemporal patterns of user behavior can be obtained.

[0012] Based on the spatiotemporal patterns of the aforementioned behavior, predict the electricity sales volume of the user under changes in electricity consumption habits.

[0013] Optionally, the step of achieving cross-regional data sharing of user behavior data through preset consensus rules, and establishing corresponding dynamic user profiles based on the shared user behavior data, includes:

[0014] Set preset consensus rules, which include node admission rules, information conversion rules, and regional coding rules;

[0015] Based on the node admission rules, target nodes for cross-regional data sharing are selected from all smart terminals. The target nodes are smart terminals that have been verified by the blockchain.

[0016] Based on the information conversion rules, the user behavior data associated with the target node in the blockchain is converted into standardized signals;

[0017] Based on the aforementioned region coding rules, a region source marker is added to the standardized signal;

[0018] Using the target node, a standardized signal with a regional source mark is transmitted to a relay node. The relay node restores the standardized signal with the regional source mark to user behavior data and summarizes it to form cross-regional summary information.

[0019] Extract the electricity consumption period ratio, equipment start-up interval and electricity peak change signal from the cross-regional aggregated information, and group and integrate them according to the user identity corresponding to the target node to generate the corresponding user feature set;

[0020] Based on the user feature set, a corresponding dynamic user profile is established.

[0021] Optionally, establishing a corresponding dynamic user profile based on the user feature set includes:

[0022] Extract the peak electricity consumption interval corresponding to the electricity consumption period ratio, the linkage mode corresponding to the equipment start-up interval, and the electricity fluctuation cycle corresponding to the electricity consumption peak change signal from the user feature set;

[0023] The peak electricity consumption period, the linkage mode, and the electricity consumption fluctuation cycle are associated and integrated according to the corresponding user identity to form an initial tag set;

[0024] Calculate the changes in the percentage of electricity consumption periods, the device startup interval, and the peak electricity consumption change signal in the user feature set within two consecutive cycles. If any change exceeds the corresponding preset threshold range, update the initial label set to obtain the target label set.

[0025] Based on the target tag set, a dynamic user profile is constructed.

[0026] Optionally, the step of processing and analyzing the behavioral feature vector, the device operating feature value, and the information in the user dynamic profile using an attention-based graph neural network to obtain the spatiotemporal patterns of user behavior includes:

[0027] The behavioral feature vector, the device operation feature value, and the information in the user dynamic profile are converted into corresponding network input features;

[0028] A correlation graph is constructed based on the correlation between the network input features, and a corresponding attention weight is assigned to the features of highly correlated nodes in the correlation graph through an attention mechanism.

[0029] A graph neural network is used to process the features of related nodes with assigned attention weights to output the temporal distribution features and spatial correlation features of user behavior.

[0030] By integrating the temporal distribution features and the spatial correlation features, the spatiotemporal patterns of user behavior are obtained.

[0031] Optionally, the step of constructing a correlation graph according to the correlation between the network input features, and assigning corresponding attention weights to the features of highly correlated nodes in the correlation graph through an attention mechanism, includes:

[0032] Determine the co-occurrence frequency of each network input feature in user electricity consumption events and the degree of influence between changes in each network input feature. Based on the correlation between the co-occurrence frequency and the degree of influence, calculate the correlation degree between each network input feature.

[0033] Using the network input features as nodes and the correlation degree as edge weights, a correlation graph is constructed based on the nodes and edge weights. The numerical value of the edge weight in the correlation graph is proportional to the quantified value of the correlation degree of the corresponding node features.

[0034] The sum of the edge weights connected to each node feature in the association graph is calculated, and node features whose sum is greater than a preset sum threshold are marked as high-association node features.

[0035] Based on the magnitude of the sum, attention weights are assigned to the features of the highly correlated nodes using an attention mechanism.

[0036] Optionally, the step of identifying the power consumption type of the smart terminal based on the user behavior data using a K-means clustering algorithm, and generating a behavioral feature vector based on the power consumption type, includes:

[0037] The user behavior data is analyzed by clustering the user's electricity consumption time period and electricity load fluctuation characteristics using the K-means clustering algorithm to identify the electricity consumption type corresponding to the smart terminal.

[0038] Based on the electricity consumption type, the electricity consumption frequency and equipment start-up and shutdown patterns in the user behavior data, a behavioral feature vector is generated.

[0039] Optionally, the step of performing cluster analysis on the user's electricity consumption time period and electricity load fluctuation characteristics in the user behavior data using the K-means clustering algorithm to identify the electricity consumption type corresponding to the smart terminal includes:

[0040] Extract the percentage of electricity usage time of users within a preset time interval from the user behavior data, and use the percentage of electricity usage time as the user's electricity usage time period feature;

[0041] Extract the amount of change in electricity load and the number of times the electricity load changes per unit time from the user behavior data, and use the amount of change in electricity load and the number of times the change changes as the characteristics of electricity load fluctuation;

[0042] The user's electricity consumption time period characteristics and the electricity load fluctuation characteristics are integrated to form a cluster analysis object;

[0043] The clustering analysis objects are classified using the K-means clustering algorithm to obtain multiple feature categories;

[0044] Based on the multiple feature categories, the power consumption type corresponding to the smart terminal is determined.

[0045] Secondly, this application provides an attention-based time-series prediction system for electricity sales, comprising:

[0046] The data acquisition module is used to collect electricity consumption behavior data and power quality data of smart terminals from the blockchain, wherein the electricity consumption behavior data includes user behavior data;

[0047] The generation module is used to identify the power consumption type of the smart terminal based on the user behavior data using the K-means clustering algorithm, and generate a behavior feature vector based on the power consumption type;

[0048] The processing module is used to process the power quality data using a cosine transform method to obtain equipment operating characteristic values;

[0049] A module is established to achieve cross-regional data sharing of the user behavior data through preset consensus rules, and to establish a corresponding dynamic user profile based on the shared user behavior data.

[0050] The analysis module is used to process and analyze the behavioral feature vector, the device operation feature value, and the information in the user dynamic profile through a graph neural network based on an attention mechanism to obtain the spatiotemporal pattern of user behavior;

[0051] The prediction module is used to predict the electricity sales volume of the user under changes in electricity consumption habits based on the spatiotemporal patterns of the behavior.

[0052] Thirdly, this application provides an electronic device, comprising:

[0053] Memory, used to store computer programs;

[0054] A processor, configured to execute the computer program to implement the steps of the attention-based electricity sales timing prediction method as described in the first aspect above.

[0055] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps of the attention-based electricity sales timing prediction method described in the first aspect above.

[0056] This application provides an attention-based method for time-series prediction of electricity sales, comprising: collecting electricity consumption behavior data and power quality data of smart terminals from a blockchain, wherein the electricity consumption behavior data includes user behavior data; identifying the electricity consumption type of smart terminals using a K-means clustering algorithm based on the user behavior data, and generating a behavior feature vector based on the electricity consumption type; processing the power quality data using a cosine transform to obtain device operation feature values; achieving cross-regional data sharing of user behavior data through a preset consensus rule, and establishing a corresponding dynamic user profile based on the shared user behavior data; processing and analyzing the behavior feature vector, device operation feature values, and information in the dynamic user profile using an attention-based graph neural network to obtain the spatiotemporal pattern of user behavior; and predicting the electricity sales of users under changes in electricity consumption habits based on the spatiotemporal pattern of behavior.

[0057] The beneficial effects of this application are:

[0058] The attention-based electricity sales time-series prediction method provided in this application collects electricity consumption behavior data and power quality data from smart terminals from the blockchain, leveraging the blockchain's characteristics to ensure data immutability and integrity. By using K-means clustering algorithm based on user behavior data to identify the electricity consumption type of smart terminals and generate behavioral feature vectors, it achieves accurate classification of electricity consumption types, providing structured feature basis for subsequent analysis. By processing power quality data using cosine transform to obtain equipment operation feature values, it effectively extracts key features of equipment operating status. By pre-setting consensus rules to achieve cross-regional sharing of user behavior data and establish dynamic user profiles, it breaks down regional data barriers and dynamically reflects user behavior characteristics. By processing and analyzing behavioral feature vectors, equipment operation feature values, and dynamic user profile information using an attention-based graph neural network, it obtains the spatiotemporal patterns of user behavior, accurately capturing the temporal and spatial correlation patterns of user behavior. By predicting electricity sales under changing user electricity consumption habits based on these spatiotemporal behavioral patterns, it improves the adaptability of electricity sales prediction to changes in user habits.

[0059] Furthermore, by setting preset consensus rules and filtering target nodes, user behavior data is converted into standardized signals and marked with regional origins. After transmission and aggregation, electricity consumption characteristics are extracted and grouped to generate user feature sets. Key information is then extracted from these user feature sets to form an initial tag set. The tag set is updated based on feature changes to construct a dynamic user profile. Standardization and regional marking ensure the consistency and traceability of cross-regional data. Dynamically updating the tag set allows the dynamic user profile to reflect changes in user behavior in a timely manner, improving the timeliness and accuracy of the profile and providing reliable user characteristic data for electricity sales forecasting.

[0060] These or other aspects of this application will become more apparent in the following description of the embodiments. Attached Figure Description

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

[0062] Figure 1 A flowchart illustrating an attention-based time-series prediction method for electricity sales provided in this application embodiment;

[0063] Figure 2A schematic diagram illustrating a specific implementation of an attention-based time-series prediction method for electricity sales provided in this application.

[0064] Figure 3 A schematic diagram illustrating a specific implementation of an attention-based time-series prediction method for electricity sales provided in this application.

[0065] Figure 4 This is a schematic diagram of the structure of an attention-based electricity sales time-series prediction system provided in an embodiment of this application. Detailed Implementation

[0066] To address the issues of insufficient attention to key nodes, difficulty in distinguishing node impacts, and weak capture of abrupt change trends in existing technologies, this application provides an attention-based time-series prediction method for electricity sales. This method employs the following design concept: collecting electricity consumption behavior data and device operation quality data from the blockchain, whereby the electricity consumption behavior data includes user electricity consumption behavior information; based on the user's electricity consumption behavior information, distinguishing the electricity consumption type of the smart terminal through clustering and generating corresponding behavioral features; processing the device operation quality data to obtain feature values ​​reflecting the device's operating status; achieving data sharing of electricity consumption behavior across different regions through pre-defined sharing rules, and establishing a profile that dynamically reflects user electricity consumption characteristics based on the shared data; utilizing a network model incorporating an attention mechanism to analyze the behavioral features, device operation feature values, and information in the user's dynamic profile to identify patterns in user electricity consumption behavior over time and space; and finally, predicting electricity sales when user electricity consumption habits change based on these patterns. In this solution, blockchain-based data collection ensures data reliability, clustering and feature processing better distinguish the impact of different factors, network models combined with attention mechanisms can focus on important time points, and dynamic profiles can reflect changes in user electricity consumption in a timely manner. This solves the problems of existing methods that do not pay enough attention to important time points, have difficulty distinguishing different impacts, and do not capture sudden changes well, thus improving the accuracy of electricity sales forecasting.

[0067] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0068] The core of this application is to provide an attention-based method for time-series prediction of electricity sales, and a flowchart of one specific implementation is shown below. Figure 1 As shown, the method includes:

[0069] S11. Collect electricity consumption behavior data and power quality data of smart terminals from the blockchain. The electricity consumption behavior data includes user behavior data.

[0070] Blockchain is a system that records data and ensures its authenticity and integrity by making the data difficult to modify. Smart terminals are devices like smart meters that automatically record electricity consumption. Electricity consumption behavior data records information related to user electricity usage, including usage time and amount. Power quality data reflects the stability of the power supply, such as voltage fluctuations and current stability. Through this process, the final result is electricity consumption behavior data and power quality data categorized and organized according to smart terminals.

[0071] In this embodiment, the scope of smart terminals for which data needs to be collected is first determined, such as all smart meters in area A. Then, the electricity consumption behavior data recorded by these smart terminals is obtained through the blockchain recording system. This includes user electricity consumption time, electricity consumption, and power quality data, such as voltage fluctuations and current stability. Finally, the collected data is categorized and organized by smart terminal for subsequent processing. For example, smart terminals in area A record user electricity consumption time periods (e.g., 18:00-22:00) and hourly electricity consumption, as well as power quality data such as voltage fluctuations within the range of 220V±5V. This data is extracted through the blockchain and organized by terminal number.

[0072] S12. Based on user behavior data, identify the power consumption type of smart terminals using the K-means clustering algorithm, and generate a behavior feature vector based on the power consumption type.

[0073] K-means clustering is a method that groups data with similar characteristics into the same category. Electricity usage type is categorized based on user electricity consumption habits, such as residential electricity use and commercial electricity use. The behavioral feature vector is a set of numerical combinations representing key features of the electricity usage type, with each number corresponding to a feature. Through this step, a behavioral feature vector reflecting the electricity usage type is ultimately generated.

[0074] In this embodiment of the application, key information, such as electricity consumption time distribution, average daily electricity consumption, and peak electricity consumption frequency, is first extracted from user behavior data. Secondly, as... Figure 2As shown, the K-means clustering algorithm is used to process this information, grouping user behavior data with similar features into one category to identify electricity consumption type (e.g., high daytime electricity consumption is categorized as commercial electricity consumption, and nighttime electricity consumption as residential electricity consumption). Finally, the characteristics of each electricity consumption type are represented by numerical combinations to generate a behavioral feature vector. For example, from the user behavior data of region A, the daytime electricity consumption percentage and average daily electricity consumption level are extracted. The clustering algorithm categorizes those with a daytime percentage of over 80% and a level of 5 as commercial electricity consumption, generating a feature vector such as (1, 0.8, 5) (1 represents commercial type, 0.8 represents daytime percentage, and 5 represents level).

[0075] S13. The power quality data is processed using a cosine transform method to obtain the equipment operating characteristic values.

[0076] Cosine transform is a processing method that converts data from its raw form into a format that makes it easier to extract key features. Power quality data includes variations in voltage and current over time. Equipment operating characteristic values ​​are numerical indicators reflecting the operating status of equipment, such as voltage fluctuation amplitude and fluctuation period. Through this step, the final equipment operating characteristic values ​​that reflect the operating status of the equipment are obtained.

[0077] In this embodiment, power quality data recorded by the smart terminal is first collected, such as hourly voltage and current values ​​within a day. Then, a cosine transform is used to process this data, converting the original voltage and current curves over time into a form that highlights the fluctuation patterns. Finally, key indicators are extracted from the transformation results to obtain the equipment's operating characteristic values. For example, the voltage values ​​recorded by the smart terminal in area A are 220V at 9:00 AM, 223V at 10:00 AM, and 219V at 11:00 AM. After cosine transform, the fluctuation amplitude is 4V (the difference between the maximum and minimum values), and the period is 2 hours (the interval between adjacent peak values), yielding the characteristic value (4,2).

[0078] S14. Implement cross-regional data sharing of user behavior data through preset consensus rules, and establish corresponding dynamic user profiles based on the shared user behavior data.

[0079] The pre-defined consensus rules are pre-established regulations for cross-regional data sharing, including node access rules (which smart terminals can participate in sharing), information conversion rules (data is converted into a unified format), and regional coding rules (marking the data source region). Cross-regional data sharing involves exchanging user behavior data between different regions. The dynamic user profile is a set of features that updates as user electricity consumption behavior changes. Through this step, a dynamic user profile that dynamically reflects user electricity consumption characteristics is ultimately established.

[0080] In this embodiment, a preset consensus rule is first set, then target nodes that meet the conditions are selected, their user behavior data is converted into a unified format and a regional label is added, and then transmitted through the target nodes to a relay node to form cross-regional information. Features such as the proportion of electricity consumption during certain periods are then extracted and user feature sets are generated by grouping users. Finally, a dynamic profile is built based on the feature set and updated when user behavior changes. For example, user B's electricity consumption time in region A, "7 ​​PM", is converted to "7 PM" and labeled "A". After aggregation, features such as a 70% electricity consumption ratio between 7 PM and 11 PM are extracted to build a profile, which is updated synchronously when electricity consumption periods change.

[0081] S15. By processing and analyzing the behavioral feature vector, device operation feature value, and information in the user dynamic profile through a graph neural network based on the attention mechanism, the spatiotemporal patterns of user behavior are obtained.

[0082] Among them, graph neural networks based on attention mechanisms are network models that can focus on information that has a significant impact on the outcome and analyze the correlations between information. Spatiotemporal behavioral patterns refer to the regular patterns of user electricity consumption behavior in time (e.g., different time periods) and space (e.g., different regions). Through this step, the spatiotemporal patterns of user electricity consumption behavior are finally obtained.

[0083] In this embodiment, behavioral feature vectors, device operating feature values, and user dynamic profile information are first input into the network model. The model then focuses on key information (such as peak electricity consumption periods and electricity consumption types), while analyzing the temporal correlation (such as whether weekly electricity consumption patterns are consistent) and spatial correlation (such as whether peak electricity consumption in the same area is synchronized). Finally, the spatiotemporal pattern of user electricity consumption is obtained. For example, by inputting household electricity consumption feature vectors (0, 0.7, 3), device feature values ​​(2, 3), and dynamic profiles (peak hours 19:00-22:00) into the model, analysis reveals that user electricity consumption is stable during this period from Monday to Friday and is synchronized with users in the same area, forming this pattern.

[0084] S16. Based on the spatiotemporal patterns of behavior, predict the electricity sales volume under changes in users' electricity consumption habits.

[0085] Changes in electricity consumption habits refer to alterations in users' electricity usage time and volume (such as seasonal changes leading to earlier electricity consumption periods). Electricity sales forecasting estimates total electricity consumption over a future period. Through this step, the final electricity sales forecast result is obtained under the influence of changes in users' electricity consumption habits.

[0086] In this embodiment, the factors leading to changes in electricity consumption habits (such as seasonal changes and holidays) are first analyzed based on the spatiotemporal patterns of behavior. Then, the electricity consumption under the new habits is predicted by combining the patterns and changing factors (such as increased electricity consumption during peak winter hours). Finally, the total electricity sales are obtained by combining the predictions of all users. For example, it is known that the peak electricity consumption for households in area A is from 18:00 to 23:00 in winter, which is 40% higher than in other months. It is predicted that the electricity consumption of households in this area will increase during this period in December, and the total electricity sales for December are obtained by summarizing these predictions.

[0087] This application provides the following specific example: In the power management system of area A, the smart terminal is a smart meter of brand A. Electricity consumption data for users B, C, and D are collected from the blockchain: User B's electricity consumption time is from 19:00 to 23:00 daily, with an hourly consumption of 2 kWh at 20:00, and a voltage fluctuation range of 218V-222V; User C's electricity consumption time is similar to B's, with 65% of electricity consumption at night and an average daily consumption level of 3; User D's electricity consumption during the day is 85%, with an average daily consumption level of 6, and voltage fluctuation data of 221V at 8:00, 224V at 9:00, 220V at 10:00, and 218V at 11:00. First, the electricity consumption behavior data of B, C, and D are processed using the K-means clustering algorithm. The average nighttime electricity consumption ratio for B and C is calculated to be (70%+65%) / 2=67.5%, classifying them as household electricity consumption and generating a feature vector (0,0.68,3); D is classified as commercial electricity consumption, generating (1,0.85,6). A cosine transform is applied to the voltage data of D, and the difference between the maximum value of 224V and the minimum value of 218V is calculated to be 6V, with a fluctuation period of 3 hours, yielding the device operating characteristic value (6,3). According to a preset consensus rule, regions A and B share data. User B's electricity usage time "20:00" is converted to a unified format and labeled "A". After aggregation, the electricity consumption percentage of 20:00-22:00 (60%) is extracted to establish a dynamic profile. The household electricity consumption feature vector, device feature value, and dynamic profile are input into a graph neural network based on an attention mechanism. Analysis reveals the pattern that "household users in region A have peak electricity consumption from 19:00-22:00 on weekdays, and B consumes 3-4 kWh during this period." Combining this with the summer peak electricity consumption pattern (electricity consumption is 40% higher in June-August than in other months), B's electricity consumption in May was 100 kWh, predicting it to be 100 + 100 × 40% = 140 kWh in June. The electricity sales of region A in June are obtained by aggregating the predictions from all users.

[0088] By executing steps S11-S16, this embodiment of the application ensures the authenticity and integrity of data by collecting data from the blockchain, providing a reliable foundation for subsequent analysis; it achieves accurate classification of electricity consumption types and effective extraction of equipment status by utilizing clustering algorithms and feature processing, simplifying the data format; it breaks down regional barriers through cross-regional data sharing and dynamic profiling, reflecting changes in user behavior in a timely manner; it accurately captures the spatiotemporal patterns of user electricity consumption using an attention-based network model, highlighting the impact of key information; and finally, it combines these patterns to predict electricity sales, effectively adapting to changes in user electricity consumption habits, providing accurate references for power dispatch and resource allocation, and overall improving the reliability and adaptability of electricity sales forecasting.

[0089] In one possible embodiment, S14, cross-regional data sharing of user behavior data is achieved through preset consensus rules, and a corresponding dynamic user profile is established based on the shared user behavior data, including:

[0090] Step 141: Set preset consensus rules, which include node admission rules, information conversion rules, and regional coding rules.

[0091] Among them, the pre-defined consensus rules are a series of specifications for cross-regional data sharing. The node admission rules are used to determine which smart terminals can participate in sharing, the information conversion rules are used to unify user behavior data in different formats, and the regional coding rules are used to mark the source region of the data. Through this step, a complete set of cross-regional data sharing specifications is finally formed.

[0092] In this embodiment, firstly, based on the requirements for cross-regional data sharing, the content to be standardized is clarified, including the conditions for participating smart terminals, the unified data format, and the regional labeling method; secondly, node access rules (such as smart terminals needing to be verified through blockchain), information conversion rules (such as time being standardized as "hour:minute"), and regional coding rules (such as region A being labeled "A") are formulated separately; finally, these rules are integrated to form a preset consensus rule. For example, the rules for sharing electricity data between regions A and B are as follows: nodes need to be verified through blockchain, the time format is "HH:MM", region A data is labeled "A", and region B data is labeled "B".

[0093] Step 142: Based on the node admission rules, select target nodes from all smart terminals to participate in cross-regional data sharing. The target nodes are smart terminals that have been verified by the blockchain.

[0094] Among them, the node admission rule is part of the preset consensus rule, which is used to screen smart terminals that meet the conditions; the target node is a smart terminal that participates in cross-regional data sharing after being screened by the rule, and has been verified by the blockchain to ensure data reliability. This step is used to finally determine the smart terminals that participate in sharing.

[0095] In this embodiment, the specific requirements of the node admission rules are first clarified (e.g., smart terminals must be registered on the blockchain and have complete data records); secondly, all smart terminal information is compared with the rules to check whether the conditions are met; finally, smart terminals that meet the requirements are selected as target nodes. For example, if 100 smart terminals in area A are checked, and 80 are verified by the blockchain and have complete data, they are determined to be target nodes.

[0096] Step 143: Based on the information conversion rules, convert the user behavior data associated with the target node in the blockchain into standardized signals.

[0097] Among them, the information conversion rule is part of the preset consensus rule, which is used to unify the user behavior data format of different smart terminals; the standardized signal is user behavior data with a unified format after being converted by the rule, which facilitates cross-regional interaction. Through this step, user behavior data with a unified format is finally obtained.

[0098] In this embodiment, a unified format for information conversion rules is first determined (e.g., electricity consumption unit is "degrees" and time is "HH:MM"); secondly, user behavior data associated with the target node in the blockchain is extracted and the original format is checked; finally, the original data is converted into a unified format according to the rules to form a standardized signal. For example, the target node records "8 pm, 2 kWh", which is converted into "20:00, 2 degrees".

[0099] Step 144: Based on the region coding rules, add region source markers to the standardized signal.

[0100] Among them, the regional coding rule is part of the preset consensus rule, which is used to clarify the marking method of the data source region; the regional source mark is an identifier added according to the rule, which is used to trace the source of the data. Through this step, a standardized signal with source identifier is finally obtained.

[0101] In this embodiment, the marking method of the regional coding rule is first clarified (e.g., region A is marked with "A" and region B is marked with "B"); then the region where the target node corresponding to each standardized signal is located is checked; finally, the corresponding regional source mark is added according to the rule. For example, the standardized signal "20:00, 2 degrees" of the target node in region A is changed to "20:00, 2 degrees A" by adding "A".

[0102] Step 145: Using the target node, the standardized signal with the added regional source mark is transmitted to the relay node. The relay node restores the standardized signal with the added regional source mark into user behavior data and summarizes it to form cross-regional summary information.

[0103] Among them, the target node is the smart terminal participating in cross-regional sharing; the relay node is the intermediate node that receives and processes cross-regional data; the cross-regional summary information is a comprehensive data set formed by the relay node after restoring and summarizing the standardized signals with regional labels. Through this step, the final set of integrated cross-regional user behavior data is obtained.

[0104] In this embodiment, the target node first transmits a standardized signal with area markings to the relay node; secondly, the relay node, following the reverse process of the information conversion rules, restores the standardized signal to user behavior data in its original format; finally, all the restored data is aggregated to form cross-regional summary information. For example, if region A transmits "20:00, 2 degrees A" and region B transmits "19:00, 3 degrees B", the relay node restores this to "User B used 2 degrees of electricity in region A at 20:00" and "User C used 3 degrees of electricity in region B at 19:00" and aggregates them.

[0105] Step 146: Extract the electricity consumption period ratio, equipment start-up interval and electricity peak change signal from the cross-regional aggregated information, and group and integrate them according to the user identity corresponding to the target node to generate the corresponding user feature set.

[0106] Among them, the cross-regional summary information is cross-regional user behavior data summarized by the transit node; the electricity consumption period ratio is the proportion of electricity consumption time in a certain period to the total time; the equipment start interval is the time difference between two starts of electrical equipment; the electricity consumption peak change signal is information reflecting the change of electricity consumption peak; the user feature set is a data set that integrates the above features according to the user. Through this step, the feature set classified by user is finally obtained.

[0107] In this embodiment, data such as user electricity consumption periods, equipment startup times, and peak electricity consumption are first extracted from cross-regional aggregated information. Secondly, the percentage of electricity consumption periods (duration of a certain period ÷ total duration) and the equipment startup interval (average difference between two startup times) are calculated, and changes in peak electricity consumption (such as differences between weekends and weekdays) are recorded. Finally, these features are integrated according to user identity to generate a user feature set. For example, user B consumes electricity for a total of 10 hours, with 6 hours from 19:00 to 23:00, resulting in a percentage of 6 ÷ 10 = 60%. The average startup interval is 2 hours, and the peak electricity consumption is higher on weekends; these are integrated into their feature set.

[0108] Step 147: Based on the user feature set, establish the corresponding dynamic user profile.

[0109] Among them, the user feature set is a data set containing the user's electricity consumption characteristics; the user dynamic profile is a profile built on this set that can be updated as user behavior changes, used to reflect electricity consumption patterns, and through this step, a dynamically updatable user profile is finally obtained.

[0110] In this embodiment, core features (such as peak time ranges, startup interval patterns, and peak change trends) are first extracted from the user feature set. Secondly, these core features are associated with the user's identity to form an initial profile. Finally, when the user feature set changes (such as a change in peak time range), the profile is updated to reflect the latest behavior. For example, user B's initial profile includes "peak time 19:00-23:00, 2-hour interval." If the peak time changes to "18:00-22:00," the profile is updated.

[0111] This application provides the following specific example: In a power data sharing system for regions A and B, a preset consensus rule is first established: nodes must be verified by the blockchain, the time format is "HH:MM", the electricity consumption unit is "degrees", and region A is marked "A" and region B is marked "B". Fifty smart terminals in region A are selected, and 45 of them are verified by the blockchain to become target nodes; 60 smart terminals in region B are selected, and 50 of them become target nodes. The target node in region A records user B's electricity consumption data: "3 PM, 3 kWh", which is converted to "3 PM, 3 degrees" according to the information conversion rule, and the region mark "A" is added, resulting in "3 PM, 3 degrees A"; the target node in region B records user D's electricity consumption data: "8 PM, 5 kWh", which is converted to "8 PM, 5 degrees", and the mark "B" is added, resulting in "8 PM, 5 degrees B". The target node transmits the above signals to the relay node, which reconstructs them as "User B consumed 3 kWh of electricity in area A at 15:00" and "User D consumed 5 kWh of electricity in area B at 20:00," summarizing them to form cross-area summary information. From the summary information, user B's electricity consumption data is extracted: total electricity consumption duration is 10 hours, with 4 hours of consumption from 15:00 to 18:00, calculating the electricity consumption period percentage as 4 ÷ 10 = 40%; device startup times are 15:00 and 17:00, with an interval of 2 hours, averaging 2 hours; peak electricity consumption is 3 kWh on weekdays and 4 kWh on weekends, with the change signal being "higher on weekends," all integrated into user B's feature set. Based on this feature set, an initial profile is constructed for user B, including "peak from 15:00 to 18:00, startup interval of 2 hours, and higher peak on weekends"; one month later, user B's feature set shows the peak changing to "14:00 to 17:00," the startup interval changing to 3 hours, and the profile is updated accordingly.

[0112] By executing steps 141 to 147, this embodiment of the application provides a unified standard for cross-regional data sharing by formulating preset consensus rules, ensuring that participating nodes are qualified, data formats are consistent, and sources are traceable; screening target nodes ensures data reliability, and standardized conversion and regional labeling eliminate format differences and source ambiguity issues in cross-regional data; the aggregation and integration of transit nodes realizes centralized processing of scattered data, providing a complete foundation for extracting user characteristics; generating feature sets according to user integrated characteristics enables the subsequently constructed dynamic user profiles to accurately reflect electricity consumption habits, and the profiles can be updated in a timely manner with changes in user behavior, providing an intuitive and dynamic reference for analyzing user electricity consumption patterns, and overall improving the effectiveness of cross-regional data sharing and the accuracy of user profiles.

[0113] In one possible embodiment, step 147, establishing a corresponding dynamic user profile based on the user feature set, includes:

[0114] a1. Extract the peak electricity consumption intervals corresponding to the proportion of electricity consumption periods, the linkage modes corresponding to the equipment start-up intervals, and the electricity fluctuation cycles corresponding to the peak electricity consumption change signals from the user feature set.

[0115] The user feature set is a collection of data including the proportion of user electricity consumption periods, equipment start-up intervals, and peak electricity consumption change signals. The proportion of electricity consumption periods is the ratio of the duration of electricity consumption in a certain period to the total duration of electricity consumption. The corresponding peak electricity consumption interval is the time period in which this proportion is highest. The equipment start-up interval is the time difference between two starts of electrical equipment. The corresponding linkage mode is the pattern of this time difference (such as a fixed interval). The peak electricity consumption change signal is information reflecting the change of peak electricity consumption. The corresponding electricity consumption fluctuation cycle is the time interval at which the peak change recurs (such as daily). Through this step, the peak electricity consumption interval, linkage mode, and electricity consumption fluctuation cycle are finally extracted.

[0116] In this embodiment, the process begins by selecting the time period with the highest proportion of electricity consumption from the user feature set and defining this period as the peak electricity consumption interval. For example, if the proportion of electricity consumption from 19:00 to 22:00 in the user feature set is 55%, which is higher than other time periods, this period is the peak electricity consumption interval. Next, data on device start-up intervals are collected, the average of multiple intervals is calculated, and patterns are observed to form a linkage mode. For example, if the device start-up intervals are 2 hours, 2 hours, and 3 hours, the average value is calculated to be (2+2+3)÷3≈2.3 hours, showing a fixed interval of approximately 2 hours, thus forming a linkage mode. Finally, based on the electricity peak value change signal, the timing pattern of the peak value is observed to determine the electricity fluctuation cycle. For example, if the electricity peak value occurs around 20:00 every day, the fluctuation cycle is 1 day.

[0117] a2. Associate and integrate peak electricity consumption intervals, linkage modes, and electricity fluctuation cycles according to the corresponding user identities to form an initial tag set.

[0118] Among them, the peak electricity consumption period is the time period when users consume the most electricity, the linkage mode is the pattern of equipment start-up interval, the electricity fluctuation cycle is the time interval between repeated peak electricity consumption, the user identity is the identifier that distinguishes different users (such as user number), and the initial tag set is a set formed by associating and integrating these three features of the same user, which contains the core electricity consumption characteristics of the user. The initial tag set is finally formed through this step.

[0119] In this embodiment, the user identity corresponding to each feature is first clarified to ensure that the peak electricity consumption period, linkage mode, and electricity fluctuation cycle can all be associated with specific users. For example, the peak period of 18:00-21:00 is determined to belong to user B. Secondly, the three features of the same user are integrated together to form the user's initial label. For example, the initial label of user B is 18:00-21:00, with a fixed interval of about 3 hours and a cycle of 1 day. Finally, the initial labels of all users are summarized to form an initial label set containing multiple user labels. For example, the initial labels of user B and user C are integrated together to form an initial label set.

[0120] a3. Calculate the changes in the percentage of electricity consumption periods, equipment start-up interval, and peak electricity consumption change signal in the user feature set within two adjacent cycles. If any change exceeds the corresponding preset threshold range, update the initial label set to obtain the target label set.

[0121] Among them, the proportion of electricity consumption periods, equipment start-up interval, and electricity peak change signal in the user feature set are key data reflecting user electricity consumption behavior. Two adjacent periods are two consecutive electricity consumption fluctuation periods (such as two consecutive days). The change is the difference of the same feature in these two periods (such as the difference in the start time of the peak interval). The preset threshold range is a pre-set standard for judging whether the feature has changed significantly (such as ±1 hour). The target label set is the set obtained after updating the initial label set when the change of any feature exceeds the corresponding threshold. The target label set is finally obtained through this step.

[0122] In this embodiment, two adjacent periods (e.g., day 1 and day 2) are first determined, and the percentage of electricity consumption time periods, equipment start-up intervals, and peak electricity consumption change signals within these two periods are extracted from the user feature set. Next, the change in each feature is calculated. For example, the peak electricity consumption period on day 1 is 18:00-21:00, and on day 2 it is 17:00-20:00. The change is calculated as the start time 18:00 minus 17:00 equals 1 hour, and the end time 21:00 minus 20:00 equals 1 hour. Then, the change is compared with a preset threshold range (e.g., ±0.5 hours). If any change exceeds the threshold (e.g., the start time difference of 1 hour exceeds 0.5 hours), the corresponding feature in the initial label set is updated. Finally, the updated labels are integrated to obtain the target label set.

[0123] a4. Based on the target tag set, construct a dynamic user profile.

[0124] The target tag set is a collection containing the user's latest electricity consumption characteristics (peak electricity consumption period, linkage mode, and electricity fluctuation cycle). The user dynamic profile is a profile built based on the target tag set that can change as the target tag set is updated. It is used to intuitively reflect the user's real-time electricity consumption patterns. The user dynamic profile is finally constructed through this step.

[0125] In this embodiment, the core features of the user's peak electricity consumption period, linkage mode, and electricity fluctuation cycle are first extracted from the target tag set. For example, the peak electricity consumption period of 17:00-20:00 is extracted from the target tag set of user B, with a fixed interval of about 3 hours and a cycle of 1 day. Secondly, these features are presented in a structured form and associated with the user's identity to form preliminary profile content. For example, user B's peak electricity consumption period is 17:00-20:00, electrical equipment is started about once every 3 hours, and the electricity consumption pattern repeats every day. Finally, when the target tag set is updated (such as the peak electricity consumption period changing to 16:00-19:00), the corresponding content in the profile is updated synchronously to ensure that the profile is consistent with the user's latest electricity consumption behavior.

[0126] This application provides the following specific example: Data is extracted from the feature set of User B. The electricity consumption periods are as follows: 08:00-11:00 accounts for 15%, 18:00-21:00 accounts for 60%, and other periods account for 25%. The 18:00-21:00 period has the highest proportion and is identified as the peak electricity consumption period. The equipment start-up intervals are 3 hours, 3 hours, and 4 hours, and the calculated average is (3+3+4)÷3≈3.3 hours, showing a fixed interval of about 3 hours, forming a linkage pattern. The peak electricity consumption occurs at 19:30 every day, and the electricity consumption fluctuation cycle is determined to be 1 day. These features are associated with User B's identity to form the initial label "User B: 18:00-21:00, fixed interval of about 3 hours, 1-day cycle". Comparing the characteristics of Day 1 and Day 2, User B's peak electricity consumption period on Day 2 was 17:00-20:00. The change was calculated as follows: the start time difference was 18:00-17:00 = 1 hour, and the end time difference was 21:00-20:00 = 1 hour. The preset threshold range was ±0.5 hours, and the change exceeded the threshold. However, the changes in device startup intervals and peak electricity consumption signals did not exceed the threshold. Therefore, the peak period was updated to 17:00-20:00, resulting in the target tag set. Based on this target tag set, a dynamic profile of User B was constructed: "User B: Electricity consumption is most concentrated between 17:00-20:00 daily; electrical devices start approximately every 3 hours; the electricity consumption pattern repeats daily." When the target tag set is subsequently updated to "16:00-19:00, approximately a fixed 2-hour interval, 1-day cycle," the profile is updated accordingly.

[0127] By executing steps a1 to a4, this embodiment of the application extracts peak electricity consumption intervals, linkage patterns, and electricity fluctuation cycles from the user feature set, transforming abstract data into specific electricity consumption pattern features; it forms an initial tag set by associating user identities, achieving precise binding between features and users; by monitoring feature changes and updating them to the target tag set, it ensures that features can dynamically reflect changes in user behavior; finally, the dynamic user profile constructed based on the target tag set not only intuitively presents the user's regular electricity consumption habits but also updates in a timely manner with changes in user behavior, providing a clear, accurate, and real-time reference for analyzing user electricity consumption patterns and predicting electricity consumption trends.

[0128] In one possible embodiment, such as Figure 3 As shown in S15, by processing and analyzing the behavioral feature vector, device operation feature values, and information in the user dynamic profile using a graph neural network based on an attention mechanism, the spatiotemporal patterns of user behavior are obtained, including:

[0129] Step 151: Convert the behavioral feature vector, device operation feature value, and information from the user dynamic profile into corresponding network input features.

[0130] Among them, behavioral feature vectors are vector-based data containing user behavior-related features, such as electricity usage duration and device startup frequency; device operation feature values ​​are data reflecting the device's operating status, such as operational stability and energy consumption; user dynamic profiles are user electricity usage patterns that can be updated in real time; and network input features are standardized data that has been processed and is suitable for model input. Through this step, the above three types of information are finally converted into network input features that the model can accept.

[0131] In this embodiment, the original formats of the behavioral feature vector, device operation feature values, and user dynamic profile information are first determined. For example, the behavioral feature vector is numerical data, the device operation feature values ​​include classification information such as "stable" and "fluctuating," and the user dynamic profile includes descriptions such as "peak electricity consumption from 17:00 to 20:00." Secondly, the information in different formats is processed. Numerical data is converted through standardization (scaling the value to the range of 0-1; for example, if a value is 4 and the maximum value is 6, after standardization it becomes 4÷6≈0.67). Classification information is converted through encoding... Code conversion (e.g., "stable" is converted to 0, "fluctuation" is converted to 1) and text information is converted by extracting keywords and mapping them to numerical values ​​(e.g., "17:00-20:00" is converted to [17,20]). Finally, all processed data are integrated into network input features in a unified format. For example, the behavior feature vector of user B [4,3,6] is standardized to [0.67,0.5,1], the device operation feature value "stable" is converted to 0, and the dynamic profile information is converted to [17,20], which is integrated into [0.67,0.5,1,0,17,20].

[0132] Step 152: Construct a correlation graph based on the correlation between the input features of each network, and assign corresponding attention weights to the features of highly correlated nodes in the correlation graph through an attention mechanism.

[0133] Among them, network input features are standardized data that the model can accept; correlation is the degree of correlation between different features, such as the correlation between peak electricity consumption time and equipment start-up interval; correlation graph is a graphical structure that uses nodes to represent features and edges to represent the correlation between features; attention mechanism is a technique that can highlight important features; attention weight is a numerical value that represents the importance of a feature. The higher the value, the more important the feature. Through this step, a correlation graph with attention weight is finally constructed.

[0134] In this embodiment, the correlation degree between each network input feature is first calculated. For example, the correlation degree is determined by calculating the correlation coefficient between two features (e.g., the correlation coefficient between peak electricity consumption start time and device startup interval is 0.7). Secondly, a correlation graph is constructed based on the correlation degree, with each network input feature as a node, and the correlation degree is represented by the value of the edge between nodes (e.g., the edge between nodes with a correlation degree of 0.7 is marked as 0.7). For example, the correlation degree between the edge between the nodes "peak electricity consumption start time" and "device startup interval" is 0.7. Then, the attention weight of each node is calculated through an attention mechanism. This mechanism allocates weights according to the influence of the feature on the result (nodes with higher correlation degrees usually have larger weights). For example, nodes with a correlation degree of 0.7 are assigned weights of 0.6 and 0.5 respectively, and nodes with a correlation degree of 0.3 are assigned weights of 0.2 and 0.2 respectively. Finally, the attention weights are assigned to the corresponding nodes in the correlation graph to form a weighted correlation graph.

[0135] Step 153: Use a graph neural network to process the features of the relevance nodes assigned with attention weights to output the temporal distribution features and spatial relevance features of user behavior.

[0136] Among them, graph neural networks are a model that can process graph-structured data; attention weights are numerical values ​​that represent the importance of features; correlation node features are node data with correlation degree and weight in the correlation graph; temporal distribution features are the patterns of user behavior changes over time, such as the frequency of electricity consumption in different time periods; spatial correlation features are the correlation patterns of devices in different spatial locations, such as the linkage of devices in different rooms. Through this step, the temporal distribution features and spatial correlation features of user behavior are finally output.

[0137] In this embodiment, the features of related nodes with attention weights are first input into a graph neural network. The network processes the data through message passing between nodes (each node passes its own information to related nodes and updates it). For example, the weighted "peak electricity consumption time" node will pass information to the related "device start-up interval" node. Secondly, during the processing, the network extracts time-related features (such as changes in electricity consumption frequency at different times) to form time distribution features. For example, analyzing node information reveals that users have low electricity consumption frequency from 16:00 to 17:00 and high electricity consumption frequency from 17:00 to 19:00. At the same time, it extracts space-related features (such as the correlation of start-up time of different devices) to form spatial correlation features. For example, it reveals the pattern that kitchen devices and bedroom devices start up at around 18:00. Finally, these two types of features are output.

[0138] Step 154: Integrate temporal distribution features and spatial correlation features to obtain the spatiotemporal patterns of user behavior.

[0139] Among them, the temporal distribution feature is the pattern of user behavior changes over time; the spatial correlation feature is the correlation pattern of devices in different spatial locations; the spatiotemporal pattern of user behavior is the comprehensive behavioral pattern of users in a specific time and space obtained by combining the temporal and spatial features. This comprehensive pattern is finally obtained through this step.

[0140] In this embodiment, the core content of time distribution characteristics and spatial correlation characteristics is first clarified. For example, the time characteristic is "low power consumption frequency from 16:00 to 17:00 and high power consumption frequency from 17:00 to 19:00", and the spatial characteristic is "only kitchen equipment is started from 16:00 to 17:00 and kitchen and bedroom equipment are started simultaneously from 17:00 to 19:00". Secondly, the two characteristics are matched and integrated according to time nodes. For example, from 16:00 to 17:00, the time characteristic is low frequency and the spatial characteristic is that the kitchen equipment is started alone; from 17:00 to 19:00, the time characteristic is high frequency and the spatial characteristic is that the kitchen and bedroom equipment are linked. Finally, the integrated content is sorted into the spatiotemporal pattern of user behavior. For example, the user only uses the kitchen equipment from 16:00 to 17:00 (low power consumption frequency) and uses both the kitchen and bedroom equipment from 17:00 to 19:00 (high power consumption frequency).

[0141] This application provides the following specific example: User B's behavioral feature vector is [5,2,7] (daily electricity consumption frequency, average electricity consumption duration, number of device startups), which, through standardization (each value divided by the maximum value 7), yields [5÷7≈0.71,2÷7≈0.29,7÷7=1]; the device operation feature value is "stable," encoded as 0; the user dynamic profile information is "16:00-19:00 peak electricity consumption, approximately 2-hour device startup interval," from which the extracted values ​​are [16,19,2], integrated into the network input features [0.71,0.29,1,0,16,19,2]. The correlation coefficient of each feature in this feature set is calculated: the correlation coefficient between the peak electricity consumption start time 16 and the device startup interval 2 is 0.8, the correlation coefficient between the peak electricity consumption end time 19 and the daily electricity consumption frequency 0.71 is 0.6, and the correlation coefficients between other features are low (below 0.3). After constructing the association graph, an attention mechanism was used to assign weights of 0.7 and 0.6 to nodes with an association degree of 0.8 (nodes 16 and 2), respectively; weights of 0.5 and 0.4 to nodes with an association degree of 0.6 (nodes 19 and 0.71), respectively; and weights of 0.2 to other nodes. The weighted association graph was then input into a graph neural network to extract temporal distribution features: low electricity usage frequency from 16:00 to 17:00 and high electricity usage frequency from 17:00 to 19:00; and spatial association features: only kitchen appliances are used from 16:00 to 17:00, and both kitchen and bedroom appliances are used from 17:00 to 19:00. Finally, the spatiotemporal patterns of user B's behavior were integrated: low electricity usage frequency when using kitchen appliances alone from 16:00 to 17:00, and high electricity usage frequency when using both kitchen and bedroom appliances simultaneously from 17:00 to 19:00.

[0142] By executing steps 151 to 154, this embodiment of the application ensures that the data can be effectively processed by the model by converting raw information in different formats into unified network input features; constructing an association graph and assigning attention weights highlights key features with high correlation and reduces interference from irrelevant information; using graph neural networks to extract temporal and spatial features transforms complex data into meaningful patterns; and finally integrating the resulting behavioral spatiotemporal patterns comprehensively reflects users' electricity consumption habits in time and space, providing a complete and reliable basis for understanding user behavior and predicting electricity consumption trends.

[0143] In one possible embodiment, step 152, constructing a correlation graph according to the correlation between the network input features, and assigning corresponding attention weights to the features of highly correlated nodes in the correlation graph through an attention mechanism, includes:

[0144] b1. Determine the co-occurrence frequency of each network input feature in user electricity consumption events and the degree of influence between changes in each network input feature. Based on the correlation between co-occurrence frequency and degree of influence, calculate the correlation degree between each network input feature.

[0145] Among them, network input features are data that has been standardized and is suitable for model input, such as peak electricity consumption time and equipment startup interval; user electricity consumption events are specific electricity consumption behaviors of users, such as a peak electricity consumption event or a device startup; co-occurrence frequency is the number of times two network input features appear simultaneously in the same electricity consumption event; influence degree is the magnitude of the impact of a change in one feature on another feature; correlation degree is a numerical value that reflects the degree of correlation between two features, calculated by combining co-occurrence frequency and influence degree. Through this step, the correlation degree between each network input feature is finally obtained.

[0146] In this embodiment, the co-occurrence frequency of each network input feature in user electricity consumption events is first counted. For example, in 10 electricity consumption events of user B, the peak electricity consumption time (17:00-20:00) and the device startup interval (3 hours) occur simultaneously 8 times, and the co-occurrence frequency is 8. Secondly, the degree of influence between changes in each feature is analyzed. For example, when the peak electricity consumption time is advanced by 1 hour, the average device startup interval is shortened by 0.5 hours, indicating that the influence between the two is relatively high. Finally, the correlation degree is calculated by combining the co-occurrence frequency and the degree of influence. The more co-occurrence frequency and the greater the degree of influence, the higher the correlation degree value. For example, when there are 8 co-occurrences and the degree of influence is relatively high, the calculated correlation degree is 0.7.

[0147] b2. Using network input features as nodes and correlation as edge weights, construct a correlation graph based on nodes and edge weights. The magnitude of the edge weight in the correlation graph is proportional to the quantified value of the correlation of the corresponding node features.

[0148] In this context, network input features are standardized model input data; nodes are points in the association graph that represent network input features; correlation degree is a numerical value that reflects the degree of correlation between features; edge weight is the numerical value of the edge connecting two nodes in the association graph, and its magnitude is proportional to the correlation degree of the corresponding node features; the association graph is a graphical structure that uses nodes to represent features and weighted edges to represent the correlation degree between features, and the association graph is finally constructed through this step.

[0149] In this embodiment, each network input feature is first treated as a node in the association graph, such as peak electricity consumption time and device startup interval as independent nodes. Secondly, the correlation between each feature is used as the edge weight connecting the corresponding nodes. The higher the correlation, the larger the edge weight. For example, when the correlation is 0.7, the weight of the corresponding edge is 0.7. Finally, a complete association graph is constructed based on the nodes and edge weights, so that each node is connected to related nodes through weighted edges. For example, the node "peak electricity consumption time" is connected to the node "device startup interval" through an edge with a weight of 0.7.

[0150] b3. Calculate the sum of the edge weights connected to each node feature in the correlation graph, and mark the node features whose sum is greater than the preset sum threshold as high correlation node features.

[0151] The association graph is a graphical structure composed of nodes and weighted edges. Node features are the network input features represented by the nodes in the association graph. Edge weights are the numerical values ​​of the edges connecting the nodes. The sum is the sum of the weights of all edges connected to each node feature. The preset sum threshold is a pre-set numerical standard used to determine whether a node is a high-association node. High-association node features refer to node features whose total edge weights are greater than the preset threshold. This step ultimately marks high-association node features.

[0152] In this embodiment, firstly, the weights of all edges connected to each node feature in the association graph are counted. For example, the edge weights connected to the node "peak electricity consumption time" are 0.7 and 0.6 respectively. Secondly, the sum of these edge weights is calculated, that is, 0.7 plus 0.6 equals 1.3. Finally, the sum is compared with a preset sum threshold. If the sum is greater than the threshold, the node is marked as a high-association node feature. For example, the preset threshold is 1.0, and the sum 1.3 is greater than the threshold, so "peak electricity consumption time" is marked as a high-association node feature.

[0153] b4. Based on the magnitude of the sum, assign corresponding attention weights to the features of highly correlated nodes through an attention mechanism.

[0154] Here, the sum is the sum of the edge weights connected to the highly correlated node features, and its value reflects the degree of correlation of the node features; the attention mechanism is a technique that can highlight important features; the attention weight is a value assigned to the highly correlated node features to represent their importance. The larger the sum, the higher the attention weight. Through this step, attention weights are finally assigned to the highly correlated node features.

[0155] In this embodiment, the sum of edge weights of the features of each highly correlated node is first obtained. For example, the sum of the node "peak electricity consumption time" is 1.3, and the sum of the node "daily electricity consumption frequency" is 1.1. Secondly, based on the magnitude of the sum, attention weights are assigned to these nodes through an attention mechanism. The larger the sum, the higher the weight assigned. For example, a node with a sum of 1.3 is assigned a weight of 0.6, and a node with a sum of 1.1 is assigned a weight of 0.5. Finally, the attention weights are associated with the corresponding features of the highly correlated nodes to complete the weight allocation.

[0156] This application provides the following specific example: User B's network input characteristics include peak electricity usage time (17:00-20:00), daily electricity usage frequency (5 times), and device startup interval (3 hours). First, the co-occurrence frequency of the characteristics in 10 electricity usage events was counted: peak electricity usage time and daily electricity usage frequency co-occurred 7 times, and peak electricity usage frequency and device startup interval co-occurred 8 times; daily electricity usage frequency and device startup interval co-occurred 6 times. The degree of impact was analyzed: a 1-hour extension of peak electricity usage time resulted in an average increase of 1 in daily electricity usage frequency and an average decrease of 0.5 hours in device startup interval, all indicating a high degree of impact. Combining the co-occurrence frequency and the degree of impact, the correlation was calculated: peak electricity usage time and daily electricity usage frequency had a correlation of 0.6, peak electricity usage frequency and device startup interval had a correlation of 0.7, and daily electricity usage frequency and device startup interval had a correlation of 0.5. Next, the three features are used as nodes, and their corresponding correlation degrees are used as edge weights to construct a correlation graph: the edge weight between peak electricity consumption time and daily electricity consumption frequency is 0.6, the edge weight between peak electricity consumption time and device startup interval is 0.7, and the edge weight between daily electricity consumption frequency and device startup interval is 0.5. Then, the sum of edge weights for each node is calculated: the sum of peak electricity consumption time is 0.6 + 0.7 = 1.3, the sum of daily electricity consumption frequency is 0.6 + 0.5 = 1.1, and the sum of device startup interval is 0.7 + 0.5 = 1.2. The preset sum threshold is 1.0. The sums of the three nodes are all greater than the threshold and are all marked as high-correlation node features. Finally, attention weights are assigned based on the sum size using an attention mechanism: peak electricity consumption time (sum 1.3) is assigned 0.6, device startup interval (sum 1.2) is assigned 0.55, and daily electricity consumption frequency (sum 1.1) is assigned 0.5.

[0157] By executing steps b1-b4, this embodiment calculates the correlation degree by comprehensively considering co-occurrence frequency and influence, achieving precise quantification of the correlation between features. It transforms features and correlation degrees into node and edge weights to construct a correlation graph, making abstract correlations more intuitive. High-correlation nodes are filtered using sums and thresholds, highlighting key features. Attention weights are assigned based on the sums to ensure important features receive priority attention. The overall process improves the efficiency of identifying and utilizing feature correlations, provides a clear focus for subsequent model processing, and enhances the relevance and effectiveness of data analysis.

[0158] In one possible embodiment, S12, based on user behavior data, the power consumption type of the smart terminal is identified using a K-means clustering algorithm, and a behavior feature vector is generated based on the power consumption type, including:

[0159] Step 121: Use the K-means clustering algorithm to perform cluster analysis on the user electricity consumption time period and electricity load fluctuation characteristics in the user behavior data to identify the electricity consumption type corresponding to the smart terminal.

[0160] Among them, K-means clustering algorithm is a method that can automatically classify data with similar characteristics into the same category. User behavior data is information that records users' electricity consumption. User electricity consumption period is the specific time interval of user electricity consumption. Electricity load fluctuation characteristics refer to the changes in electricity consumption over time (such as the magnitude of fluctuation and the frequency of fluctuation). Smart terminal is a device like a smart meter that can record electricity consumption data. Electricity consumption type is a category divided according to electricity consumption habits (such as household electricity, commercial electricity, etc.). Through this step, the electricity consumption type corresponding to each smart terminal is finally identified.

[0161] In this embodiment, the user's electricity consumption time period and load fluctuation characteristics are first extracted from user behavior data. For example, it is determined whether the user's main electricity consumption time period is in the morning, noon, or evening, and whether the electricity consumption is stable or fluctuates frequently during this period. Secondly, these extracted features are input into a K-means clustering algorithm. The algorithm divides the data into different groups based on the similarity of the features. For example, user data that mainly uses electricity at night and has small consumption fluctuations are grouped into one group, while user data that mainly uses electricity during the day and has large consumption fluctuations are grouped into another group. Finally, the corresponding electricity consumption type is determined based on the common features of each group of data. For example, the group with low evening electricity consumption corresponds to the household electricity consumption type, while the group with high daytime electricity consumption corresponds to the commercial electricity consumption type. For example, in area A, there are multiple users. Their electricity consumption time period (7 pm to 11 pm or 9 am to 5 pm) and load fluctuation (small or large fluctuations) are extracted. The K-means clustering algorithm then divides them into two groups with similar features, corresponding to household electricity consumption and commercial electricity consumption types, respectively.

[0162] Step 122: Generate behavioral feature vectors based on electricity consumption type, electricity frequency and equipment start-up and shutdown patterns in user behavior data.

[0163] Among them, the electricity consumption type is the category identified in step 121 (such as household electricity consumption, commercial electricity consumption), the electricity consumption frequency in user behavior data refers to the number of times electricity is used per unit time (such as how many times electricity is used per day), the equipment start-up and shutdown pattern refers to the time pattern of starting and stopping electrical equipment (such as how often it starts on average), and the behavioral feature vector is a combination of numbers to represent the electricity consumption characteristics. Each number corresponds to the electricity consumption type, electricity consumption frequency, equipment start-up and shutdown pattern, etc. Through this step, a behavioral feature vector that reflects the electricity consumption characteristics is finally generated.

[0164] In this embodiment, firstly, different electricity consumption types are assigned identification numbers, for example, 0 represents household electricity consumption and 1 represents commercial electricity consumption. Secondly, electricity consumption frequency is extracted from user behavior data, calculating the number of times a user consumes electricity per unit time, such as counting the total number of times a user consumes electricity in a day. Next, device start-up and shutdown patterns are extracted, and the average device start-up interval is calculated, for example, by adding the times of multiple start-up intervals and dividing by the number of intervals to obtain the average value. Finally, the three values—electricity consumption type identification, electricity consumption frequency, and average device start-up interval—are combined in sequence to form a behavioral feature vector. For example, if the household electricity consumption type identification is 0, a user consumes electricity 5 times a day, and the average device start-up interval is 3 hours, then the corresponding behavioral feature vector would be 0, 5, and 3.

[0165] This application provides the following specific example: Smart terminals in area A record the electricity consumption behavior data of users B, C, and D. First, the data is processed through step 121: User B's electricity consumption period is 19:00-23:00 with small load fluctuations; User C's electricity consumption period is 20:00-22:00 with small load fluctuations; and User D's electricity consumption period is 09:00-18:00 with large load fluctuations. After inputting these features into the K-means clustering algorithm, the algorithm classifies B and C as household electricity consumption (labeled 0) and D as commercial electricity consumption (labeled 1). Next, process through step 122: calculate the electricity usage frequency. User B uses electricity 4 times a day, user C uses electricity 5 times a day, and user D uses electricity 8 times a day; calculate the equipment start-up and shutdown patterns. The start-up intervals for user B are 3 hours, 3 hours, and 4 hours, with an average of (3+3+4)÷3≈3.3 hours; the start-up intervals for user C are 2 hours, 3 hours, and 2 hours, with an average of (2+3+2)÷3≈2.3 hours; the start-up intervals for user D are 1 hour, 1 hour, and 2 hours, with an average of (1+1+2)÷3≈1.3 hours; finally, generate the behavioral feature vectors: B is 0, 4, 3.3, C is 0, 5, 2.3, and D is 1, 8, 1.3.

[0166] By executing steps 121 to 122, this embodiment of the application uses the K-means clustering algorithm to analyze the user's electricity consumption period and load fluctuation characteristics, which can accurately classify different electricity consumption types and clearly categorize diverse electricity consumption data. Based on the behavioral feature vector generated by electricity consumption type, electricity consumption frequency, and equipment start-up and shutdown patterns, the abstract electricity consumption characteristics are transformed into a structured digital form, which facilitates subsequent processing and analysis and provides a reliable and intuitive foundation for in-depth exploration of user electricity consumption patterns.

[0167] In one possible embodiment, step 121 involves performing cluster analysis on the user's electricity consumption time periods and electricity load fluctuation characteristics in the user behavior data using the K-means clustering algorithm to identify the electricity consumption type corresponding to the smart terminal, including:

[0168] c1. Extract the percentage of electricity usage time of users within a preset time interval from user behavior data, and use the percentage of electricity usage time as the user's electricity usage time period feature.

[0169] Among them, user behavior data records information about users' electricity consumption, including the specific time and duration of electricity consumption; preset time intervals are several pre-defined time ranges, such as morning, noon, and evening; electricity consumption duration ratio is the ratio of the user's actual electricity consumption duration in each preset time interval to the total duration of that interval; user electricity consumption period characteristics are the characteristics of user electricity consumption in different time periods reflected by the electricity consumption duration ratio; through this step, the user's electricity consumption period characteristics are finally obtained.

[0170] In this embodiment, a preset time interval is first determined, such as dividing a day into 8:00 AM to 12:00 PM (total duration 4 hours), 12:00 PM to 6:00 PM, and 6:00 PM to 12:00 AM (total duration 6 hours). For example, this time division method is used when analyzing the electricity consumption of users in area A. Secondly, the actual electricity consumption duration of users within each preset time interval is extracted from user behavior data. For example, from user B's behavior data, it is found that their actual electricity consumption duration in the interval from 6:00 PM to 12:00 AM is 3 hours. For example, user B started consuming electricity from 1:00 PM to 12:00 AM on a certain night... Electricity usage starts at 9 AM and ends at 10 PM, totaling 3 hours. The percentage of electricity usage time is calculated by dividing the actual usage time for each interval by the total duration of that interval. For example, if user B uses electricity for 3 hours in the evening, and the total interval is 6 hours, then 3 divided by 6 equals 0.5. This 0.5 is user B's percentage of evening electricity usage. Similarly, the percentages for morning and noon are calculated. These percentages together constitute the user's electricity usage time characteristics. For example, if user B uses electricity for 1 hour in the morning, and the total interval is 4 hours, then 1 divided by 4 equals 0.25. This is the percentage of morning electricity usage.

[0171] c2. Extract the change in electricity load per unit time and the number of changes in electricity load from user behavior data, and use the change in electricity load and the number of changes as the characteristics of electricity load fluctuation.

[0172] Among them, user behavior data includes information on changes in electricity consumption during the electricity consumption process; unit time is a pre-set time interval for statistically analyzing changes in electricity consumption, such as 1 hour; electricity load change is the value of increase or decrease in electricity consumption within a unit time; the number of times electricity load changes is the number of times electricity consumption changes within a unit time; electricity load fluctuation characteristics are the user's electricity load fluctuations based on the combined changes in electricity load amount and number of changes; through this step, the user's electricity load fluctuation characteristics are finally obtained.

[0173] In this embodiment, the unit time is first determined, for example, set to 1 hour. For instance, when analyzing changes in user electricity load, a 1-hour statistical interval is used. Secondly, electricity consumption data for each unit time is extracted from user behavior data, and the change in electricity load is calculated. For example, from user B's behavior data, the electricity consumption is 3 kWh from 10:00 to 11:00 and 5 kWh from 11:00 to 12:00. Subtracting the electricity consumption of the previous unit time from the latter unit time, 5 kWh minus 3 kWh equals 2 kWh. This 2 kWh is the electricity load for that time period. The change in electricity load is calculated as follows: For example, if user B's electricity consumption changes from 2 kWh to 4 kWh between 2 PM and 3 PM, then 4 kWh minus 2 kWh equals 2 kWh. This is the change in electricity load per unit of time. Finally, the number of changes in electricity load per unit of time is counted. For example, if electricity consumption first increases from 2 kWh to 3 kWh and then from 3 kWh to 4 kWh within one hour, this is two changes, and the number of changes is 2. For example, if user B's electricity consumption first increases from 3 kWh to 4 kWh and then from 4 kWh to 5 kWh between 7 PM and 8 PM, this is two changes. The change in electricity load and the number of changes per unit of time are combined to form the characteristics of electricity load fluctuation.

[0174] c3. Integrate the characteristics of user electricity consumption time periods with the characteristics of electricity load fluctuations to form cluster analysis objects.

[0175] Among them, the user's electricity consumption period characteristics are the proportion of electricity consumption time obtained in step c1; the electricity load fluctuation characteristics are the amount and number of changes in electricity load obtained in step c2; the cluster analysis object is the comprehensive data formed by integrating the user's electricity consumption period characteristics and electricity load fluctuation characteristics, which is used for subsequent classification processing; the cluster analysis object is finally formed through this step.

[0176] In this embodiment, the user's electricity consumption time period characteristics obtained in step c1 are first collected. For example, the electricity consumption time period characteristics of user B are collected as 0.25 in the morning, 0.33 at noon, and 0.67 in the evening. For example, when organizing user B's data, these three percentage values ​​are extracted completely first. Secondly, the user's electricity load fluctuation characteristics obtained in step c2 are collected. For example, the electricity load fluctuation characteristics of user B are a change of 2 degrees and 2 times between 7 pm and 8 pm, and a change of -1 degree and 1 time between 8 pm and 9 pm. These data are then... Converted to numerical form, this is 2, 2, -1, 1. For example, the changes and frequency of changes in different time periods are organized into a set of numbers in chronological order. Finally, the collected user electricity consumption time period characteristics and electricity load fluctuation characteristics are combined in sequence to form comprehensive data containing all characteristics. This data is the cluster analysis object. For example, the time period characteristics of user B (0.25, 0.33, 0.67) are combined with the fluctuation characteristics (2, 2, -1, 1) to form the cluster analysis object 0.25, 0.33, 0.67, 2, 2, -1, 1.

[0177] c4. The K-means clustering algorithm is used to classify the clustering analysis objects to obtain multiple feature categories.

[0178] Among them, the K-means clustering algorithm is a method that can automatically group data with similar characteristics into the same category; the clustering analysis object is the comprehensive data obtained in step c3, which includes user electricity consumption time and load fluctuation characteristics; the feature category is a group formed by grouping similar clustering analysis objects together through the K-means clustering algorithm, and the data in each group have similar electricity consumption characteristics; through this step, multiple feature categories are finally obtained.

[0179] In this embodiment, the cluster analysis objects of all users formed in step c3 are first input into the K-means clustering algorithm. For example, all cluster analysis objects of users B, C, D, E, and F in region A are input into the algorithm. For example, when processing user data in region A, comprehensive data of all users is collected and input uniformly. Secondly, the algorithm groups the cluster analysis objects according to the similarity of their features. For example, in the cluster analysis objects of users B, C, and D, the proportion of electricity consumption time at night is relatively high and the fluctuation of electricity load is relatively small, so the algorithm will group these three objects into one group. In the cluster analysis objects of users E and F, the proportion of electricity consumption time during the day is relatively high and the fluctuation of electricity load is relatively large, so the algorithm will group these two objects into another group. For example, the algorithm identifies similar features and groups them by comparing the time period proportion and fluctuation data of each object. Finally, multiple different feature categories are obtained, each category representing a group of users with similar electricity consumption characteristics. For example, after processing by the algorithm, the user data in region A is divided into two feature categories, one category containing 3 users and the other category containing 2 users.

[0180] c5. Based on multiple feature categories, determine the power consumption type corresponding to the smart terminal.

[0181] Among them, the feature category is the user data group with similar electricity consumption characteristics obtained in step c4; the smart terminal is a device used to record user electricity consumption data, such as a smart meter; the electricity consumption type is a category divided according to the common electricity consumption characteristics of the feature categories, such as household electricity consumption, commercial electricity consumption, etc.; through this step, the electricity consumption type corresponding to each smart terminal is finally determined.

[0182] In this embodiment, the common electricity consumption characteristics of each feature category are first analyzed. For example, analyzing the first feature category in region A (including users B, C, and D), it is found that the cluster analysis objects of all users in this category show "high proportion of electricity consumption at night and small fluctuations in electricity load". This is the common characteristic of this category. For example, by comparing the feature data of all users in the category, consistent electricity consumption characteristics are extracted. Secondly, the electricity consumption type corresponding to the feature category is determined based on the common characteristics. For example, "high proportion of electricity consumption at night and small fluctuations in electricity load" is consistent with the electricity consumption habits of household users. Therefore, the electricity consumption type corresponding to this feature category is determined to be household electricity consumption. For example, the feature and electricity consumption type are matched by combining common electricity consumption scenarios. Finally, the electricity consumption type corresponding to the smart terminal used by the users in this feature category is determined. For example, the smart terminals used by users B, C, and D in the first feature category are all determined to be household electricity consumption type. For example, the electricity consumption type corresponding to the category is synchronized to the smart terminal identifier of all users in this category.

[0183] This application provides the following specific example: In area A, the electricity consumption behavior data of users B, C, D, E, and F are analyzed: First, through step c1, the preset time intervals are 8:00 AM to 12:00 PM, 12:00 PM to 6:00 PM (6 hours), and 6:00 PM to 12:00 AM (6 hours), and the proportion of electricity consumption time for each user is calculated: User B consumes electricity for 1 hour in the morning, 2 hours at noon (2 ÷ 6 ≈ 0.33), and 4 hours in the evening. Users C, D, E, and F obtain their respective time period characteristics in the same way; Then, through step c2, the load fluctuation characteristics are extracted in 1-hour units: User B consumes electricity at 7:00 PM... The electricity consumption changed from 3 kWh to 5 kWh at 8 PM, and from 8 PM to 9 PM it changed from 5 kWh to 4 kWh. Other users showed similar fluctuation characteristics. Then, in step c3, the time period characteristics and fluctuation characteristics of each user were integrated into cluster analysis objects. For example, the objects for user B were 0.25, 0.33, 0.67, 2, 2, -1, 1. Then, in step c4, all objects were input into the K-means clustering algorithm to obtain two categories: B, C, D and E, F. Finally, in step c5, based on the category characteristics, it was determined that the smart terminals corresponding to B, C, and D were household electricity consumption types, and those corresponding to E and F were commercial electricity consumption types.

[0184] By executing steps c1 to c5, this embodiment of the application quantifies the characteristics of users' electricity consumption periods through step c1, clarifies the fluctuation of electricity load through step c2, integrates and forms complete cluster analysis data through step c3, clearly identifies user groups with similar electricity consumption characteristics through step c4, and accurately matches the electricity consumption type of smart terminals through step c5. The entire process realizes the orderly transformation from raw electricity consumption data to clearly defining the electricity consumption type of smart terminals, providing a clear and reliable classification basis for subsequent power resource allocation, user electricity consumption analysis and related management work.

[0185] Figure 4 A schematic diagram of an attention-based electricity sales time-series prediction system provided in this application embodiment is shown below. Figure 4 As shown, the system includes:

[0186] The data acquisition module 41 is used to collect electricity consumption behavior data and power quality data of smart terminals from the blockchain. The electricity consumption behavior data includes user behavior data.

[0187] The generation module 42 is used to identify the power consumption type of smart terminals based on user behavior data using the K-means clustering algorithm, and generate a behavior feature vector based on the power consumption type.

[0188] Processing module 43 is used to process power quality data using cosine transformation to obtain equipment operating characteristic values.

[0189] Module 44 is established to achieve cross-regional data sharing of user behavior data through preset consensus rules, and to establish corresponding dynamic user profiles based on the shared user behavior data.

[0190] Analysis module 45 is used to process and analyze information from behavioral feature vectors, device operation feature values, and user dynamic profiles through a graph neural network based on an attention mechanism, in order to obtain the spatiotemporal patterns of user behavior.

[0191] The prediction module 46 is used to predict the electricity sales volume of users under changes in electricity consumption habits based on the spatiotemporal patterns of behavior.

[0192] The electricity sales time-series prediction system based on the attention mechanism in this application is used to implement the aforementioned electricity sales time-series prediction method based on the attention mechanism. Therefore, the specific implementation of the electricity sales time-series prediction system based on the attention mechanism can be found in the embodiment section of the electricity sales time-series prediction method based on the attention mechanism above. The specific implementation can be referred to the description of the corresponding embodiment, and will not be repeated here.

[0193] This application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above-described attention-based electricity sales timing prediction methods.

[0194] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the above-described attention-based electricity sales timing prediction methods.

[0195] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory, random access memory, portable hard drives, magnetic disks, or optical disks.

[0196] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above embodiments of the attention-based electricity sales timing prediction method.

[0197] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0198] The foregoing has provided a detailed description of the attention-based electricity sales timing prediction method, system, electronic device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A time-series prediction method for electricity sales based on attention, characterized in that, include: Data on electricity consumption behavior and power quality of smart terminals are collected from the blockchain, and the electricity consumption behavior data includes user behavior data. Based on the user behavior data, the power consumption type of the smart terminal is identified by the K-means clustering algorithm, and a behavior feature vector is generated based on the power consumption type. The power quality data is processed using a cosine transform method to obtain equipment operating characteristic values; Cross-regional data sharing of user behavior data is achieved through preset consensus rules, and corresponding dynamic user profiles are established based on the shared user behavior data. By processing and analyzing the behavioral feature vector, the device operation feature value, and the information in the user dynamic profile using a graph neural network based on an attention mechanism, the spatiotemporal patterns of user behavior can be obtained. Based on the aforementioned spatiotemporal patterns of behavior, predict the electricity sales volume of the user under changes in electricity consumption habits; The process of analyzing the behavioral feature vector, the device operating feature value, and the information in the user dynamic profile using a graph neural network based on an attention mechanism to obtain the spatiotemporal patterns of user behavior includes: The behavioral feature vector, the device operation feature value, and the information in the user dynamic profile are converted into corresponding network input features; A correlation graph is constructed based on the correlation between the network input features, and a corresponding attention weight is assigned to the features of highly correlated nodes in the correlation graph through an attention mechanism. A graph neural network is used to process the features of related nodes with assigned attention weights to output the temporal distribution features and spatial correlation features of user behavior. By integrating the temporal distribution features and the spatial correlation features, the spatiotemporal patterns of user behavior are obtained.

2. The attention-based time-series prediction method for electricity sales according to claim 1, characterized in that, The step of achieving cross-regional data sharing of user behavior data through preset consensus rules, and establishing corresponding dynamic user profiles based on the shared user behavior data, includes: Set preset consensus rules, which include node admission rules, information conversion rules, and regional coding rules; Based on the node admission rules, target nodes for cross-regional data sharing are selected from all smart terminals. The target nodes are smart terminals that have been verified by the blockchain. Based on the information conversion rules, the user behavior data associated with the target node in the blockchain is converted into standardized signals; Based on the aforementioned region coding rules, a region source marker is added to the standardized signal; Using the target node, a standardized signal with a regional source mark is transmitted to a relay node. The relay node restores the standardized signal with the regional source mark to user behavior data and summarizes it to form cross-regional summary information. Extract the electricity consumption period ratio, equipment start-up interval and electricity peak change signal from the cross-regional aggregated information, and group and integrate them according to the user identity corresponding to the target node to generate the corresponding user feature set; Based on the user feature set, a corresponding dynamic user profile is established.

3. The attention-based time-series prediction method for electricity sales according to claim 2, characterized in that, The step of establishing a corresponding dynamic user profile based on the user feature set includes: Extract the peak electricity consumption interval corresponding to the electricity consumption period ratio, the linkage mode corresponding to the equipment start-up interval, and the electricity fluctuation cycle corresponding to the electricity consumption peak change signal from the user feature set; The peak electricity consumption period, the linkage mode, and the electricity consumption fluctuation cycle are associated and integrated according to the corresponding user identity to form an initial tag set; Calculate the changes in the percentage of electricity consumption periods, the device startup interval, and the peak electricity consumption change signal in the user feature set within two consecutive cycles. If any change exceeds the corresponding preset threshold range, update the initial label set to obtain the target label set. Based on the target tag set, a dynamic user profile is constructed.

4. The attention-based time-series prediction method for electricity sales according to claim 1, characterized in that, The step of constructing a correlation graph based on the correlation between the network input features, and assigning corresponding attention weights to the features of highly correlated nodes in the correlation graph through an attention mechanism, includes: Determine the co-occurrence frequency of each network input feature in user electricity consumption events and the degree of influence between changes in each network input feature. Based on the correlation between the co-occurrence frequency and the degree of influence, calculate the correlation degree between each network input feature. Using the network input features as nodes and the correlation degree as edge weights, a correlation graph is constructed based on the nodes and edge weights. The numerical value of the edge weight in the correlation graph is proportional to the quantified value of the correlation degree of the corresponding node features. The sum of the edge weights connected to each node feature in the association graph is calculated, and node features whose sum is greater than a preset sum threshold are marked as high-association node features. Based on the magnitude of the sum, attention weights are assigned to the features of the highly correlated nodes using an attention mechanism.

5. The attention-based time-series prediction method for electricity sales according to claim 1, characterized in that, The step involves identifying the power consumption type of the smart terminal based on the user behavior data using a K-means clustering algorithm, and generating a behavioral feature vector based on the power consumption type, including: The user behavior data is analyzed by clustering the user's electricity consumption time period and electricity load fluctuation characteristics using the K-means clustering algorithm to identify the electricity consumption type corresponding to the smart terminal. Based on the electricity consumption type, the electricity consumption frequency and equipment start-up and shutdown patterns in the user behavior data, a behavioral feature vector is generated.

6. The attention-based time-series prediction method for electricity sales according to claim 5, characterized in that, The step of performing cluster analysis on the user's electricity consumption time period and electricity load fluctuation characteristics in the user behavior data using the K-means clustering algorithm to identify the electricity consumption type corresponding to the smart terminal includes: Extract the percentage of electricity usage time of users within a preset time interval from the user behavior data, and use the percentage of electricity usage time as the user's electricity usage time period feature; Extract the amount of change in electricity load and the number of times the electricity load changes per unit time from the user behavior data, and use the amount of change in electricity load and the number of times the change changes as the characteristics of electricity load fluctuation; The user's electricity consumption time period characteristics and the electricity load fluctuation characteristics are integrated to form a cluster analysis object; The clustering analysis objects are classified using the K-means clustering algorithm to obtain multiple feature categories; Based on the multiple feature categories, the power consumption type corresponding to the smart terminal is determined.

7. An attention-based time-series prediction system for electricity sales, characterized in that, For performing the attention-based time-series prediction method for electricity sales as described in any one of claims 1 to 6, including: The data acquisition module is used to collect electricity consumption behavior data and power quality data of smart terminals from the blockchain, wherein the electricity consumption behavior data includes user behavior data; The generation module is used to identify the power consumption type of the smart terminal based on the user behavior data using the K-means clustering algorithm, and generate a behavior feature vector based on the power consumption type; The processing module is used to process the power quality data using a cosine transform method to obtain equipment operating characteristic values; A module is established to achieve cross-regional data sharing of the user behavior data through preset consensus rules, and to establish a corresponding dynamic user profile based on the shared user behavior data. The analysis module is used to process and analyze the behavioral feature vector, the device operation feature value, and the information in the user dynamic profile through a graph neural network based on an attention mechanism to obtain the spatiotemporal pattern of user behavior; The prediction module is used to predict the electricity sales volume of the user under changes in electricity consumption habits based on the spatiotemporal patterns of the behavior.

8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the attention-based electricity sales timing prediction method as described in any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, enables the attention-based electricity sales timing prediction method as described in any one of claims 1 to 6.