Knowledge graph completion methods, devices, electronic equipment and storage media
By generating feature vectors through segmentation and language representation models, and combining Euclidean distance algorithm and probability values, the problems of low efficiency and overfitting in security knowledge graph completion are solved, and efficient knowledge graph completion is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-22
- Publication Date
- 2026-03-13
AI Technical Summary
Existing methods for completing security knowledge graphs suffer from inefficiency and overfitting. In particular, distance-based models cannot effectively handle complex relationship patterns, while tensor decomposition-based models are prone to overfitting and fail to achieve optimal performance.
By segmenting the textual description information of the target elements in the complete triplet, the feature vectors of the remaining elements and missing triplets are generated using a language representation model. Combined with the Euclidean distance algorithm and probability values, the knowledge graph to be completed is then supplemented.
It improves the efficiency of knowledge graph completion tasks, accurately predicts the text description information of the elements to be completed, and solves the problems of low efficiency and overfitting in existing technologies.
Smart Images

Figure CN115563299B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of network security technology, and in particular to a knowledge graph completion method, apparatus, system, electronic device, and storage medium. Background Technology
[0002] Security knowledge graphs, as an efficient form of organizing security knowledge such as entities and concepts, can leverage their advantages in knowledge integration to organize scattered, multi-source, and heterogeneous security data, providing data analysis and knowledge reasoning support for threat modeling, risk analysis, and attack reasoning in the cybersecurity space. A security knowledge graph is a structured semantic knowledge base used to rapidly describe concepts and their relationships in the physical world.
[0003] Currently, knowledge graph completion for security knowledge graphs primarily employs two models: distance-based models and tensor decomposition-based models. For example, distance-based models use Minkowski distance to measure the reasonableness of triples, relying on a scoring function that cannot effectively handle complex relationship patterns. Alternatively, the latest Rotation Embedding (RotatE) model requires negative sampling during modeling, reducing the efficiency of the knowledge graph completion process. Tensor decomposition-based models often face severe overfitting issues during security knowledge graph completion, failing to achieve optimal performance.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] This disclosure provides a knowledge graph completion device, electronic device, and storage medium, which, at least in the process of completing a security knowledge graph, eliminates the need for negative sampling of samples and dependency on scoring functions, thus greatly improving the efficiency of knowledge graph completion tasks.
[0006] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0007] In a first aspect, embodiments of this disclosure provide a knowledge graph completion method, the method comprising:
[0008] Obtain the knowledge graph to be completed and the corresponding text description information of the knowledge graph to be completed; wherein, the knowledge graph to be completed contains: at least one complete triplet of the three elements and at least one missing triplet of the three elements containing the element to be completed;
[0009] In the text description information of each complete triplet, the text description information of the target element is segmented from the text description information of each complete triplet to obtain the text description information of the target element and the text description information of the remaining elements; the text description information of the remaining elements is the set of text description information remaining after the text description information of the complete triplet is segmented away from the text description information corresponding to the target element; the target element is the element in the complete triplet that has the same element type as the element to be completed.
[0010] The remaining element text description information is input into the trained language representation model to obtain the first feature vector corresponding to each remaining element text description information.
[0011] The text description information of each missing triplet is input into the trained language representation model to obtain the second feature vector and the first probability value corresponding to the text description information of each missing triplet; the first probability value is the probability value corresponding to each of the at least two text description information corresponding to the element to be completed in the missing triplet, obtained according to the language representation model.
[0012] The knowledge graph to be completed is completed based on the first feature vector, the second feature vector, and the first probability value.
[0013] In one embodiment of this disclosure, the step of completing the knowledge graph to be completed based on the first feature vector, the second feature vector, and the first probability value includes:
[0014] For any second feature vector, the nearest neighbor distance value between the second feature vector and each first feature vector is determined according to the Euclidean distance algorithm, and the target element text description information corresponding to the nearest neighbor distance value is determined.
[0015] Based on the nearest neighbor distance value and the target element text description information corresponding to the nearest neighbor distance value, determine the probability value corresponding to each type of target element text description information;
[0016] Based on the first probability value and the probability value corresponding to the text description information of each target element, the knowledge graph to be completed is supplemented.
[0017] In one embodiment of this disclosure, determining the nearest neighbor distance value between any second feature vector and each first feature vector according to the Euclidean distance algorithm includes:
[0018] According to the Euclidean distance algorithm, the distance between any second feature vector and each first feature vector is determined to obtain multiple feature vector distances;
[0019] The multiple feature vector distances are sorted, and a preset number of feature vector distances are selected as nearest neighbor distance values, starting with the smallest feature vector distance.
[0020] In one embodiment of this disclosure, determining the target element text description information corresponding to the nearest neighbor distance value includes:
[0021] Determine the first feature vector corresponding to the nearest neighbor distance value;
[0022] Based on the first feature vector corresponding to the nearest neighbor distance value, and the correspondence between each first feature vector and the remaining element text description information, the remaining element text description information corresponding to the nearest neighbor distance value is obtained;
[0023] Based on the pre-established correspondence between the target element text description information and the remaining element text description information, the target element text description information corresponding to the nearest neighbor distance value is determined.
[0024] In one embodiment of this disclosure, determining the probability value corresponding to each type of target element text description information based on the nearest neighbor distance value and the target element text description information corresponding to the nearest neighbor distance value includes:
[0025] For any target element text description information corresponding to any nearest neighbor distance value, the probability value of the target element text description information corresponding to any nearest neighbor distance value is determined by taking the any nearest neighbor distance value as the numerator and the sum of the nearest neighbor distance values as the denominator.
[0026] The probability values of the same target text description information are summed to obtain the probability value corresponding to each target element text description information.
[0027] In one embodiment of this disclosure, the step of completing the knowledge graph to be completed based on the first probability value and the probability value corresponding to the text description information of each target element includes:
[0028] Based on the probability value corresponding to each target element text description information and the first probability value, determine the second probability value corresponding to each of the at least two text description information corresponding to the element to be completed;
[0029] Sort the second probability values corresponding to each text description information of the element to be completed, and obtain the maximum probability value;
[0030] The text description information of the target element corresponding to the maximum probability value is used as the text description information of the element to be completed in the missing triplet corresponding to any second feature vector.
[0031] Complete the text description information of the elements to be completed in each missing triplet to complete the knowledge graph.
[0032] In one embodiment of this disclosure, determining the second probability value for each of the at least two text description information corresponding to the element to be completed, based on the probability value corresponding to each target element's text description information and the first probability value, includes:
[0033] Based on the product of the probability value corresponding to the text description information of the target element and the weight value corresponding to the probability value corresponding to the text description information of the target element, and the sum of the product of the first probability value and the weight value corresponding to the first probability value, the second probability value corresponding to each of the at least two text description information of the element to be completed is determined.
[0034] Secondly, embodiments of this disclosure provide a knowledge graph completion device, including:
[0035] The acquisition unit is used to acquire the knowledge graph to be completed and the text description information corresponding to the knowledge graph to be completed; wherein, the knowledge graph to be completed includes: at least one complete triplet of the three elements and at least one missing triplet of the three elements containing the element to be completed;
[0036] The segmentation unit is used to segment the text description information of the target element from the text description information of each complete triplet to obtain the text description information of the target element and the text description information of the remaining elements. The text description information of the remaining elements is the set of text description information remaining after the text description information of the complete triplet is segmented away from the text description information corresponding to the target element. The target element is the element in the complete triplet that has the same element type as the element to be completed.
[0037] The first model processing unit is used to input the remaining element text description information into the trained language representation model to obtain the first feature vector corresponding to each remaining element text description information.
[0038] The second model processing unit is used to input the text description information of each missing triplet into the trained language representation model to obtain the second feature vector and the first probability value corresponding to the text description information of each missing triplet; the first probability value is the probability value corresponding to each of the at least two text description information corresponding to the element to be completed in the missing triplet, obtained according to the language representation model.
[0039] The completion unit is used to complete the knowledge graph to be completed based on the first feature vector, the second feature vector, and the first probability value.
[0040] In one embodiment of this disclosure, the completion unit is further configured to:
[0041] For any second feature vector, the nearest neighbor distance value between the second feature vector and each first feature vector is determined according to the Euclidean distance algorithm, and the target element text description information corresponding to the nearest neighbor distance value is determined.
[0042] Based on the nearest neighbor distance value and the target element text description information corresponding to the nearest neighbor distance value, determine the probability value corresponding to each type of target element text description information;
[0043] Based on the first probability value and the probability value corresponding to the text description information of each target element, the knowledge graph to be completed is supplemented.
[0044] In one embodiment of this disclosure, the completion unit is further configured to:
[0045] According to the Euclidean distance algorithm, the distance between any second feature vector and each first feature vector is determined to obtain multiple feature vector distances;
[0046] The multiple feature vector distances are sorted, and a preset number of feature vector distances are selected as nearest neighbor distance values, starting with the smallest feature vector distance.
[0047] In one embodiment of this disclosure, the completion unit is further configured to:
[0048] Determine the first feature vector corresponding to the nearest neighbor distance value;
[0049] Based on the first feature vector corresponding to the nearest neighbor distance value, and the correspondence between each first feature vector and the remaining element text description information, the remaining element text description information corresponding to the nearest neighbor distance value is obtained;
[0050] Based on the pre-established correspondence between the target element text description information and the remaining element text description information, the target element text description information corresponding to the nearest neighbor distance value is determined.
[0051] In one embodiment of this disclosure, the completion unit is further configured to:
[0052] For any target element text description information corresponding to any nearest neighbor distance value, the probability value of the target element text description information corresponding to any nearest neighbor distance value is determined by taking the any nearest neighbor distance value as the numerator and the sum of the nearest neighbor distance values as the denominator.
[0053] The probability values of the same target text description information are summed to obtain the probability value corresponding to each target element text description information.
[0054] In one embodiment of this disclosure, the completion unit is further configured to:
[0055] Based on the probability value corresponding to each target element text description information and the first probability value, determine the second probability value corresponding to each of the at least two text description information corresponding to the element to be completed;
[0056] Sort the second probability values corresponding to each text description information of the element to be completed, and obtain the maximum probability value;
[0057] The text description information of the target element corresponding to the maximum probability value is used as the text description information of the element to be completed in the missing triplet corresponding to any second feature vector.
[0058] Complete the text description information of the elements to be completed in each missing triplet to complete the knowledge graph.
[0059] In one embodiment of this disclosure, the completion unit is further configured to:
[0060] Based on the product of the probability value corresponding to the text description information of the target element and the weight value corresponding to the probability value corresponding to the text description information of the target element, and the sum of the product of the first probability value and the weight value corresponding to the first probability value, the second probability value corresponding to each of the at least two text description information of the element to be completed is determined.
[0061] Thirdly, embodiments of this disclosure provide an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method described in the first aspect above by executing the executable instructions.
[0062] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect above.
[0063] Fifthly, according to another aspect of this disclosure, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the methods described in any of the preceding claims.
[0064] The knowledge graph completion method provided in this disclosure involves segmenting the text descriptions of complete triples and missing triples in the knowledge graph to be completed. This segmentation method extracts the text descriptions of target elements in the complete triples that have the same element type as the element to be completed in the missing triples. Then, a language representation model is used to process the text descriptions of the missing triples and the remaining elements obtained after segmentation, yielding a first feature vector corresponding to the remaining element text descriptions, a second feature vector corresponding to the missing triple text descriptions, and a first probability value. Finally, the knowledge graph to be completed is completed using the first and second feature vectors and the first probability value. This method, through segmentation, finds the correspondence between the text information of complete triples and missing triples, and the feature vectors obtained through the language representation model can accurately predict the text descriptions corresponding to the elements to be completed in the knowledge graph, thus completing the knowledge graph.
[0065] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0066] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0067] Figure 1 This diagram illustrates the structure of a knowledge graph completion system according to an embodiment of the present disclosure.
[0068] Figure 2 A flowchart illustrating a knowledge graph completion method according to an embodiment of this disclosure is shown.
[0069] Figure 3 A schematic diagram of a knowledge graph according to an embodiment of this disclosure is shown;
[0070] Figure 4 A schematic diagram illustrating textual description information of a knowledge graph according to an embodiment of this disclosure;
[0071] Figure 5 A flowchart illustrating the probability value of each text description information of the element to be completed in an embodiment of this disclosure is shown.
[0072] Figure 6 A flowchart illustrating another knowledge graph completion method in an embodiment of this disclosure is shown.
[0073] Figure 7 This diagram illustrates the structure of another knowledge graph completion device in an embodiment of this disclosure.
[0074] Figure 8 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0075] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0076] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0077] Currently, knowledge graph completion for security knowledge graphs primarily relies on two models: distance-based models and tensor decomposition-based models. For example, distance-based models use Minkowski distance to measure the validity of triples as a scoring function, which fails to effectively handle complex relationship patterns. Alternatively, the latest Rotation Embedding (Rotate) models require negative sampling during modeling, reducing the efficiency of knowledge graph completion. Tensor decomposition-based models often face severe overfitting issues during security knowledge graph completion, failing to achieve optimal performance.
[0078] Based on this consideration, this disclosure provides a knowledge graph completion method. For the textual descriptions of complete triples and missing triples in the knowledge graph to be completed, a segmentation method is used to extract the textual descriptions of elements in the complete triples that have the same element type as the element to be completed in the missing triples. Then, a language representation model is used to process the textual descriptions of the missing triples and the remaining elements obtained after segmentation, respectively, to obtain a first feature vector corresponding to the remaining element textual descriptions, a second feature vector corresponding to the missing triple textual descriptions, and a first probability value. Finally, the first and second feature vectors, along with the first probability value, are used to complete the knowledge graph to be completed. The method in this disclosure finds the correspondence between the textual information of complete triples and missing triples through segmentation, and the feature vectors obtained through the language representation model can accurately predict the textual descriptions of the elements to be completed in the knowledge graph, thus completing the knowledge graph.
[0079] The knowledge graph completion method disclosed herein can be applied to electronic devices as well as knowledge graph completion systems.
[0080] Figure 1 A schematic diagram is shown that can be applied to a knowledge graph completion system in embodiments of this disclosure.
[0081] like Figure 1 As shown, the knowledge graph completion system 100 may include a terminal device 101, a network 102, and a server 103.
[0082] Network 102 is a medium used to provide a communication link between terminal device 101 and server 103, and can be a wired network or a wireless network.
[0083] Optionally, the aforementioned wireless or wired networks use standard communication technologies and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to Local Area Networks (LANs), Metropolitan Area Networks (MANs), Wide Area Networks (WANs), mobile, wired or wireless networks, private networks, or any combination of virtual private networks. In some embodiments, technologies and / or formats including Hyper Text Markup Language (HTML), Extensible Markup Language (XML), etc., are used to represent data exchanged over the network. Furthermore, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Networks (VPNs), and Internet Protocol Security (IPsec) can be used to encrypt all or some links. In other embodiments, custom and / or dedicated data communication technologies can be used to replace or supplement the aforementioned data communication technologies.
[0084] Terminal device 101 can be various electronic devices, including but not limited to smartphones, tablets, laptops, desktop computers, wearable devices, augmented reality devices, virtual reality devices, etc.
[0085] Optionally, the client of the application installed on different terminal devices 101 may be the same, or the client of the same type of application based on different operating systems. Depending on the terminal platform, the specific form of the application client may also be different; for example, the application client may be a mobile client, a PC client, etc.
[0086] Server 103 can be a server that provides various services, such as a backend management server that supports the device operated by the user using terminal device 101. The backend management server can analyze and process received requests and other data, and feed the processing results back to the terminal device.
[0087] Optionally, the server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, and this disclosure does not impose any restrictions.
[0088] Those skilled in the art will know that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative; any number of terminal devices, networks, and servers can be included depending on actual needs. This disclosure does not limit the scope of the embodiments.
[0089] The following detailed description of this exemplary implementation method is provided in conjunction with the accompanying drawings and embodiments.
[0090] First, this embodiment of the disclosure provides a knowledge graph completion method, which can be executed by any electronic device with computing capabilities. In the following process, the electronic device is used as a server as an example.
[0091] Knowledge graphs are represented using triples (h, r, t), where h represents the head entity, r represents the relation, and t represents the tail entity. This can be understood as using three different elements to represent the relationships between certain data or information within the knowledge graph.
[0092] However, for some knowledge graphs, much implicit information between entities, relations, and tail entities remains unrepresented; for example, some triples are missing certain elements. Such knowledge graphs can be called incomplete knowledge graphs. This disclosure provides a knowledge graph completion method for the completion process of such incomplete knowledge graphs, the specific process of which is as follows:
[0093] Figure 2 A flowchart of a knowledge graph completion method according to an embodiment of this disclosure is shown, such as... Figure 2 As shown, the knowledge graph completion method provided in this embodiment includes the following steps:
[0094] S202: Obtain the knowledge graph to be completed and the corresponding text description information.
[0095] In one possible embodiment, the server obtains the knowledge graph to be completed. The knowledge graph to be completed includes: at least one complete triplet containing all three elements and at least one missing triplet containing the element to be completed.
[0096] After obtaining the knowledge graph to be completed, the text description information corresponding to the entities and relations in the knowledge graph is retrieved. The specific knowledge graph to be completed can be as follows: Figure 3 As shown.
[0097] The entity includes a head entity and a tail entity. The head entity can be... Figure 3 The entities in the dataset include User A, User B, and Supplier. The tail entity can be... Figure 3 The APP (application) 1, APP 2, etc.
[0098] pass Figure 3 The knowledge graph to be completed in the middle can yield information such as Figure 4 The text description information corresponding to the entities and relationships shown.
[0099] For example, user A installed APP1; the supplier owns APP1; the supplier owns APP2; user B accessed the app store; user B installed APP2; the app store listed APP2, etc. These are the textual descriptions corresponding to the complete triples.
[0100] In the knowledge graph to be completed, textual descriptions of missing triples can also be obtained. For example, "User B installed ?"; "App store listed ?". Since the textual description of the tail entity is not available, it is represented by a "?".
[0101] To complete the knowledge graph to be completed, it is necessary to determine the probability that there is an "installation" relationship between user B and APP1 before it can be determined whether a relationship can be established between user B and APP1 in the knowledge graph to be completed.
[0102] pass Figure 4 The text describes the entities and relations shown. It provides text descriptions of complete triples and missing triples.
[0103] For example, a complete triplet could be: (User A, Install, APP1); (Supplier, Own, APP1); (Supplier, Own, APP2); (User B, Obtain, App Store); (User B, Install, APP2); (App Store, List, APP2).
[0104] This explanation assumes only one missing triplet exists, and uses the element to be completed in the missing triplet as the tail entity, i.e., (User B, Install, ?). Here, the "?" in (User B, Install, ?) represents the element to be completed, and the "?" appearing in the following content also represents elements to be completed.
[0105] It should be noted that the missing triple can also be (User A, Install, ?), determining the probability that User A installed APP2 to complete the knowledge graph. It can also determine whether APP1 is available in the app store. Furthermore, the missing triple can also be (?, Install, APP1), determining which type of entity is missing from the head entity. However, in this knowledge graph, if User C installed APP3, the missing triple could include (?, Install, APP1), i.e., determining the probability that User A and User C installed APP1.
[0106] S204: In the text description information of each complete triple, the text description information of the target element is split from the text description information of each complete triple to obtain the text description information of the target element and the text description information of the remaining elements.
[0107] The remaining element text description information is the set of text description information remaining after the text description information of the complete triple is split off and the text description information corresponding to the target element is removed; the target element is the element with the same element type as the element to be completed in the complete triple.
[0108] In one possible embodiment, the text description information of all complete triples is processed by segmentation. For the three element types in the missing triples—head entity, relation, and tail entity—if the element to be completed in the missing triple is a tail entity, then the tail entity in the complete triple is segmented out according to the correspondence between the triples, resulting in two sets of text description information: the target element text description information and the remaining element text description information.
[0109] For example, the complete triples can be referred to as the dataset *train*, and the missing triples as the dataset *test*. The portion of the *train* dataset whose textual descriptions are tail entities is then split into target element textual descriptions and remaining element textual descriptions. The target element textual descriptions can be referred to as the dataset *target*, which is the set of textual descriptions for the target element, i.e., the tail entity. The remaining element textual descriptions can be referred to as the dataset *train* context, which is the set of textual descriptions for all elements in the complete triples except the target element; in this case, it is the set of textual descriptions for the head entity and the relation.
[0110] For example, in the complete triple (User A, Install, APP1), after splitting the text description information of the tail entity, the remaining element text description information is "User A installed". The resulting target element text description information is "APP1".
[0111] It should be noted that each head entity and relation in the remaining element text description information, as well as the tail entity included in the target element text description information, have corresponding relations. Since they are obtained through segmentation, they can still have corresponding relations even if no new correspondence is established after segmentation.
[0112] Here, after segmentation, a correspondence can be established between the head entity, relation, and tail entity that originally belonged to the same complete triple. This will facilitate finding the text description information of the tail entity in the target element's text description information based on the text description information of the head entity and relation in the remaining element's text description information.
[0113] S206: Input the remaining element text description information into the trained language representation model to obtain the first feature vector corresponding to each remaining element text description information.
[0114] In one possible embodiment, the dataset traincontext obtained in the above steps is processed by a language representation model to obtain the corresponding first feature vector k. i =f(c i ), where c i This represents the textual description information of the remaining elements. Here, the language representation model can be a pre-trained language representation model (Bidirectional Encoder Representation from Transformers, BERT).
[0115] For example, by inputting the remaining text description information "User A installed" into the BERT model, the first feature vector corresponding to "User A installed" can be obtained.
[0116] S208: Input the text description information of each missing triplet into the trained language representation model to obtain the second feature vector and the first probability value corresponding to the text description information of each missing triplet.
[0117] The first probability value is obtained from the language representation model, and is the probability value corresponding to each of the at least two text description information corresponding to the element to be completed in the missing triplet.
[0118] In one possible implementation, inputting the missing triplet text description "User B installed" into the BERT model yields the second feature vector q corresponding to "User B installed". i =f(x) i ), x i This represents the textual description information of the missing triples. This example only considers a single missing triple. If multiple missing triples exist, each missing triple is input into the BERT model for processing.
[0119] By inputting the textual description information of the missing triplet and all the possibilities of the tail entity into the BERT model, we can obtain the probability value of each of the at least two textual descriptions corresponding to the element to be completed in the missing triplet. Specifically, this can be understood as follows: the tail entity may correspond to at least two descriptions, and through the processing of the BERT model, we can obtain the probability value p of each description. LM (y|x), where y represents the probability value and x represents the text description information of each tail entity. For example, the probability value of tail entity APP1 is 2 / 9, and the probability value of APP2 is 1 / 9.
[0120] S210: Complete the knowledge graph to be completed based on the first feature vector, the second feature vector, and the first probability value.
[0121] In one possible implementation, the process of determining the probability value corresponding to each textual description of the element to be completed based on the aforementioned datasets train and test is as follows: Figure 5 As shown. Where S210 is used to determine the first feature vector k. i =f(c i ) and the second eigenvector q i =f(x) i After that, the process of determining the probability value corresponding to each text description information of the element to be completed.
[0122] For any second feature vector, the nearest neighbor distance between any second feature vector and each first feature vector is determined according to the Euclidean distance algorithm, and the target element text description information corresponding to the nearest neighbor distance value is determined. Based on the nearest neighbor distance value and the target element text description information corresponding to the nearest neighbor distance value, the probability value corresponding to each type of target element text description information is determined. Based on the first probability value and the probability value corresponding to each type of target element text description information, the knowledge graph to be supplemented is completed.
[0123] Specifically, the nearest neighbor distance value is determined as follows:
[0124] By using the Euclidean distance algorithm, the distance between any second feature vector and each first feature vector is determined, resulting in multiple feature vector distances. These multiple feature vector distances are then sorted, and a preset number of feature vector distances are selected as the nearest neighbor distance values, starting with the smallest feature vector distance.
[0125] For example, Euclidean distance is used to calculate the feature vector distance d(k) between the second feature vector corresponding to the missing triples in the test dataset and the first feature vector corresponding to the text description information of each remaining element in the training context dataset. i ,q i After determining the distances of multiple feature vectors, sort the distances of the feature vectors and select the three smallest distances of the feature vectors as the nearest neighbor distance values.
[0126] Here, we take the three feature vector distances with the smallest feature vector distances as examples: (User A, Installed, APP1); (Supplier, Owned, APP1); (Supplier, Owned, APP2) and the second feature vector corresponding to "User B installed". The distances are 2, 3 and 4 respectively.
[0127] After determining the nearest neighbor distance value, find the target element text description information in the dataset target corresponding to each nearest neighbor distance. The specific method for obtaining the target element text description information is as follows:
[0128] Determine the first feature vector corresponding to the nearest neighbor distance value. Based on the first feature vector corresponding to the nearest neighbor distance value and the correspondence between each first feature vector and the remaining element text description information, obtain the remaining element text description information corresponding to the nearest neighbor distance value. According to the pre-established correspondence between the target element text description information and the remaining element text description information, determine the target element text description information corresponding to the nearest neighbor distance value.
[0129] For example, after determining the nearest neighbor distance values 2, 3, and 4, the corresponding remaining element text description information is determined through the first feature vector, and then the corresponding target element text description information is determined through the remaining element text description information. The target element text description information corresponding to the nearest neighbor distance value 2 is APP1, the target element text description information corresponding to the nearest neighbor distance value 3 is APP1, and the target element text description information corresponding to the nearest neighbor distance value 4 is APP2.
[0130] After determining the nearest neighbor value of the second feature vector and the corresponding target element text description information through the above method, it is necessary to determine the probability value corresponding to each target element text description information. The specific method is as follows:
[0131] Based on the nearest neighbor distance value and the target element text description information corresponding to the nearest neighbor distance value, determine the probability value corresponding to each target element text description information.
[0132] For example, for any target element text description information corresponding to any nearest neighbor distance value, the probability value of the target element text description information corresponding to any nearest neighbor distance value is determined by taking any nearest neighbor distance value as the numerator and the sum of the nearest neighbor distance values as the denominator. The probability values of the same target text description information are summed to obtain the probability value corresponding to each type of target element text description information.
[0133] For example, the nearest neighbor distance values are 2, 3, and 4. Then, for example, the nearest neighbor distance value of 2 corresponds to the target element text description information APP1, and its probability value is 2 / 2+3+4=2 / 9.
[0134] After determining the probability value corresponding to the text description information of each target element, the probability values corresponding to the text description information of the same target element are summed, and the probability value corresponding to APP1 is 5 / 9, and the probability value corresponding to APP2 is 4 / 9.
[0135] For example, the probability value corresponding to the text description information of the target element is determined by the following formula:
[0136]
[0137] Where, p kNN (y|x) represents the probability value corresponding to the text description information of each target element; d(k i ,q i ) represents the first eigenvector k i Second eigenvector q i The distance between the eigenvectors; k i The target vector represents the first eigenvector. iy represents the text description information of the target element corresponding to each first feature vector; y represents the nearest neighbor distance value corresponding to the text description information of the target element corresponding to each first feature vector; x represents the text description information of each type of target element; i represents the number of text description information of each type of target element; KNN (K-Nearest Neighbors algorithm); exp represents the exponential operation; N represents the dataset of text description information of the target element corresponding to the nearest neighbor distance value.
[0138] For example, target1 can be understood as APP1 with a nearest neighbor distance value of 2; target2 can be understood as APP1 with a nearest neighbor distance value of 3.
[0139] Finally, based on the above formula, p can be determined. kNN (y|APP1)=5 / 9;p kNN (y|APP2)=4 / 9.
[0140] After determining the probability value corresponding to the text description information of each target element, the knowledge graph to be completed can be completed based on the first probability value and the probability value corresponding to the text description information of each target element. The specific method is as follows:
[0141] Based on the probability value corresponding to the text description information of each target element, and the first probability value, determine the second probability value corresponding to each of the at least two text description information of the element to be completed. Sort the second probability values corresponding to each text description information of the element to be completed to obtain the maximum probability value. Use the text description information of the target element corresponding to the maximum probability value as the text description information of the element to be completed in the missing triplet corresponding to any second feature vector. Complete the text description information of the element to be completed in each missing triplet to complete the knowledge graph to be completed.
[0142] For example, the second probability value corresponding to each of the at least two text descriptions of the element to be completed is determined in the following manner.
[0143] Based on the product of the probability value corresponding to the text description information of the target element and the weight value corresponding to the probability value of each target element text description information, and the sum of the product of the first probability value and the weight value corresponding to the first probability value, determine the second probability value corresponding to each of the at least two text description information of the element to be completed.
[0144] For example, the second probability value corresponding to each of the at least two text descriptions of the element to be completed can be determined by the following formula.
[0145] p(y|x)=λp kNN(y|x)+(1-λ)p LM (y|x)
[0146] Where p(y|x) represents the second probability value corresponding to each textual description of the element to be completed; λ represents the weight value; p kNN (y|x) represents the probability value corresponding to the text description information of each target element; p LM (y|x) represents the first probability value corresponding to each text description of the element to be completed; x represents each text description.
[0147] It should be noted that, in fact, there is a correspondence between the text description information of each target element and the text description information of the element to be completed.
[0148] Using the above method, we can obtain p(y|APP1) = 8 / 9; p(y|APP2) = 3 / 9.
[0149] By sorting the two probability values above, it is clear that the probability value corresponding to APP1 is the highest probability value. Therefore, APP1 is used as the text description information of the missing element to be completed in the missing triple (User B, Installation, ?), that is, the text description information of the tail entity.
[0150] The above method can be used to complete any missing triple. If the knowledge graph to be completed includes multiple missing triples, the same method can be reused for each missing triple.
[0151] The knowledge graph completion method disclosed herein not only utilizes a language representation model to process missing triples and directly obtain the textual description information of the element to be completed, but also cleverly leverages the correspondence between elements in complete and missing triples. It learns feature profiles of elements through complete triples and finds the feature vector closest to the feature of the element to be completed in the missing triples using nearest neighbor distance. This feature vector assists in completing the textual description information of the element to be completed. Furthermore, the entire process involves no complex computations and can handle complex logical relationships in knowledge graphs. It does not rely on negative sampling and scoring functions found in existing technologies, resulting in high efficiency in knowledge graph completion. It also utilizes textual description information between entities and relationships, improving the generalization ability of the knowledge graph completion task. Moreover, it avoids overfitting issues and effectively improves the performance of the security knowledge graph completion process.
[0152] In this disclosure Figure 6 A flowchart illustrating another knowledge graph completion method is shown, such as... Figure 6 As shown, it includes the following steps:
[0153] S602: Obtain the knowledge graph to be completed and the corresponding text description information.
[0154] S604: In the text description information of each complete triple, the text description information of the target element is split from the text description information of each complete triple to obtain the text description information of the target element and the text description information of the remaining elements.
[0155] S606: Input the remaining element text description information into the trained language representation model to obtain the first feature vector corresponding to each remaining element text description information.
[0156] S608: Input the text description information of each missing triplet into the trained language representation model to obtain the second feature vector and the first probability value corresponding to the text description information of each missing triplet.
[0157] S610: For any second feature vector, determine the nearest neighbor distance value between any second feature vector and each first feature vector according to the Euclidean distance algorithm, and determine the target element text description information corresponding to the nearest neighbor distance value.
[0158] S612: Based on the nearest neighbor distance value and the target element text description information corresponding to the nearest neighbor distance value, determine the probability value corresponding to each type of target element text description information.
[0159] S614: Based on the probability value corresponding to each target element's text description information and the first probability value, determine the second probability value corresponding to each of the at least two text description information for the element to be completed, and find the maximum probability value.
[0160] S616: Use the text description information of the target element corresponding to the maximum probability value as the text description information of the element to be completed in the missing triplet corresponding to any second feature vector, and complete the text description information of the element to be completed in each missing triplet to complete the knowledge graph to be completed.
[0161] Based on the same inventive concept, this disclosure also provides an apparatus, as shown in the following embodiment. Since the principle by which this apparatus solves the problem is similar to that of the method embodiment described above, the implementation of this apparatus embodiment can refer to the implementation of the method embodiment described above, and repeated details will not be elaborated further.
[0162] Figure 7 This diagram illustrates the structure of a knowledge graph completion device according to an embodiment of the present disclosure. Figure 7 As shown, the knowledge graph completion device 70 includes:
[0163] The acquisition unit 701 is used to acquire the knowledge graph to be completed and the corresponding text description information of the knowledge graph to be completed; wherein, the knowledge graph to be completed contains: at least one complete triplet of the three elements and at least one missing triplet of the three elements containing the element to be completed.
[0164] The segmentation unit 702 is used to segment the text description information of the target element from the text description information of each complete triplet to obtain the text description information of the target element and the text description information of the remaining elements. The text description information of the remaining elements is the set of text description information remaining after the text description information of the complete triplet is segmented to remove the text description information corresponding to the target element. The target element is the element in the complete triplet that has the same element type as the element to be completed.
[0165] The first model processing unit 703 is used to input the remaining element text description information into the trained language representation model to obtain the first feature vector corresponding to each remaining element text description information.
[0166] The second model processing unit 704 is used to input the text description information of each missing triplet into the trained language representation model to obtain the second feature vector and the first probability value corresponding to the text description information of each missing triplet; the first probability value is the probability value corresponding to each of the at least two text description information corresponding to the element to be completed in the missing triplet, obtained according to the language representation model.
[0167] The completion unit 705 is used to complete the knowledge graph to be completed based on the first feature vector, the second feature vector, and the first probability value.
[0168] In one embodiment of this disclosure, the completion unit 705 is further configured to:
[0169] For any second feature vector, the nearest neighbor distance value between any second feature vector and each first feature vector is determined according to the Euclidean distance algorithm, and the target element text description information corresponding to the nearest neighbor distance value is determined.
[0170] Based on the nearest neighbor distance value and the target element text description information corresponding to the nearest neighbor distance value, determine the probability value corresponding to each type of target element text description information;
[0171] Based on the first probability value and the probability value corresponding to the text description information of each target element, complete the knowledge graph to be completed.
[0172] In one embodiment of this disclosure, the completion unit 705 is further configured to:
[0173] Based on the Euclidean distance algorithm, the distance between any second feature vector and each first feature vector is determined, resulting in multiple feature vector distances.
[0174] Sort the distances of multiple feature vectors, and select a preset number of feature vector distances as the nearest neighbor distance values, starting with the smallest feature vector distance.
[0175] In one embodiment of this disclosure, the completion unit 705 is further configured to:
[0176] Determine the first feature vector corresponding to the nearest neighbor distance value;
[0177] Based on the first feature vector corresponding to the nearest neighbor distance value, and the correspondence between each first feature vector and the remaining element text description information, the remaining element text description information corresponding to the nearest neighbor distance value is obtained;
[0178] Based on the pre-established correspondence between the target element text description information and the remaining element text description information, determine the target element text description information corresponding to the nearest neighbor distance value.
[0179] In one embodiment of this disclosure, the completion unit 705 is further configured to:
[0180] For any target element text description information corresponding to any nearest neighbor distance value, take any nearest neighbor distance value as the numerator and the sum of the nearest neighbor distance values as the denominator to determine the probability value of the target element text description information corresponding to any nearest neighbor distance value.
[0181] The probability values of the same target text description information are summed to obtain the probability value corresponding to each target element text description information.
[0182] In one embodiment of this disclosure, the completion unit 705 is further configured to:
[0183] Based on the probability value corresponding to each target element's text description information, and the first probability value, determine the second probability value corresponding to each of the at least two text description information for the element to be completed;
[0184] Sort the second probability values corresponding to each text description of the element to be completed, and obtain the maximum probability value;
[0185] Use the text description information of the target element corresponding to the maximum probability value as the text description information of the element to be completed in the missing triplet corresponding to any second feature vector;
[0186] Complete the text description information of the missing elements in each triplet to complete the knowledge graph.
[0187] In one embodiment of this disclosure, the completion unit 705 is further configured to:
[0188] Based on the product of the probability value corresponding to the text description information of the target element and the weight value corresponding to the probability value corresponding to the text description information of the target element, and the sum of the product of the first probability value and the weight value corresponding to the first probability value, determine the second probability value corresponding to each of the at least two text description information of the element to be completed.
[0189] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."
[0190] The following reference Figure 8 To describe an electronic device 800 according to such an embodiment of the present disclosure. Figure 8 The electronic device 800 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0191] like Figure 8 As shown, the electronic device 800 is manifested in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processing unit 810, at least one storage unit 820, and a bus 830 connecting different system components (including storage unit 820 and processing unit 810).
[0192] The storage unit stores program code that can be executed by the processing unit 810, causing the processing unit 810 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 810 can perform the following steps in the above method embodiments, such as: Figure 2 The process of the knowledge graph completion method shown.
[0193] Storage unit 820 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include a read-only memory (ROM) 8203.
[0194] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0195] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0196] Electronic device 800 can also communicate with one or more external devices 840 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 800, and / or with any device that enables electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 850. Furthermore, electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 860. As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0197] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0198] Specifically, according to embodiments of this disclosure, the process described above with reference to the flowchart can be implemented as a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the knowledge graph completion method described above.
[0199] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.
[0200] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0201] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.
[0202] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0203] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0204] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0205] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0206] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0207] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
Claims
1. A knowledge graph completion method, characterized in that, The method comprises: acquiring a to-be-completed knowledge graph and text description information corresponding to the to-be-completed knowledge graph; wherein the to-be-completed knowledge graph comprises at least one complete triple containing three elements and at least one missing triple containing a to-be-completed element among the three elements; in the text description information of each complete triple, the text description information of a target element is segmented from the text description information of each complete triple to obtain target element text description information and remaining element text description information; the remaining element text description information is a set of remaining text description information after the text description information corresponding to the target element is segmented from the text description information of the complete triple; the target element is an element of the same element type as the to-be-completed element in the complete triple; inputting the remaining element text description information into a trained language representation model to obtain a first feature vector corresponding to each remaining element text description information in the remaining element text description information; inputting the text description information of each missing triple into the trained language representation model to obtain a second feature vector corresponding to the text description information of each missing triple and a first probability value; the first probability value is a probability value corresponding to each text description information of the to-be-completed element in the missing triple according to the language representation model; completing the to-be-completed knowledge graph according to the first feature vector, the second feature vector, and the first probability value; completing the to-be-completed knowledge graph according to the first feature vector, the second feature vector, and the first probability value comprises: for any one second feature vector, determining a nearest neighbor distance value between the any one second feature vector and each first feature vector according to the Euclidean distance algorithm, and determining target element text description information corresponding to the nearest neighbor distance value; determining a probability value corresponding to each target element text description information according to the nearest neighbor distance value, the target element text description information corresponding to the nearest neighbor distance value, and a sum of all nearest neighbor distance values; completing the to-be-completed knowledge graph according to the first probability value and the probability value corresponding to each target element text description information. 2.The knowledge graph completion method of claim 1, wherein, determining a nearest neighbor distance value between the any one second feature vector and each first feature vector according to the Euclidean distance algorithm for any one second feature vector comprises: determining a distance between the any one second feature vector and the each first feature vector according to the Euclidean distance algorithm to obtain a plurality of feature vector distances; sorting the plurality of feature vector distances and selecting a preset number of feature vector distances as nearest neighbor distance values based on the smallest feature vector distance as a starting point. 3.The knowledge graph completion method of claim 1, wherein, determining target element text description information corresponding to the nearest neighbor distance value comprises: determining a first feature vector corresponding to the nearest neighbor distance value; obtaining the remaining element text description information corresponding to the nearest neighbor distance value based on the first feature vector corresponding to the nearest neighbor distance value and the correspondence between each first feature vector and the remaining element text description information; determining the target element text description information corresponding to the nearest neighbor distance value according to the correspondence between the target element text description information and the remaining element text description information established in advance. 4.The knowledge graph completion method of claim 1, wherein, The method comprises the following steps: For the target element text description information corresponding to any one of the nearest neighbor distance values, the probability value of the target element text description information corresponding to the nearest neighbor distance value is determined by taking the nearest neighbor distance value as the numerator and the sum of the nearest neighbor distance values as the denominator; The probability values of the same target text description information are summed to obtain the probability value corresponding to each target element text description information. 5.The knowledge graph completion method of claim 1, wherein, The method comprises the following steps: According to the probability value corresponding to each target element text description information and the first probability value, the second probability value corresponding to each text description information in the at least two text description information corresponding to the element to be completed is determined. The maximum probability value is obtained by sorting the second probability value corresponding to each text description information of the element to be completed. The target element text description information corresponding to the maximum probability value is taken as the text description information of the element to be completed in the missing triple corresponding to the arbitrary second feature vector. The text description information of the element to be completed in each missing triple is completed, and the knowledge graph to be completed is completed. 6.The knowledge graph completion method of claim 5, wherein, The method comprises the following steps: According to the product of the probability value corresponding to the target element text description information and the weight value corresponding to the probability value corresponding to the target element text description information, and the sum of the product of the first probability value and the weight value corresponding to the first probability value, the second probability value corresponding to each text description information in the at least two text description information corresponding to the element to be completed is determined.
7. A knowledge graph completion apparatus, characterized by comprising: The device comprises: An acquisition unit is configured to acquire a knowledge graph to be completed and text description information corresponding to the knowledge graph to be completed; wherein the knowledge graph to be completed comprises at least one complete triple with complete elements and at least one missing triple with an element to be completed among the three elements. The cutting unit is configured to cut the text description information of the target element from the text description information of each complete triple to obtain the text description information of the target element and the text description information of the remaining elements in the text description information of the complete triple; the text description information of the remaining elements is a set of text description information remaining after the text description information corresponding to the target element is cut from the text description information of the complete triple; the target element is an element of the same element type as the element to be completed in the complete triple; The first model processing unit is configured to input the text description information of the remaining elements into a trained language representation model to obtain a first feature vector corresponding to each of the text description information of the remaining elements; The second model processing unit is configured to input the text description information of each missing triple into a trained language representation model to obtain a second feature vector corresponding to the text description information of each missing triple and a first probability value; the first probability value is a probability value corresponding to each text description information of at least two text description information of the element to be completed in the missing triple according to the language representation model; The completion unit is configured to complete the knowledge graph to be completed according to the first feature vector and the second feature vector, and the first probability value; The completion unit is further configured to determine, for any one second feature vector, a nearest neighbor distance value between the any one second feature vector and each first feature vector according to the Euclidean distance algorithm, and determine the target element text description information corresponding to the nearest neighbor distance value; determine a probability value corresponding to each target element text description information according to the nearest neighbor distance value, and the target element text description information corresponding to the nearest neighbor distance value and the sum of all nearest neighbor distance values; complete the knowledge graph to be completed according to the first probability value and the probability value corresponding to each target element text description information.
8. An electronic device, comprising: It comprises: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method of any one of claims 1-6 by executing the executable instructions.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1-6. The computer program is executed by the processor to implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Knowledge graph completion method and device, electronic equipment and storage medium
CN112000815A
Argo buoy long endurance energy consumption optimization and life estimation method
CN114462305A