Recommendation method of collaborative attention mechanism based on time preference and knowledge perception
By introducing a recommendation method based on time preference and knowledge perception in power material management, the problems of data isolation and inaccurate demand forecasting in power material management are solved, and more accurate recommendations and lower operating costs are achieved.
Patent Information
- Application Number
- CN202411618468.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-11-07
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-13
AI Technical Summary
There are problems in power material management such as data isolation, inefficient information retrieval and inaccurate material demand forecasts, resulting in inadequate management efficiency and increased risk of supply chain disruption.
The power material recommendation method based on time preference and knowledge perception is adopted. By comprehensively utilizing user behavior history and time information, collaborative filtering and knowledge graph information are fused under the same framework, the attention mechanism is used to learn the weights of different neighbor nodes in the knowledge graph, and a time-sequential dynamic multi-head attention network is designed to capture the time preferences in user historical behavior.
It improves the accuracy of power material recommendations, makes the recommendation results more in line with the current needs of users, reduces operating costs and improves the intelligence level of material management.
Smart Images

Figure CN119577241A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for recommending electric power materials based on a collaborative attention mechanism of time preference and knowledge perception in the context of electric power material management. Background Art
[0002] As the digital transformation of the power industry deepens, power material management faces challenges such as data isolation, low information retrieval efficiency, and inaccurate material demand forecasts. These problems not only restrict management efficiency, but may also cause risks such as supply chain disruptions and inventory imbalances, thereby increasing operating costs. Therefore, how to overcome these defects and improve the level of intelligent material management has become an urgent problem to be solved in the power industry.
[0003] In this context, power grid material demand forecasting based on big data, machine learning and other theories has become an important means of material management reform. As an information filtering tool based on big data and artificial intelligence technology, the recommendation system has demonstrated its strong application potential in many fields, such as product recommendations on e-commerce platforms, song recommendations on music platforms, and article push on news clients. These application cases show that the recommendation system can effectively analyze users' historical behaviors and preferences, and provide users with personalized recommendation services, thereby improving user experience and satisfaction. In power material management, the recommendation system helps reduce enterprise operating costs by accurately predicting demand, optimizing inventory, and improving procurement efficiency.
[0004] Recommendation systems predict and recommend items that users may be interested in by analyzing the interactions between users and items. The main technologies include matrix factorization, collaborative filtering, and deep learning, which have achieved remarkable results in personalized recommendations. However, recommendation systems still face challenges such as data sparsity, cold start problems, and insufficient interpretability of recommendations in practical applications. Knowledge graphs provide rich semantic information, which helps to solve data sparsity and cold start problems, and more accurately capture user preferences by mapping user and item information. Although knowledge graphs perform well in alleviating data sparsity and cold start problems, their static structure limits the understanding of dynamic changes in user interests. The recommendation task dataset contains rich user behavior history and time information, but the current recommendation model based on knowledge graphs ignores the importance of time information. Summary of the invention
[0005] This application addresses the problems and shortcomings of the prior art by adding time factors to the current knowledge graph-based recommendation system to solve the problem of power material recommendation. As a solution, this application proposes a new method for recommending power materials based on a collaborative attention mechanism of time preference and knowledge perception. This method comprehensively utilizes user behavior history and time information, integrates collaborative filtering and knowledge graph information in the same framework, learns the weights of different neighbor nodes in the knowledge graph through the attention mechanism, and extracts key collaborative information. Then, a time-series dynamic multi-head attention network is designed to capture the time preference in the user's historical behavior.
[0006] Technical solution:
[0007] A recommendation method based on a time preference and knowledge-aware collaborative attention mechanism, which includes the following steps:
[0008] (1) Establish a knowledge graph based on power materials. The knowledge graph includes various attribute information of power materials and integrates the correlation between materials.
[0009] (2) Establish an interactive data set between each power supply company and materials, including the power supply company's purchase records of various materials, the purchase time sequence, and the ratings of the materials;
[0010] (3) According to steps (1) and (2), through collaborative propagation, determine the initial entity set of the power supply company and materials propagated in the knowledge graph, as well as the material sequence collected by the power supply company by time;
[0011] (4) According to step (3), the knowledge graph attention network is used to perform knowledge-based deep propagation on the knowledge graph; starting from the initial entity set, it expands outward layer by layer in the layered structure of the knowledge graph to capture the high-order association information of users and items in the knowledge graph;
[0012] (5) According to step (3), based on the material sequence collected by the power supply company, a temporal multi-head attention network is used to effectively integrate time information into neighbor embedding learning, thereby capturing the user's dynamic preferences that change over time and making the recommendation results more in line with the user's current needs;
[0013] (6) According to steps (2) and (3), the obtained user representation and item representation are aggregated and then recommended.
[0014] Preferably, the step (1) of constructing a knowledge graph based on electric power materials specifically includes:
[0015] (1-1) Collect and organize relevant data on power materials, including basic attributes, usage scenarios, and order details of various materials;
[0016] (1-2) Data processing of the collected information, including merging repeated and redundant entities, and reasoning and completing missing relationships;
[0017] (1-3) The processed data is classified according to the types of power materials to form a hierarchical structure of major categories, medium categories and minor categories; the key attributes of each type of material and their relationships are extracted to construct a knowledge graph structure.
[0018] Preferably, the step (2) comprises:
[0019] Score A is calculated based on the number of times the user has purchased the product, with a score range of 0-5 points. Score B is calculated based on the total number of times all users have purchased the product, with a score range of 0-5 points.
[0020] The weighted average method is adopted to comprehensively consider both, and the final score is calculated by the following formula: score = A*50% + B*50%. In this way, the interaction data set of power supply companies and materials is constructed; then, according to the signing date of the power supply company contract, the order of the material interaction data sets of each power supply company is determined.
[0021] Preferably, the step (3) comprises:
[0022] The power supply company is represented by the materials that the power supply company has interacted with, and the initial entity set of the power supply company is defined as:
[0023]
[0024] Where u and v represent the power supply company and materials respectively, ε={e1,e2,...,e S} represents all entities, v∈V, e∈ε} means that each material in the power supply company set corresponds to an entity e in the entity set, represents the interaction between the target user u and the non-interacted target item v;
[0025] Multiple materials interacting with the same power supply company are called collaborative material sets. The collaborative neighbors of materials are defined as:
[0026]
[0027] In the formula, v u Indicates other materials that are exchanged by the same power supply company. Represents the interaction between the target user u and other materials;
[0028] After the collaborative neighbors of the material correspond to the entities in the knowledge graph, the initial entity set of the material propagation in the knowledge graph is obtained, which is defined as:
[0029]
[0030] In the formula, Represents the initial set of items, which consists of other items that have the same interactive users as the requested item;
[0031] The material sequence of the power supply company is constructed according to the order in the power supply company material interaction dataset:
[0032] S u = {v1, v2, ..., v n}.
[0033] Preferably, in step (4), based on the initial entity set of power supply companies and materials, entity and relationship propagation is used in the knowledge graph to assist knowledge association, and multi-hop data sets are obtained for related users and projects, thereby expanding the potential vector representation of the entity.
[0034] Preferably, the step (4) specifically comprises:
[0035] The neighbor sets of power supply companies and supplies are:
[0036]
[0037] Where l represents the number of hops from the neighbor to the initial entity set, and o is used as a unified placeholder for the power supply company u or the material v; G = {(h, r, t) | h, t∈ε, r∈R} represents the knowledge graph, and each (h, r, t) triple represents the relationship r between the head entity h and the tail entity t;
[0038] The l-th order triple set of power supply companies and materials in knowledge graph propagation is expressed as:
[0039]
[0040] Add attention mechanism to distinguish the tail entities that integrate multiple layers of information:
[0041]
[0042] In the formula, a i Indicates that in the i-th triple, the tail entity is multiplied by the attention weight to obtain the information propagated by the final tail entity; represents the attention weight;
[0043] The specific calculation process is as follows:
[0044]
[0045] In the formula, “;” indicates the connection of the matrix, and r iThey represent the head entity and relation in the triple respectively, W1, W2, W3, b1, b2 represent parameters;
[0046] The triples of power supply companies or materials in the first layer of the knowledge graph are represented as follows:
[0047]
[0048] In the formula, It is the aggregation of the entity information at the end of the triplet at layer l;
[0049] In order to accurately capture the inherent characteristics of materials and reduce the distortion that may occur during multi-layer information transmission, the representation of materials is integrated into their own core information, which is expressed as:
[0050]
[0051] Preferably, the step (5) comprises:
[0052] According to the historical purchase information of the power supply company, we can obtain the time series of materials. First, we add a position code to the series:
[0053]
[0054] In the formula, represents the initial vector of the power supply company's historical material time series, The position vector representing the sequence;
[0055] A multi-head attention mechanism is introduced to capture temporal information from multiple angles, and a dynamic attention strategy is adopted to adaptively track the evolution of user interests:
[0056]
[0057]
[0058] Where X0 is the input matrix, W i (Q) , W i (K) , W i (V) is the learnable weight parameter of the i-th head, d K represents the dimension of K, W D is a factor that affects attention distribution and Parameters;
[0059]
[0060] r u =FeedForward(h u )=max(0,hu W1+b1)W2+b2,
[0061] In the formula, r u represents the temporal neighbor embedding generated by multi-head attention, i represents the number of attention heads, Represents a trainable parameter;
[0062] The average pooling method is used to obtain the final time series vector representation of the user:
[0063]
[0064] Preferably, the step (6) includes:
[0065] Join the final representations of the power supply company and materials:
[0066]
[0067]
[0068] In the formula, represents the vector representation of the power company learned by the knowledge graph attention network, t u Representation of the power company obtained through the temporal attention network; represents the initial vector representation of the material, Represents the material vector representation learned by the knowledge graph attention network;
[0069] The prediction is made according to the following formula:
[0070]
[0071] Beneficial Effects of the Invention
[0072] This application studies the recommendation method under the management of electric power materials. In this application, in order to accurately recommend electric power materials, we deeply analyze the user's purchase behavior history. Through these behavioral data, the user's preferences and interests are extracted to provide a strong basis for subsequent recommendations. At the same time, in order to further enhance the accuracy of the recommendation, the auxiliary information in the knowledge graph is integrated with the collaborative information of the user-project interaction to form a unified information space. The attention mechanism is introduced to accurately extract the key elements in the collaborative information by learning the weights of neighbor nodes under different conditions. Focus on the impact of time factors on recommendation results, and effectively integrate time information into neighbor embedding learning. In this way, the preferences of users and projects that change over time are captured, so that the recommendation results are more in line with the current needs of users. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] Figure 1 This is the basic framework diagram of the power material recommendation method based on the collaborative attention mechanism of time preference and knowledge perception.
[0074] Figure 2 yes Figure 1 Flowchart of the dynamic attention mechanism in the temporal attention network. DETAILED DESCRIPTION
[0075] The present invention will be further described below in conjunction with embodiments, but the protection scope of the present invention is not limited thereto:
[0076] This example provides a method for recommending electric power materials based on a collaborative attention mechanism of time preference and knowledge perception, and introduces it in detail using the architecture as an example. Figure 1 As shown in the figure, the model consists of five modules, namely (1) data input module, which includes knowledge graph data and time data reflecting the user's historical behavior. (2) collaborative propagation module, which extracts the historical interaction information between users and items to obtain collaborative information. (3) knowledge-aware attention network module, which obtains the representation of users and items through knowledge graph information. (4) temporal attention network module, which extracts user historical behavior information to obtain user interest representation. (5) prediction module, which integrates the representation of users and items to generate the final recommendation results.
[0077] The specific implementation steps are:
[0078] (1) After the model receives the global model parameters, it divides the local data set into multiple batches according to the set batch size. The data of each batch will be sent to the model for training in turn.
[0079] (2) Obtain vector representations of users and items through knowledge-aware attention networks and temporal attention networks. Specifically: Based on the initial entity sets of power supply companies and materials, entity and relationship propagation is used in the knowledge graph to assist knowledge association, and multi-hop data sets are obtained for related users and items, thereby expanding the potential vector representation of entities. The neighbor sets of power supply companies and materials are:
[0080]
[0081] The first-order triple set of power supply companies and materials in knowledge graph propagation is expressed as:
[0082]
[0083] At the same time, considering that different tail entities have different head entities and relations in the knowledge graph, such as Figure 2 As shown, an attention mechanism is added to distinguish the tail entities that integrate multiple layers of information.
[0084]
[0085] The specific calculation process is as follows:
[0086]
[0087] The triples of power supply companies or materials in the first layer of the knowledge graph are represented as follows:
[0088]
[0089] In order to accurately capture the inherent characteristics of materials and reduce the distortion that may occur during multi-layer information transmission, the representation of materials is integrated into their own core information, which is expressed as:
[0090]
[0091] According to the historical purchase information of the power supply company, we can obtain the time series of materials. First, we add a position code to the series:
[0092]
[0093] In order to enhance the expressiveness of temporal networks, a multi-head attention mechanism is introduced to capture temporal information from multiple angles, and a dynamic attention strategy is adopted to adaptively track the evolution of user interests.
[0094]
[0095]
[0096] The attention outputs from different heads are merged in the feature dimension, and then a feed-forward neural network is applied for dimensionality transformation:
[0097]
[0098] r u =FeedForward(h u )=max(0,h u W1+b1)W2+b2,
[0099] The average pooling method is used to obtain the final time series vector representation of the user:
[0100]
[0101] Splice the final representation of the power supply company and materials
[0102]
[0103]
[0104] Then the recommendation scores between users and items are calculated.
[0105] (3) Calculate the gradient of the loss function with respect to the model parameters through back propagation. This includes: calculating the gradient of each parameter through the chain rule. Using the Adam algorithm to update the model parameters.
[0106] (4) After each training cycle, use the validation set to evaluate the performance of the model. Adjust the model hyperparameters or structure based on the validation results to improve model performance. Repeat the above steps until the preset number of training rounds is reached.
[0107] After training is complete, the final model is evaluated using the test set to test its performance on unseen data.
[0108] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.
Claims
1. A recommendation method based on a collaborative attention mechanism of time preference and knowledge perception, characterized in that It includes the following steps: (1) Establish a knowledge graph based on power materials. The knowledge graph includes various attribute information of power materials and integrates the correlation between materials. (2) Establish an interactive data set between each power supply company and materials, including the power supply company's purchase records of various materials, the purchase time sequence, and the ratings of the materials; (3) According to steps (1) and (2), through collaborative propagation, determine the initial entity set of the power supply company and materials propagated in the knowledge graph, as well as the material sequence collected by the power supply company by time; (4) According to step (3), the knowledge graph attention network is used to perform knowledge-based deep propagation on the knowledge graph; starting from the initial entity set, it expands outward layer by layer in the layered structure of the knowledge graph to capture the high-order association information of users and items in the knowledge graph; (5) According to step (3), based on the material sequence collected by the power supply company, a temporal multi-head attention network is used to effectively integrate time information into neighbor embedding learning, thereby capturing the user's dynamic preferences that change over time and making the recommendation results more in line with the user's current needs; (6) According to steps (2) and (3), the obtained user representation and item representation are aggregated and then recommended.
2. The method according to claim 1, characterized in that The step (1) of constructing a knowledge graph based on electric power materials specifically includes: (1-1) Collect and organize relevant data on power materials, including basic attributes, usage scenarios, and order details of various materials; (1-2) Data processing of the collected information, including merging repeated and redundant entities, and reasoning and completing missing relationships; (1-3) The processed data is classified according to the types of power materials to form a hierarchical structure of major categories, medium categories and minor categories; the key attributes of each type of material and their relationships are extracted to construct a knowledge graph structure.
3. The method according to claim 1, characterized in that The step (2) comprises: Score A is calculated based on the number of times the user has purchased the product, with a score range of 0-5 points. Score B is calculated based on the total number of times all users have purchased the product, with a score range of 0-5 points. The weighted average method is adopted to comprehensively consider both, and the final score is calculated by the following formula: score = A*50% + B*50%. In this way, the interaction data set of power supply companies and materials is constructed; then, according to the signing date of the power supply company contract, the order of the material interaction data sets of each power supply company is determined.
4. The method according to claim 1, characterized in that The step (3) comprises: The power supply company is represented by the materials that the power supply company has interacted with, and the initial entity set of the power supply company is defined as: In the formula, u and v represent the power supply company and materials respectively, ε={e1,e2,…,e S } represents all entities, Indicates that each material in the power supply company set corresponds to an entity e in the entity set. represents the interaction between the target user u and the non-interacted target item v; Multiple materials interacting with the same power supply company are called collaborative material sets. The collaborative neighbors of materials are defined as: In the formula, v u Indicates other materials that are exchanged by the same power supply company. Represents the interaction between the target user u and other materials; After the collaborative neighbors of the material correspond to the entities in the knowledge graph, the initial entity set of the material propagation in the knowledge graph is obtained, which is defined as: In the formula, Represents the initial set of items, which consists of other items that have the same interactive users as the requested item; The material sequence of the power supply company is constructed according to the order in the power supply company material interaction dataset: S u ={v1,v2,…,v n }。 5. The method according to claim 1, characterized in that In step (4), based on the initial entity set of power supply companies and materials, entity and relationship propagation are used in the knowledge graph to assist knowledge association, and multi-hop data sets are obtained for related users and projects, thereby expanding the potential vector representation of the entity.
6. The method according to claim 5, characterized in that The step (4) specifically comprises: The neighbor sets of power supply companies and supplies are: In the formula, l represents the number of hops from the neighbor to the initial entity set, and o is used as a unified placeholder for the power supply company u or the material v; Represents a knowledge graph, where each (h, r, t) triple indicates that there is a relationship r between the head entity h and the tail entity t; The l-th order triple set of power supply companies and materials in knowledge graph propagation is expressed as: Add attention mechanism to distinguish the tail entities that integrate multiple layers of information: In the formula, a i Indicates that in the i-th triple, the tail entity is multiplied by the attention weight to obtain the information propagated by the final tail entity; represents the attention weight; The specific calculation process is as follows: In the formula, ";" indicates the connection of the matrix, and r i They represent the head entity and relation in the triple respectively, W1, W2, W3, b1, b2 represent parameters; The triples of power supply companies or materials in the lth layer of the knowledge graph are represented as follows: In the formula, It is the aggregation of the entity information at the end of the triplet at layer l; In order to accurately capture the inherent characteristics of materials and reduce the distortion that may occur during multi-layer information transmission, the representation of materials is integrated into their own core information, which is expressed as:
7. The method according to claim 1, characterized in that The step (5) comprises: According to the historical purchase information of the power supply company, we can obtain the time series of materials. First, we add a position code to the series: In the formula, represents the initial vector of the power supply company's historical material time series, The position vector representing the sequence; A multi-head attention mechanism is introduced to capture temporal information from multiple angles, and a dynamic attention strategy is adopted to adaptively track the evolution of user interests: Where X0 is the input matrix, is the learnable weight parameter of the i-th head, d K represents the dimension of K, W D is a factor that affects attention distribution and Parameters; r u =FeedForward(h u )=max(0,h u W1+b1)W2+b2, In the formula, r u represents the temporal neighbor embedding generated by multi-head attention, i represents the number of attention heads, Represents a trainable parameter; The average pooling method is used to obtain the final time series vector representation of the user:
8. The method according to claim 1, characterized in that The step (6) includes: Join the final representations of the power supply company and materials: In the formula, represents the vector representation of the power company learned by the knowledge graph attention network, t u Representation of the power company obtained through the temporal attention network; represents the initial vector representation of the material, Represents the material vector representation learned by the knowledge graph attention network; The prediction is made according to the following formula:
Citation Information
Patent Citations
Method for carrying out personalized recommendation on commodities by fusing knowledge graph
CN112232925A
Interpretable recommendation system based on knowledge graph
CN112836123A
Knowledge graph recommendation method based on propagation
CN114637863A
Article recommendation model fusing knowledge graph and time interval sequence
CN115496560A
Serialization recommendation method based on knowledge graph
CN117390275A