User-level electric quantity prediction method and system based on knowledge graph retrieval enhancement generation

Through knowledge graph retrieval enhanced generation method, combined with large language model and embedded layer neural network, integrating user natural language and time series data, it solves the shortcomings of user personalized power prediction in the existing technology and achieves high accuracy and flexibility of power prediction. predict.

CN118709871AActive Publication Date: 2024-09-27国网福建省电力有限公司营销服务中心 +1

Patent Information

Application Number
CN202411204067.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-09-27
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

Existing user-level power forecasting systems cannot effectively utilize natural language data, resulting in insufficient mining of users' personalized power needs, inflexible data scales, and the complexity of the database introducing human errors, resulting in inaccurate forecast results.

Method used

The retrieval enhancement generation method based on knowledge graph is adopted, and the user's natural language data is converted into vector features through large language model and embedding layer neural network, and time series features are integrated to generate personalized user attribute features and input into the LSTM model for power prediction.

Benefits of technology

It achieves an accurate depiction of users' personalized power consumption behavior, improves the accuracy and flexibility of power prediction, reduces human errors, and meets the needs of personalized power services in the power market.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709871A
    Figure CN118709871A
Patent Text Reader

Abstract

The invention relates to a user-level electric quantity prediction method and system based on knowledge graph retrieval enhancement generation, and the method specifically comprises the steps: collecting and preprocessing the power attribute data of a plurality of users, and constructing a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data; inputting the power attribute data of a plurality of personalized users into a pre-trained large language model, dividing the users with similar power attribute data into similar users, generating a natural language question text based on the power attribute data of the users, querying the power utilization levels of the various users in a vector database and a hierarchical knowledge graph database, and determining the power utilization levels of the users. Respectively generating personalized user attribute features of various users; acquiring power time sequence data according to the power utilization records based on the power utilization habits of various users in a preset time range, and extracting time sequence characteristics by using an embedded layer neural network; and fusing the personalized user attribute features and the time sequence features of the various users in a vector splicing mode to obtain comprehensive features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of large language models and retrieval enhancement technology, and specifically to a user-level power prediction method and system based on knowledge graph retrieval enhancement generation. Background Art

[0002] At present, the user-level artificial intelligence power forecasting system uses complex spatiotemporal data for regression forecasting. However, in the face of the diverse and personalized needs of users, it is difficult to meet the personalized power forecasting of users by relying solely on spatiotemporal power series data. Specifically, there are the following problems: The data type is single and the mining of user personality characteristics is insufficient. Existing deep learning algorithms such as LSTM and graph neural networks are good at processing numerical data due to their algorithmic characteristics, and their processing capabilities for natural language data (such as occupation and address) are insufficient. However, data containing user personalized information is often natural language data, which makes it impossible for existing methods to mine users' personalized electricity needs through rich natural language data.

[0003] Due to the limitation of data scale, power data prediction often relies on the user's spatiotemporal series data. In specific operations, data of different scales such as year, month, and day are input into the system to obtain prediction results. However, the traditional scale of year, month, and day is often not flexible enough. If the scale is too small, it will introduce noise caused by accidental actions (such as short-term travel), and if the scale is too large, it will not reflect the user's detailed needs. Relatively speaking, the power consumption impact caused by the user's inherent attributes is often more stable and easy to capture when it changes. Therefore, how to make good use of time series data and user attribute characteristics is the key to solving user personalized prediction.

[0004] The database is complex and requires professionals to perform various processing and calculations. The existing power system database is very large and is usually maintained and processed by professionals, which leads to the introduction of human errors and interference factors in data analysis. Accurate and automated data processing is the basis for subsequent prediction tasks.

[0005] In the prior art CN116760033B, a real-time electricity demand forecasting system based on artificial intelligence discloses a data acquisition module for real-time collection of electricity supply and demand data; a data preprocessing module for cleaning the collected electricity supply and demand data; a data forecasting cloud platform module for building a data forecasting model based on historical electricity demand data, weather data and industry data, and making real-time forecasts of electricity demand; a model optimization and adjustment module for improving and optimizing the data forecasting model; and a security reinforcement module for improving the robustness and security of the system.

[0006] In the existing technology, only the impact of historical electricity demand data and external data such as environmental data and industry data on electricity demand is considered, but the impact of various user behavior habits on electricity demand is not considered from the user side, resulting in inaccurate electricity consumption forecast results. Summary of the invention

[0007] In order to solve the above problems existing in the prior art, the present invention proposes a user-level power prediction method and system based on knowledge graph retrieval enhanced generation.

[0008] The technical solution of the present invention is as follows: On the one hand, the present invention proposes a user-level power prediction method based on knowledge graph retrieval enhanced generation, and the specific steps include: Collect and preprocess the power attribute data of several users, and build a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data; The power attribute data of several personalized users are input into the pre-trained large language model, and users with similar power attribute data are divided into similar users. Natural language question texts are generated based on the power attribute data of users, and the power consumption levels of various users are queried in the vector database and the hierarchical knowledge graph database to generate personalized user attribute features for each type of user. Obtain power time series data based on the power consumption records of various users within a preset time range, and then use the embedded layer neural network to extract time series features; merge the personalized user attribute features of various users with the time series features through vector splicing to obtain comprehensive features; The comprehensive features are input into the pre-trained LSTM prediction model to obtain the final power prediction results that take into account the user's power usage habits and user attributes.

[0009] As a preferred implementation, the collecting of several user power attribute data and preprocessing is specifically as follows: The tabular structure data in each user profile is extracted in the form of bigrams, wherein the bigrams include user attributes and their corresponding values; and then the pre-trained large language model and prompt engineering are used to unify multiple bigrams of the user into a natural language description text block.

[0010] As a preferred implementation, the steps of constructing a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data are specifically as follows: Based on the natural language description text blocks of each user, vector data is established through LangChain's local deployment library; The user's natural language description text block in the vector database is called and input into the pre-trained large language model to extract each name entity and the relationship entity between each name entity, build a ternary relationship pair between every two name entities, and generate a preliminary knowledge graph; with each element entity node in the knowledge graph as the center, extract all its link point pairs, and input all link point pairs into the large language model to generate an element entity summary of the element entity and attach it to the description information of each node; then the nodes on the preliminary knowledge graph are clustered through the Leiden algorithm to generate a hierarchical community structure, and complete the construction of the hierarchical knowledge graph database; The hierarchical community structure includes a root-level community, a low-level community, a middle-level community and a high-level community.

[0011] As a preferred implementation, the steps of generating a natural language question text based on the user's power attribute data, querying the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generating personalized user attribute features for each type of user are specifically as follows: Based on the natural language question text, query in the vector database. The specific formula is as follows:

[0012] In the formula, Indicates the return text. represents text concatenation, Q represents natural language question text, Before The maximum value, represents the similarity function, Represents a data block; Then query in the hierarchical knowledge graph database. The specific formula is as follows:

[0013] In the formula, Represents the electricity consumption characteristics of various users in hierarchical knowledge graph data query, Indicates the community summary, Representing different levels of community; The query results of the two databases are concatenated and returned to the large language model as a reference to generate the corresponding natural language answer. The concatenation formula is as follows:

[0014] In the formula, T represents the text concatenation result of the user attribute features queried from two databases; Finally, the Word2Vec technology is used to transform the answer into a vectorized embedding form as a personalized user attribute feature. The specific formula is as follows:

[0015] In the formula, Represents personalized user attribute characteristics.

[0016] As a preferred implementation, the steps of fusing the personalized user attribute features of various users with the time series features by vector concatenation to obtain the comprehensive features are as follows:

[0017] In the formula, It represents the time series features obtained after the power time series data is processed by the embedding layer neural network.

[0018] On the other hand, the present invention proposes a user-level power prediction system based on knowledge graph retrieval enhanced generation, comprising: The database construction module collects and preprocesses the power attribute data of several users, and constructs a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data; The personalized user attribute feature extraction module inputs the power attribute data of several personalized users into the pre-trained large language model, classifies users with similar power attribute data into similar users, generates natural language question text based on the user's power attribute data, queries the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generates personalized user attribute features for each type of user; The comprehensive feature splicing module obtains power time series data based on the power consumption records of various users based on their power consumption habits within a preset time range, and then uses the embedded layer neural network to extract time series features; the personalized user attribute features of various users are integrated with the time series features through vector splicing to obtain comprehensive features; The electricity consumption prediction module inputs the comprehensive features into the pre-trained LSTM prediction model to obtain the final electricity prediction results that take into account the user's electricity consumption habits and user attributes.

[0019] As a preferred implementation, the collecting of several user power attribute data and preprocessing is specifically as follows: The tabular structure data in each user profile is extracted in the form of bigrams, wherein the bigrams include user attributes and their corresponding values; and then the pre-trained large language model and prompt engineering are used to unify multiple bigrams of the user into a natural language description text block.

[0020] As a preferred implementation, the steps of constructing a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data are specifically as follows: Based on the natural language description text blocks of each user, vector data is established through LangChain's local deployment library; The user's natural language description text block in the vector database is called and input into the pre-trained large language model to extract each name entity and the relationship entity between each name entity, build a ternary relationship pair between every two name entities, and generate a preliminary knowledge graph; with each element entity node in the knowledge graph as the center, extract all its link point pairs, and input all link point pairs into the large language model to generate an element entity summary of the element entity and attach it to the description information of each node; then the nodes on the preliminary knowledge graph are clustered through the Leiden algorithm to generate a hierarchical community structure, and complete the construction of the hierarchical knowledge graph database; The hierarchical community structure includes a root-level community, a low-level community, a middle-level community and a high-level community.

[0021] As a preferred implementation, the steps of generating a natural language question text based on the user's power attribute data, querying the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generating personalized user attribute features for each type of user are specifically as follows: Based on the natural language question text, query in the vector database. The specific formula is as follows:

[0022] In the formula, Indicates the return text. represents text concatenation, Q represents natural language question text, Before The maximum value, represents the similarity function, Represents a data block; Then query in the hierarchical knowledge graph database. The specific formula is as follows:

[0023] In the formula, Represents the electricity consumption characteristics of various users in hierarchical knowledge graph data query, Indicates the community summary, Representing different levels of community; The query results of the two databases are concatenated and returned to the large language model as a reference to generate the corresponding natural language answer. The concatenation formula is as follows:

[0024] In the formula, T represents the text concatenation result of the user attribute features queried from two databases; Finally, the Word2Vec technology is used to transform the answer into a vectorized embedding form as a personalized user attribute feature. The specific formula is as follows:

[0025] In the formula, Represents personalized user attribute characteristics.

[0026] As a preferred implementation, the steps of fusing the personalized user attribute features of various users with the time series features by vector concatenation to obtain the comprehensive features are as follows:

[0027] In the formula, It represents the time series features obtained after the power time series data is processed by the embedding layer neural network.

[0028] The present invention has the following beneficial effects: 1. Aiming at the current demand for personalized electricity consumption services in the electricity market, the present invention uses cutting-edge knowledge graph retrieval enhancement generation algorithm to establish a user-level power and electricity analysis method. By establishing a model that accurately depicts user-level electricity consumption behavior, the high-dimensionality and high-throughput challenges of user-level data are addressed.

[0029] 2. The present invention deeply explores the attribute factors and behavioral logic of users, accurately predicts the electricity demand of various types of electricity users, and provides personalized electricity services for users. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a schematic diagram of the method flow of the present invention; Figure 2 It is a structural topology diagram based on the method flow of the present invention; Figure 3 Figure 2 is a flow chart of the Leiden algorithm. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0032] It should be understood that the step numbers used in this document are only for convenience of description and are not intended to limit the order in which the steps are executed.

[0033] It should be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0034] The terms “include” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0035] The term "and / or" means and includes any and all possible combinations of one or more of the associated listed items.

[0036] Embodiment 1: See also Figure 1 , a user-level power prediction method based on knowledge graph retrieval and enhanced generation, the specific steps include: Collect and preprocess the power attribute data of several users, and build a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data; In this embodiment, the user's power attribute data is collected based on the user profile, and the data in the table is extracted in the form of two tuples, that is, (attribute, value), and stored in units of users. Then, using the large model and prompt engineering, multiple two tuples of the same user are processed into natural language descriptions. The extracted natural language description result is as follows: XXX is a male high school teacher who lives at No. XX, XXX Road, and belongs to the X-voltage resident in the urban residents' daily electricity consumption...

[0037] The power attribute data of several personalized users are input into the pre-trained large language model, and users with similar power attribute data are divided into similar users. Natural language question texts are generated based on the power attribute data of users, and the power consumption levels of various users are queried in the vector database and the hierarchical knowledge graph database to generate personalized user attribute features for each type of user. In this embodiment, for each user, their power attribute data, namely attribute characteristics (age, occupation, gender, address, etc.) are input into the big model, and the big model generates a natural language question text.

[0038] Obtain power time series data based on the power consumption records of various users within a preset time range, and then use the embedded layer neural network to extract time series features; merge the personalized user attribute features of various users with the time series features through vector splicing to obtain comprehensive features; In this embodiment, the historical electricity consumption records in each user's profile are extracted first, and then the electricity consumption records within a preset time range are extracted according to the needs. The time series characteristics of the user's short-term and long-term behaviors can be respectively represented according to the preset time length; The comprehensive features are input into the pre-trained LSTM prediction model to obtain the final power prediction results that take into account the user's power usage habits and user attributes.

[0039] In this embodiment, the LSTM prediction model is a special recurrent neural network architecture, which is designed to solve the gradient vanishing or gradient exploding problems encountered by traditional RNN when processing long sequence data. This patent inputs the embedded comprehensive features into LSTM, thereby learning the user's behavior while fully combining the user's attribute information, and predicting the user's personalized electricity consumption.

[0040] The LSTM algorithm process is as follows: Step 1: Forget gate calculation.

[0041] in, It is The forget gate output of time steps, is the hidden state at the previous time step, is the input of the current time step, and are the weight and bias of the forget gate.

[0042] Step2: Input gate calculation.

[0043]

[0044] in, is the output of the input gate, is a candidate cell state, is the input gate weight matrix, is the input gate bias term, is the cell state weight matrix, is the cell state bias term.

[0045] Step3: Update cell status.

[0046]

[0047] in, is the cell state at the current time step, is the cell state at the previous time step.

[0048] Step4: Output gate calculation.

[0049]

[0050] in, is the output gate weight matrix, is the output gate bias term.

[0051] Step5: Update the hidden status.

[0052]

[0053] in, is the hidden state at the current time step.

[0054] Based on the above steps, the structural topology diagram of the power prediction method is as follows: Figure 2 shown.

[0055] As a preferred implementation of this embodiment, the collection of several user power attribute data and preprocessing are specifically as follows: The tabular structure data in each user profile is extracted in the form of bigrams, wherein the bigrams include user attributes and their corresponding values; and then the pre-trained large language model and prompt engineering are used to unify multiple bigrams of the user into a natural language description text block.

[0056] As a preferred implementation of this embodiment, the steps of constructing a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data are specifically as follows: Based on the natural language description text blocks of each user, vector data is established through LangChain's local deployment library; The user's natural language description text block in the vector database is called and input into the pre-trained large language model to extract each name entity and the relationship entity between each name entity, build a ternary relationship pair between every two name entities, and generate a preliminary knowledge graph; with each element entity node in the knowledge graph as the center, extract all its link point pairs, and input all link point pairs into the large language model to generate an element entity summary of the element entity and attach it to the description information of each node; then the nodes on the preliminary knowledge graph are clustered through the Leiden algorithm to generate a hierarchical community structure, and complete the construction of the hierarchical knowledge graph database; The hierarchical community structure includes a root-level community, a low-level community, a middle-level community and a high-level community.

[0057] In this embodiment, the Leiden algorithm is a graph theory algorithm for community detection. It is based on the modular optimization of the graph, and its purpose is to divide the nodes in the network into communities composed of closely connected nodes, while the connections between these communities are relatively sparse. Before the Leiden algorithm is executed, the quality function needs to be defined first, and the Constant Potts Model is usually used to determine the quality function:

[0058] in Representing the community The number of sides, Representing the community For the preliminary knowledge graph, the Leiden algorithm is used iteratively to discover communities, and the intermediate results of the iterative process are regarded as communities at different levels, namely, root-level communities, low-level communities, middle-level communities, and high-level communities.

[0059] Leiden algorithm process: Input: knowledge graph G=(V,E), where V is the point set and E is the edge set; Output: Hierarchical knowledge graph G'.

[0060] Step 1: Local movement of nodes. First, assign each node in the graph G to an independent community, then randomly traverse each node in the form of a queue, try to add the current node to other partitions that can increase the quality function H, and finally move the current node to the partition that can maximize H, and add neighboring nodes that are not in the queue to the queue. Repeat this process until the quality function cannot be increased, and save the partition result at this time as P.

[0061] Step 2: Partition refinement. For each community in P, reassign each node to an independent community, and traverse the well-connected internal nodes, adding them to the well-connected internal community C with probability P:

[0062] in Responsible for controlling the degree of randomization to obtain the refined partition Prefine.

[0063] Step 3: Network aggregation based on refined partitions. Aggregate the graph based on the refined partitions, retain the non-refined graph P, and use the community relationship of the non-refined partitions as the starting point for the next iteration. The graph G becomes G' after this round of iteration.

[0064] Repeat Step 1-3 until the mass function cannot be increased.

[0065] The flowchart of Leiden algorithm is as follows Figure 3 shown.

[0066] As a preferred implementation of this embodiment, the steps of generating a natural language question text based on the user's power attribute data, querying the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generating personalized user attribute features for each type of user are specifically as follows: Based on the natural language question text, query in the vector database. The specific formula is as follows:

[0067] In the formula, Indicates the return text. represents text concatenation, Q represents natural language question text, Before The maximum value, represents the similarity function, Represents a data block; Then query in the hierarchical knowledge graph database. The specific formula is as follows:

[0068] In the formula, Represents the electricity consumption characteristics of various users in hierarchical knowledge graph data query, Indicates the community summary, Representing different levels of community; The query results of the two databases are concatenated and returned to the large language model as a reference to generate the corresponding natural language answer. The concatenation formula is as follows:

[0069] In the formula, T represents the text concatenation result of the user attribute features queried from two databases; Finally, the Word2Vec technology is used to transform the answer into a vectorized embedding form as a personalized user attribute feature. The specific formula is as follows:

[0070] In the formula, Represents personalized user attribute characteristics.

[0071] In this embodiment, Word2Vec is a computational model for generating word embeddings, which can map vocabulary to continuous vectors in a vector space. Word2Vec has two main architectures: continuous bag of words and skip model.

[0072] 1. Continuous Bag of Words The goal of the continuous bag of words model is to predict words in a given context. Specifically, it uses several surrounding words of a word as input to predict the target word.

[0073] 2. Leapfrog Model In contrast to continuous bag of words, the goal of the skip model is to use the target word to predict its context. The skip model usually performs better when dealing with rare words because it directly learns the relationship between the target word and its context.

[0074] Word2Vec algorithm flow: Step 1: Initialize word vectors. Randomly initialize a vector for each word in the vocabulary.

[0075] Step 2: Select training samples. For each word, select a context window based on its position in the text and extract training samples from it.

[0076] Step 3: Train the model. For the continuous bag-of-words model, use the weighted sum of the context word vectors to predict the target word. For Skip-gram, use the target word vector to predict the context word.

[0077] Step 4: Optimize. Use gradient descent or other optimization algorithms to adjust the word vectors to minimize the prediction error.

[0078] Step 5: Iteration. Repeat Step 3 and 4 until the model converges.

[0079] As a preferred implementation of this embodiment, the steps of fusing the personalized user attribute features of various users with the time series features by vector splicing to obtain the comprehensive features are specifically as follows:

[0080] In the formula, It represents the time series features obtained after the power time series data is processed by the embedding layer neural network.

[0081] Embodiment 2 A user-level power prediction system based on knowledge graph retrieval and enhanced generation, comprising: The database construction module collects and preprocesses the power attribute data of several users, and constructs a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data; The personalized user attribute feature extraction module inputs the power attribute data of several personalized users into the pre-trained large language model, classifies users with similar power attribute data into similar users, generates natural language question text based on the user's power attribute data, queries the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generates personalized user attribute features for each type of user; The comprehensive feature splicing module obtains power time series data based on the power consumption records of various users based on their power consumption habits within a preset time range, and then uses the embedded layer neural network to extract time series features; the personalized user attribute features of various users are integrated with the time series features through vector splicing to obtain comprehensive features; The electricity consumption prediction module inputs the comprehensive features into the pre-trained LSTM prediction model to obtain the final electricity prediction results that take into account the user's electricity consumption habits and user attributes.

[0082] As a preferred implementation of this embodiment, the collection of several user power attribute data and preprocessing are specifically as follows: The tabular structure data in each user profile is extracted in the form of bigrams, wherein the bigrams include user attributes and their corresponding values; and then the pre-trained large language model and prompt engineering are used to unify multiple bigrams of the user into a natural language description text block.

[0083] As a preferred implementation of this embodiment, the steps of constructing a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data are specifically as follows: Based on the natural language description text blocks of each user, vector data is established through LangChain's local deployment library; The user's natural language description text block in the vector database is called and input into the pre-trained large language model to extract each name entity and the relationship entity between each name entity, build a ternary relationship pair between every two name entities, and generate a preliminary knowledge graph; with each element entity node in the knowledge graph as the center, extract all its link point pairs, and input all link point pairs into the large language model to generate an element entity summary of the element entity and attach it to the description information of each node; then the nodes on the preliminary knowledge graph are clustered through the Leiden algorithm to generate a hierarchical community structure, and complete the construction of the hierarchical knowledge graph database; The hierarchical community structure includes a root-level community, a low-level community, a middle-level community and a high-level community.

[0084] As a preferred implementation of this embodiment, the steps of generating a natural language question text based on the user's power attribute data, querying the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generating personalized user attribute features for each type of user are specifically as follows: Based on the natural language question text, query in the vector database. The specific formula is as follows:

[0085] In the formula, Indicates the return text. represents text concatenation, Q represents natural language question text, Before The maximum value, represents the similarity function, Represents a data block; Then query in the hierarchical knowledge graph database. The specific formula is as follows:

[0086] In the formula, Represents the electricity consumption characteristics of various users in hierarchical knowledge graph data query, Indicates the community summary, Representing different levels of community; The query results of the two databases are concatenated and returned to the large language model as a reference to generate the corresponding natural language answer. The concatenation formula is as follows:

[0087] In the formula, T represents the text concatenation result of the user attribute features queried from two databases; Finally, the Word2Vec technology is used to transform the answer into a vectorized embedding form as a personalized user attribute feature. The specific formula is as follows:

[0088] In the formula, Represents personalized user attribute characteristics.

[0089] As a preferred implementation of this embodiment, the steps of fusing the personalized user attribute features of various users with the time series features by vector splicing to obtain the comprehensive features are specifically as follows:

[0090] In the formula, It represents the time series features obtained after the power time series data is processed by the embedding layer neural network.

[0091] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. User-level power prediction method based on knowledge graph retrieval and enhanced generation, It is characterized in that The specific steps include: Collect and preprocess the power attribute data of several users, and build a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data; The power attribute data of several personalized users are input into the pre-trained large language model, and users with similar power attribute data are divided into similar users. Natural language question texts are generated based on the power attribute data of users, and the power consumption levels of various users are queried in the vector database and the hierarchical knowledge graph database to generate personalized user attribute features for each type of user. Obtain power time series data based on the power consumption records of various users within a preset time range, and then use the embedded layer neural network to extract time series features; merge the personalized user attribute features of various users with the time series features through vector splicing to obtain comprehensive features; The comprehensive features are input into the pre-trained LSTM prediction model to obtain the final power prediction results that take into account the user's power usage habits and user attributes.

2. According to claim 1, the user-level power prediction method based on knowledge graph retrieval and enhanced generation, It is characterized in that The collecting of several user power attribute data and preprocessing is specifically as follows: The tabular structure data in each user profile is extracted in the form of bigrams, wherein the bigrams include user attributes and their corresponding values; and then the pre-trained large language model and prompt engineering are used to unify multiple bigrams of the user into a natural language description text block.

3. According to claim 2, the user-level power prediction method based on knowledge graph retrieval and enhanced generation, It is characterized in that The steps of constructing a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data are specifically as follows: Based on the natural language description text blocks of each user, vector data is established through LangChain's local deployment library; The user's natural language description text block in the vector database is called and input into the pre-trained large language model to extract each name entity and the relationship entity between each name entity, build a ternary relationship pair between every two name entities, and generate a preliminary knowledge graph; with each element entity node in the knowledge graph as the center, extract all its link point pairs, and input all link point pairs into the large language model to generate an element entity summary of the element entity and attach it to the description information of each node; then the nodes on the preliminary knowledge graph are clustered through the Leiden algorithm to generate a hierarchical community structure, and complete the construction of the hierarchical knowledge graph database; The hierarchical community structure includes a root-level community, a low-level community, a middle-level community and a high-level community.

4. According to claim 1, the user-level power prediction method based on knowledge graph retrieval and enhanced generation, It is characterized in that The steps of generating a natural language question text based on the user's power attribute data, querying the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generating personalized user attribute features for each type of user are specifically as follows: Based on the natural language question text, query in the vector database. The specific formula is as follows: In the formula, Indicates the return text. represents text concatenation, Q represents natural language question text, Before The maximum value, represents the similarity function, Represents a data block; Then query in the hierarchical knowledge graph database. The specific formula is as follows: In the formula, Represents the electricity consumption characteristics of various users in hierarchical knowledge graph data query, Indicates the community summary, Representing different levels of community; The query results of the two databases are concatenated and returned to the large language model as a reference to generate the corresponding natural language answer. The concatenation formula is as follows: In the formula, T represents the text concatenation result of the user attribute features queried from two databases; Finally, the Word2Vec technology is used to transform the answer into a vectorized embedding form as a personalized user attribute feature. The specific formula is as follows: In the formula, Represents personalized user attribute characteristics.

5. According to claim 1, the user-level power prediction method based on knowledge graph retrieval and enhanced generation, It is characterized in that The steps of fusing the personalized user attribute features of various users with the time series features by vector concatenation to obtain comprehensive features are as follows: In the formula, It represents the time series features obtained after the power time series data is processed by the embedding layer neural network.

6. User-level power prediction system based on knowledge graph retrieval and enhanced generation, It is characterized in that include: The database construction module collects and preprocesses the power attribute data of several users, and constructs a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data; The personalized user attribute feature extraction module inputs the power attribute data of several personalized users into the pre-trained large language model, classifies users with similar power attribute data into similar users, generates natural language question text based on the user's power attribute data, queries the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generates personalized user attribute features for each type of user; The comprehensive feature splicing module obtains power time series data based on the power consumption records of various users within a preset time range, and then uses the embedded layer neural network to extract time series features; The personalized user attribute characteristics of various users are integrated with the time series characteristics through vector splicing to obtain comprehensive characteristics; The electricity consumption prediction module inputs the comprehensive features into the pre-trained LSTM prediction model to obtain the final electricity prediction results that take into account the user's electricity consumption habits and user attributes.

7. The user-level power prediction system based on knowledge graph retrieval and enhanced generation according to claim 6, It is characterized in that The collecting of several user power attribute data and preprocessing is specifically as follows: The tabular structure data in each user profile is extracted in the form of bigrams, wherein the bigrams include user attributes and their corresponding values; and then the pre-trained large language model and prompt engineering are used to unify multiple bigrams of the user into a natural language description text block.

8. The user-level power prediction system based on knowledge graph retrieval and enhanced generation according to claim 7, It is characterized in that The steps of constructing a vector database and a hierarchical knowledge graph database based on the preprocessed power attribute data are specifically as follows: Based on the natural language description text blocks of each user, vector data is established through LangChain's local deployment library; The user's natural language description text block in the vector database is called and input into the pre-trained large language model to extract each name entity and the relationship entity between each name entity, build a ternary relationship pair between every two name entities, and generate a preliminary knowledge graph; with each element entity node in the knowledge graph as the center, extract all its link point pairs, and input all link point pairs into the large language model to generate an element entity summary of the element entity and attach it to the description information of each node; then the nodes on the preliminary knowledge graph are clustered through the Leiden algorithm to generate a hierarchical community structure, and complete the construction of the hierarchical knowledge graph database; The hierarchical community structure includes a root-level community, a low-level community, a middle-level community and a high-level community.

9. The user-level power prediction system based on knowledge graph retrieval and enhanced generation according to claim 6, It is characterized in that The steps of generating a natural language question text based on the user's power attribute data, querying the power consumption level of each type of user in the vector database and the hierarchical knowledge graph database, and generating personalized user attribute features for each type of user are specifically as follows: Based on the natural language question text, query in the vector database. The specific formula is as follows: In the formula, Indicates the return text. represents text concatenation, Q represents natural language question text, Before The maximum value, represents the similarity function, Represents a data block; Then query in the hierarchical knowledge graph database. The specific formula is as follows: In the formula, Represents the electricity consumption characteristics of various users in hierarchical knowledge graph data query, Indicates the community summary, Representing different levels of community; The query results of the two databases are concatenated and returned to the large language model as a reference to generate the corresponding natural language answer. The concatenation formula is as follows: In the formula, T represents the text concatenation result of the user attribute features queried from two databases; Finally, the Word2Vec technology is used to transform the answer into a vectorized embedding form as a personalized user attribute feature. The specific formula is as follows: In the formula, Represents personalized user attribute characteristics.

10. The user-level power prediction system based on knowledge graph retrieval and enhanced generation according to claim 6, It is characterized in that The steps of fusing the personalized user attribute features of various users with the time series features by vector concatenation to obtain comprehensive features are as follows: In the formula, It represents the time series features obtained after the power time series data is processed by the embedding layer neural network.

Citation Information

Patent Citations

  • Online household load power utilization combination identification and power consumption prediction method

    CN112465268A

  • Multi-factor electrical load prediction method based on deep learning

    CN113962364A

  • User electricity consumption prediction method based on VMD-Lasso-CNN-LSTM

    CN114692947A

  • Dynamic query method and model of power marketing data based on knowledge graph

    CN116186293A

  • Residential electricity consumption prediction method and device based on machine learning, equipment and medium

    CN117494947A

Cited By

  • Green electricity energy storage scheduling method based on big data

    CN119853180A

  • Green electricity storage scheduling method based on big data

    CN119853180B

  • Power demand prediction and knowledge retrieval method and device based on NLP

    CN119940661A