Method for expanding few-sample power grid legal knowledge

Through the double-layer attention gating mechanism and conditional variational autoencoder, the complexity and dynamic update of the expansion of grid legal knowledge are solved, the legal relationship modeling and knowledge inference accuracy in the small sample scenario are improved, and the power grid is realized Efficient expansion of legal knowledge.

CN119293262APending Publication Date: 2025-01-10NANJING UNIV +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411392336.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing method of expanding grid legal knowledge has failed to effectively deal with the complexity and dynamic update of grid legal knowledge, especially in the case of small sample scenarios, lacking high-precision knowledge reasoning capabilities, and unable to fully understand the semantic information of legal entities and relationships.

Method used

A double-layer attention gating mechanism and conditional variational autoencoder are used to generate additional examples of small sample relationships through meta-learning and graph structure information, which enhances legal relationship modeling capabilities and improves the expansion effect of grid legal knowledge.

Benefits of technology

It improves the effect of expanding grid legal knowledge in the small sample scenario, enhances the ability to express semantic information of complex relationships, improves the accuracy and generalization ability of knowledge reasoning, and ensures high-precision update of grid legal knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119293262A_ABST
    Figure CN119293262A_ABST
Patent Text Reader

Abstract

The invention discloses a few-sample power grid legal knowledge expansion method, which comprises the following steps that existing power grid legal knowledge triple data is divided into different tasks according to a relationship, and each task has respective support set and query set data; encoding graph structure information contained in the power grid legal knowledge triple based on a knowledge representation method to obtain initial representation of legal entities and relationships; in the training process, meta-learning is used for enabling the model to obtain universal legal knowledge (meta-information) crossing different relations, and representation of the relations is calculated by using the meta-information and samples in a support set corresponding to each relation; a double-layer attention gating network is used to consider neighbor information of legal entities of a power grid from the perspective of entities and relationships, and expression of the legal entities and few-sample legal relationships is enhanced; and finally, more support samples are generated for the few-sample legal relationship in combination with a conditional variational auto-encoder. And finally, during few-sample power grid legal knowledge expansion, the prediction precision of the tail entity is improved, and the power grid legal knowledge expansion effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of data mining, knowledge representation and reasoning, and in particular to a method for expanding legal knowledge of power grids with a small number of samples. Background Art

[0002] Knowledge graph is a concept proposed by Google in 2012. It represents entities and the relationships between entities in the form of graphs, stores knowledge, represents entities through nodes, represents the relationships between entities through edges, and stores in the form of triples. It is an important foundation for many intelligent applications. At present, many works use automated knowledge reasoning technology to predict new knowledge and complete knowledge expansion, thereby improving the coverage and accuracy of existing knowledge and improving the application effect of knowledge graphs in various downstream fields.

[0003] Knowledge expansion mainly relies on knowledge reasoning technology to acquire new knowledge. Knowledge reasoning technology is mainly divided into four categories: distance metric-based methods, tensor decomposition-based methods, graph neural network-based methods, and combined methods. Among them, the distance metric-based method assumes that a relationship can be represented as a translation from the head entity to the tail entity, and calculates the representation of entities and relationships based on this principle. The tensor decomposition-based method represents triples through a multi-order tensor decomposition algorithm, which can capture multiple relationships between entities. The graph neural network-based method aggregates the information of neighbor nodes through convolution operations to generate node representations, thereby capturing local structural information. The combined method combines the advantages of the above methods and uses the above different methods for different problems to obtain better knowledge reasoning effects.

[0004] Most of the existing Chinese knowledge expansion methods are aimed at knowledge reasoning in general fields, which are relatively mature at present. However, there is still relatively little work on expanding power grid legal knowledge. Power grid legal knowledge is highly professional, involving a large number of professional terms and complex legal provisions and regulations. At the same time, laws, regulations and precedents will be constantly updated, requiring the representation of knowledge to have a high update frequency and timeliness. In addition, the field of power grid law requires extremely high accuracy, and any mistakes may lead to serious consequences. Therefore, compared with knowledge expansion in general fields, models for power grid legal knowledge expansion often need to have higher accuracy and need to handle environments where knowledge is constantly increasing and growing dynamically. These often require more complex and sophisticated method designs.

[0005] There are two main problems with the existing methods for expanding legal knowledge of power grids: 1. Existing knowledge representation methods do not take into account the complexity of legal knowledge of power grids, which includes a large number of professional and complex legal entities (such as cases, legal provisions, judges, lawyers, etc.) and their complex relationships (such as applicability, judgments, citations, etc.). Therefore, the methods lack understanding of the semantic information in legal entities and relationships. 2. Power grid legal knowledge is easier to update dynamically, so it is more necessary to face the situation of knowledge expansion with a small number of training samples. However, few existing knowledge expansion methods can handle knowledge reasoning under the situation of few samples well. Summary of the invention

[0006] Purpose of the invention: In view of the problems and shortcomings of the above-mentioned prior art, the purpose of the present invention is to provide a method for expanding legal knowledge of power grids with a small number of samples. The method uses a two-layer attention gating mechanism to enhance the ability to express semantic information of power grid laws. At the same time, the method generates additional small-sample relationship examples based on the conditional variational autoencoder to enhance the legal relationship modeling ability of the method in small-sample scenarios. Through the above design, the present invention can improve the effect of expanding legal knowledge of power grids in small-sample scenarios, and provide guarantees for subsequent practical applications.

[0007] Technical solution: To achieve the above-mentioned invention purpose, the technical solution adopted by the present invention is a method for expanding legal knowledge of power grid with a small number of samples, comprising the following steps:

[0008] (1.1) The training data set is divided into different tasks according to the legal relationship. Each task corresponds to a specific legal relationship and contains its own "support set + query set" data. The support set contains a small number of samples of the legal relationship. Therefore, the specific legal relationship corresponding to each task is also called a few-sample legal relationship.

[0009] (1.2) Based on the graph structure information in the power grid legal knowledge triples, the first initialization vector representation of the legal entity and the second initialization vector representation of the legal relationship are obtained using the representation learning method of TransE;

[0010] (1.3) Based on the legal entities and legal relationship vectors initialized in step (1.2), meta-learning is used to enable the model to obtain general legal relationship knowledge across different legal relationships, wherein the general legal relationship knowledge is meta-information, and the meta-information is used to comprehensively calculate the vector representation of the legal relationship by combining all samples in the support set corresponding to each legal relationship;

[0011] (1.4) Based on the legal relationship vector representation obtained in step (1.3) and the first initialization representation of the legal entity in step (1.2), a double-layer gating mechanism is used to recalculate the second vector representation of the legal entity from the perspectives of entity and relationship, and then calculate the enhanced third vector representation of the legal relationship, the third vector representation of the legal relationship being the few-sample legal relationship representation corresponding to the current task;

[0012] (1.5) Based on the legal relationship representation obtained in step (1.3), a conditional variational autoencoder is used to generate more supporting samples for the few-sample legal relationship of the current task, thereby further improving the generalization ability of the model for representing the few-sample legal relationship;

[0013] (1.6) Based on the representation of few-sample legal relations after model enhancement, knowledge reasoning about few-sample power grid laws is performed to obtain new knowledge about few-sample legal relations and complete the expansion of few-sample power grid legal knowledge.

[0014] Furthermore, the step (1.3) comprises the following steps:

[0015] (2.1) Using the triple data in the support set, the result of subtracting the head entity from the tail entity is multiplied by the multi-layer perceptron to obtain the result representing the legal relationship. Then, average pooling is used to calculate the average legal relationship representation of all triple data, denoted as r′;

[0016] (2.2) Use r′ in step (2.1) to calculate the gradient in the support set based on the loss function of TransE, and update r′ according to the gradient of r′ to obtain the relational representation r optimized by meta-learning meta The loss function of TransE is ||h+rt|| 2 , where h, r and t are the head legal entity, legal relationship and tail legal entity in the support set triple, respectively, ||*|| 2 is the second norm. The method to update r′ is r meta =r′-β×Grad(r′), where β is the learning rate and Grad(r′) is the gradient of r′;

[0017] Furthermore, the step (1.4) comprises the following steps:

[0018] (3.1) Using the vector representation of legal entities and legal relations, we can calculate the neighbor representation of legal entities. Assuming that the head legal entity of a triple is represented by h and the tail legal entity is represented by t, the representation information of the i-th neighbor of the head legal entity is calculated as where h i is the i-th neighbor legal entity of the head legal entity, r i h iThe legal relationship connected with h, is the splicing symbol, W gcn is a multi-layer perceptron;

[0019] (3.2) Use r in step (2.2) meta Calculate the first attention weight of the relationship’s impact on the head legal entity’s neighbors, use the first attention weight to aggregate the neighbor representations, and get the vector representation of the head legal entity’s considered relationship, denoted as h rel ;

[0020] (3.3) Use the tail entity to calculate the second attention weight of the entity’s influence on the head legal entity’s neighbors. Use the second attention weight to aggregate the neighbor representations to obtain the vector representation of the head legal entity’s considered entity, denoted as h ent ;

[0021] (3.4) Use the head legal entity to calculate the gating weight, and fuse the h in (3.2) according to the gating weight rel and h in (3.3) ent , obtain the fourth vector representation of the final head legal entity, where the calculation method of the tail legal entity representation is similar to that of the head legal entity. Finally, the enhanced legal head and tail entity pairs are used to represent the current few-sample legal relationship, and the fifth vector representation of the few-sample legal relationship is obtained;

[0022] Furthermore, the step (1.5) comprises the following steps:

[0023] (4.1) After obtaining the power grid legal relationship vector, assume that its representation characteristics in the latent vector space obey Gaussian distribution, and use the r obtained in step (2.2) meta Calculate the mean and variance as the conditional prior for the conditional variational autoencoder;

[0024] (4.2) Calculate the mean and variance based on the head and tail legal entity vectors in the support set as the variational posterior of the conditional variational autoencoder. Calculate the KL divergence loss of the variational autoencoder using the conditional prior in step (4.1) and the variational posterior in the current step;

[0025] (4.3) Based on the variational posterior obtained in step (4.2), calculate the likelihood estimates h′ and t′ for the legal head and tail entities in the support set. Use h′, t′ obtained in this step to calculate the reconstruction loss in the conditional variational autoencoder;

[0026] (4.4) Based on the loss function in step (4.2) and step (4.3), the conditional variational autoencoder is trained. When performing power grid legal knowledge reasoning with few-sample relations, the r in step (2.2) is used. metaCalculate the mean and variance, and based on the mean and variance, use the method in step (4.3) to generate additional head and tail legal entity samples corresponding to the current few-sample legal relationship, thereby completing the supplement of the current few-sample legal relationship information.

[0027] Beneficial effects: (1) Reduce the difficulty of existing systems in expressing complex relational semantic information in power grid law: The dual-layer attention gated network module proposed in this patent can consider the impact of neighbor information on the semantic representation of legal entities from both the entity and relationship aspects, obtain more comprehensive entity semantic information, use entity information to represent the semantic information of legal relationships, and reduce the difficulty of the model in expressing complex relational semantic information. (2) Provide accurate knowledge reasoning in small sample scenarios: By combining meta-learning and conditional variational autoencoders, this patent can obtain general legal knowledge (meta-information) across relationships through meta-learning, and use conditional variational autoencoders to generate support vectors for more few-sample relationships, thereby improving the model's ability to express few-sample relationships, improving the knowledge prediction accuracy of few-sample legal relationships, and ultimately improving the effect of expanding power grid legal knowledge. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is the overall principle diagram of the present invention;

[0029] Figure 2 It is an example graph of the aggregated neighbor information of the power grid legal knowledge triple entity;

[0030] Figure 2 (a) is an example of a triplet of legal knowledge about power grid;

[0031] Figure 2 (b) is an example of aggregating the defendant’s first-order neighbor information;

[0032] Figure 3 It is the structural diagram of the conditional variational autoencoder. DETAILED DESCRIPTION

[0033] The present invention is further explained below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

[0034] The present invention provides a few-sample power grid legal knowledge expansion method based on a double-layer attention gating mechanism and a conditional variational autoencoder. The method proposes a double-layer attention gating mechanism to consider the influence of legal entity neighbors on power grid legal entities from the two levels of entities and relationships, and improve the expression of complex semantic information of power grid legal entities. At the same time, the method combines meta-learning and conditional variational autoencoders to generate additional few-sample legal relationship sample vectors, enhancing the method's legal relationship modeling capabilities in few-sample scenarios. Through the above design, this patent can fully mine the complex semantic information in power grid legal entities and power grid legal relationships, improve the effect of power grid legal knowledge reasoning in few-sample scenarios, complete power grid legal knowledge expansion, and provide guarantees for subsequent practical applications.

[0035] The overall process of the present invention is as follows Figure 1 As shown in the figure, it includes 6 parts: the existing triple data with power grid legal knowledge are divided into different tasks according to the relationship. Each task corresponds to a specific legal relationship, including "support set" and "query set" data. Since the support set contains a small number of samples about the legal relationship, the legal relationship is also called a few-sample legal relationship; the graph structure information in the power grid legal knowledge triple is learned using TransE's graph representation learning method to obtain the first vector representation of the legal entity and the second vector representation of the legal relationship; based on the initialized legal entity and legal relationship vectors, the meta-learning training method is used to obtain the general legal relationship knowledge (meta-information) across different legal relationships, and then based on the support set samples corresponding to the specific relationship of each task, the vector representation of the legal relationship is calculated in combination with the meta-information; based on the legal relationship representation, the second vector representation of the legal entity is calculated using a double-layer attention gating mechanism, and the third vector representation of the legal relationship is recalculated using the second vector representation of the legal entity; the conditional variational autoencoder is combined to generate more support samples for the few-sample legal relationship; the expanded samples and the original samples are used to perform knowledge reasoning on the few-sample legal relationship to complete the knowledge expansion.

[0036] The specific implementation modes are described as follows:

[0037] 1. Task division of power grid legal knowledge triple data

[0038] Given the legal knowledge data of power grid, the data mainly stores knowledge in the form of triples, including power grid legal entities and power grid legal relations. The specific form of the triples is: (head entity, relationship, tail entity), and each relationship corresponds to multiple triple data. For a certain legal relationship, 8 data are randomly selected from all the triples corresponding to the legal relationship, of which 5 triples form the support set and the remaining 3 form the query set. A combination of the support set and the query set is taken as a task. The triple data of all legal relations are divided in the above manner to form a set of training tasks. Each task corresponds to a specific legal relationship, which is also called a few-sample legal relationship. The number of tasks divided for each legal relationship increases with the number of training rounds.

[0039] 2. Initialize the representation of legal entities and relationships

[0040] Assuming that the head legal entity, legal relationship and tail legal entity of the power grid legal knowledge triple are represented by symbols h, r and t respectively, this method uses a mainstream knowledge graph representation learning model - TransE's representation learning method to learn the vector representation of power grid legal entities and legal relationships. During the training process, the loss function h+r=t is used to constrain the model convergence, learn the complex semantic information contained in the triple data, and use this information to obtain the first vector representation of the power grid legal entity and the second vector representation of the legal relationship.

[0041] 3. Use meta-learning to calculate meta-information

[0042] For each triplet data in the support set of each task, the legal relationship representation corresponding to the task is calculated according to r = MLP (th), where MLP is a multi-layer perceptron. Then, average pooling is used to calculate the legal relationship representation based on all triples in the support set. The vector representation of the legal relationship containing meta-information is denoted as r′. Based on the head and tail legal entity pairs of all triples in the support set, the loss function L = ||h+r′-t|| is used. 2 Calculate the gradient of r′ Grad(r′), h and t are the head and tail legal entities in the triple, respectively, ||*|| 2 is the second norm, and the gradient is used to update r′ to obtain the legal relationship representation optimized by meta-information: meta =r′-β×Grad(r′), where β is the learning rate.

[0043] 4. Enhance the representation of legal entities in power grids using a gated network with a two-layer attention mechanism

[0044] The first-order neighbors and legal relationships around a legal entity constitute the semantic context of the legal entity. In order to more comprehensively express the semantic information contained in the legal entity of the power grid, it is necessary to use the semantic information of the first-order neighbor entities. It should be noted that different neighbors have different roles in expressing the semantic information of legal entities, and each neighbor has different roles in expressing different legal relationships. For example Figure 2 As shown in the figure, in the process of using the head legal entity (defendant) and a small number of sample legal relations (compensation) to predict the tail legal entity (plaintiff), the legal entity plaintiff and the legal relationship signed the contract, the legal entity power supply box and the legal relationship belong to the role in expressing the semantic information of the legal entity defendant is far greater than the legal entity Jiangsu and the legal relationship to which the place belongs.

[0045] Assume that the head legal entity in a legal relationship corresponding to a triple is represented as h, and the tail legal entity is represented as t. This method concatenates the legal entity of the ith neighbor of the legal entity with the legal relationship vector and sends it to the multi-layer perceptron for operation to obtain the representation of the neighbor legal entity, which is recorded as out i Then, this method uses the r calculated in step 3 meta Calculate the attention weights of the legal relationship on each neighbor of the legal entity h, and use this weight to aggregate the neighbor representations to obtain the representation h rel The specific calculation method is as follows:

[0046]

[0047] Where relu is the activation function, N is the number of neighbors of the legal entity h, and W rel is a multi-layer perceptron, h rel The head legal entity representation takes into account the influence of legal relations on the head legal entity's neighbors. Then this method uses the tail legal entity to calculate the attention weight of the legal entity's influence on the head legal entity. The specific calculation method is as follows:

[0048]

[0049] Where W ent is a multi-layer perceptron, h ent is the head legal entity representation that considers the influence of the tail legal entity on the head legal entity’s neighbors. Finally, this method uses the legal entity to be expressed h to calculate the gating weight and uses this weight to aggregate h rel and h ent , we get the fourth vector representation of the head legal entity h, and the specific calculation method is as follows:

[0050] h′=σ(W gate (h))·h ent +(1-σ(W gate (h)))·h rel

[0051] Where σ is the sigma activation function, W gate is a multi-layer perceptron, and h′ is the final representation of the head legal entity. It should be noted that the calculation method of the final vector representation of the tail legal entity t is similar to that of the head legal entity h. The enhanced tail legal entity minus the head legal entity in all triples of the support set is used, and the average of the calculation results is taken as the fifth vector representation of the few-sample legal relationship.

[0052] 5. Using Conditional Variational Autoencoders to Enhance Few-Shot Legal Relation Representation

[0053] In order to improve the robustness of representing few-sample legal relations, this method uses conditional variational autoencoders to enhance the representation of few-sample legal relations. Figure 3 After obtaining the power grid legal relationship vector, assuming that its representation characteristics in the latent vector space obey Gaussian distribution, use the r calculated in step 3 meta Calculate the mean and variance as the conditional prior for the conditional variational autoencoder: The mean and variance are calculated based on the vector representation of the head and tail legal entities in the support set as the variational posterior of the conditional variational autoencoder: Conv1D is a one-dimensional convolution operation; the KL divergence loss of the conditional variational autoencoder is calculated using the conditional prior and variational posterior: loss KL =KL(μ θ ,σ θ ||μ φ ,σ φ ); Compute the likelihood estimates of the head and tail legal entities in the support set based on the variational posterior: Where ε follows a standard Gaussian distribution, DeConv1d is an inverse one-dimensional convolution operation, h′ and t′ are estimates of the head and tail legal entities in the support set, and the likelihood estimate is used to fit the original head and tail legal entities in the support set, and the reconstruction loss of the conditional variational autoencoder is calculated; the conditional variational autoencoder is trained using the KL divergence loss and reconstruction loss; in the process of expanding the legal knowledge of the power grid, the r calculated in step 3 is used meta Calculate the mean and variance, sample from this distribution, and generate a distribution that satisfies the current relationship r meta The new head and tail legal entity pairs with characteristics are used to enhance the few-sample legal relationship samples.

[0054] 6. Carry out knowledge reasoning on the legal relationship of a small number of power grids and complete knowledge expansion

[0055] Specifically, the head and tail legal entity pairs generated in step 5 are used to enhance the few-shot legal relationship representation obtained in step 4. The tail legal entity is predicted based on the head legal entity and the legal relationship representation, and knowledge reasoning of the few-shot legal relationship is performed to complete knowledge expansion.

[0056] like Figure 2 (a) and Figure 2 As shown in (b), in order to expand the knowledge about the few-sample legal relationship "compensation", this method uses meta-learning to calculate the legal relationship meta-information using a small number of legal relationship triplets about "compensation". Based on the legal relationship meta-information, a gated network with a double-layer attention mechanism is used to aggregate the first-order neighbor information around the head legal entity "defendant", and identify the triple information that is closer to the semantics of the legal relationship "compensation": "power supply box, belongs to, *" and "plaintiff, signed the contract, *", enhance the expression of the legal entity "defendant" by the above information, and ignore the expression of the legal entity by information such as "legal representative" and "place of affiliation". Similarly, in the list of tail legal entities to be predicted, the first-order neighbor information around each legal entity is aggregated, and the tail legal entity with the highest matching score with the head legal entity in the list of legal entities to be predicted is selected: "plaintiff", and the triple prediction is completed, completing the knowledge expansion about the few-sample legal relationship "compensation".

Claims

1. A method for expanding legal knowledge of power grids with a small number of samples, characterized in that: The following steps are involved: (1.1) The training data set is divided into different tasks according to the legal relationship. Each task corresponds to a specific legal relationship and contains its own "support set" and "query set" data. The support set contains a small number of samples of the legal relationship. Therefore, the specific legal relationship corresponding to each task is also called a few-sample legal relationship. (1.2) Based on the structural semantic information in the power grid legal knowledge triples, the first vector representation of the legal entity and the second vector representation of the legal relationship are obtained using the representation learning method of TransE; (1.3) Based on the first vector representation and the second vector representation, using meta-learning to obtain general legal relationship knowledge across different legal relationships, the general legal relationship knowledge is meta-information, and using the meta-information to comprehensively calculate a third vector representation of the legal relationship for all samples in the support set corresponding to each legal relationship; (1.4) Based on the third vector representation and the first vector representation, a double-layer attention gating mechanism is used to recalculate the fourth vector representation of the legal entity from the two aspects of the legal entity and the legal relationship, thereby obtaining an enhanced fifth vector representation of the legal relationship, wherein the fifth vector representation is a few-sample legal relationship representation corresponding to the current task; (1.5) Based on the third vector representation, the conditional variational autoencoder is combined to generate more support samples for the few-sample legal relationship of the current task, thereby further improving the generalization ability of the model to represent the few-sample legal relationship; (1.6) Based on the model-enhanced representation of the few-sample legal relationship, knowledge reasoning about the few-sample legal relationship is performed to complete the expansion of the few-sample legal knowledge.

2. The method for expanding legal knowledge of power grids with a small number of samples according to claim 1 is characterized in that: The step (1.3) comprises the following steps: (2.1) Using each triple data in the support set, the result of subtracting the head entity from the tail entity is multiplied by the multi-layer perceptron. The calculated result represents the legal relationship. Then, average pooling is used to calculate the average legal relationship representation of all triple data in the support set to obtain the legal relationship meta-information r ′ ; (2.2) Using legal relationship meta-information r ′ The loss function based on TransE calculates the gradient in the support set according to r ′ The gradient of r ′ Update and obtain the legal relationship representation r optimized by using meta information meta ; The loss function of TransE is ||h+rt|| 2 ,h, r and t are the head legal entity, legal relationship and tail legal entity of the triple in the support set, respectively, ||*|| 2 is the second norm; the method for updating r′ is r meta =r′-β×Grad(r′), where β is the learning rate and Grad(r′) is the gradient of r′.

3. The method for expanding legal knowledge of power grids with a small number of samples according to claim 2 is characterized in that: The step (1.4) comprises the following steps: (3.1) Using the vector representation of legal entities and legal relations, we can calculate the neighbor representation of legal entities. Assume that the head legal entity of a triple is represented as h, the tail legal entity is represented as t, and the representation information of the i-th neighbor of the head legal entity is out i The calculation method is where h i is the i-th neighbor legal entity of the head legal entity, r i h i The legal relationship connected with h, is the splicing symbol, W gcn is a multi-layer perceptron; (3.2) Using the r meta Calculate the first attention weight of the relationship's impact on the head legal entity's neighbors, use the first attention weight to aggregate the head legal entity's neighbor information, and obtain the vector representation of the head legal entity's considered relationship, denoted as h rel ; (3.3) Use the tail legal entity to calculate the second attention weight of the entity’s influence on the head legal entity, and use the second attention weight to aggregate the neighbor information of the tail legal entity to obtain the vector representation of the entity considered by the tail legal entity, denoted as h ent ; (3.4) Use the head legal entity to calculate the gating weight, and fuse h according to the gating weight rel With h ent , and obtain the final fourth vector representation of the head legal entity; the calculation method of the tail legal entity representation is similar to that of the head legal entity; finally, the enhanced legal head and tail entity pairs are used to represent the current few-sample legal relationship, and the fifth vector representation of the enhanced few-sample legal relationship is obtained.

4. The method for expanding legal knowledge of power grids with a small number of samples according to claim 2 is characterized in that: The step (1.5) comprises the following steps: (4.1) Assuming that the representation characteristics of the third vector in the latent vector space obey Gaussian distribution, use the r meta Calculate the mean and variance as the conditional prior for the conditional variational autoencoder; (4.2) calculating the mean and variance based on the head legal entity and the tail legal entity as the variational posterior of the conditional variational autoencoder; calculating the KL divergence loss of the variational autoencoder using the calculated conditional prior and the variational posterior in the current step; (4.3) Based on the variational posterior, the first likelihood estimate h of the head legal entity is calculated ′ The second likelihood estimate of the legal entity with the tail t ′ , and calculate the reconstruction loss in the conditional variational autoencoder; (4.4) Based on the KL divergence loss and reconstruction loss, the conditional variational autoencoder is trained. When performing power grid legal knowledge reasoning on few-sample legal relations, the r meta The mean and variance are calculated, and based on the mean and variance, additional reasoning head legal entity samples and tail legal entity samples corresponding to the current few-sample legal relationship are generated, thereby completing the supplement of the current few-sample legal relationship information.