Method and system for constructing multivariate relational knowledge base
By constructing a multi-relationship prediction tensor model for the multi-relationship knowledge base, the problem of difficulty in processing multi-relationships in the existing technology is solved, efficient multi-relationship prediction and completion is achieved, and a complete multi-relationship knowledge base is constructed.
Patent Information
- Application Number
- CN202010306303.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-17
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-04-17
AI Technical Summary
Existing knowledge graph processing methods are difficult to effectively handle multivariate relationships. Traditional methods are limited to two-dimensional expression. Although tensor models can be expanded, they have insufficient expression capabilities or too many parameters.
Using the multi-relationship knowledge base construction method, by constructing a multi-relationship prediction tensor model, using training samples to train the model, predict and complete the missing entity elements in the multi-relationship knowledge base, and build a complete multi-relationship knowledge base.
It achieves efficient processing of multi-relationships, has sufficient expressive ability without requiring too many parameters, accurately predicts and completes the multi-groups in the knowledge base, and builds a complete multi-relationship knowledge base.
Smart Images

Figure CN111506742B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to knowledge graph technology in the field of artificial intelligence, and more specifically, to a method and system for constructing a multi-relational knowledge base. Background Art
[0002] With the rapid development of information network technology, various information network data content is showing an explosive growth trend. Such content is usually large-scale, heterogeneous and diverse, and has a loose organizational structure, which poses a challenge to people's effective acquisition of information and knowledge. Knowledge Graph (KG) is a knowledge base of semantic network that can use visualization technology to describe knowledge resources and their carriers, and mine, analyze, construct, draw and display knowledge and their connections.
[0003] Knowledge graphs, as a special graph structure with entities as nodes and relations as directed edges, have recently attracted a lot of interest. In common knowledge graphs, each edge is represented as a triple (s, r, o) of the form (head entity, relation, tail entity) to indicate that two entities s (i.e., head entity) and o (i.e., tail entity) are connected by a relation r, such as (NewYork, isLocatedIn, USA) to indicate that NewYork is located in the USA. Many large knowledge graphs have been built in the past few decades, such as WordNet, Freebase, DBpedia, and YAGO. They have improved various downstream applications, such as structured search, question answering, and entity recommendation.
[0004] However, existing knowledge graph processing methods are usually limited to two dimensions, such as a ternary relationship between three elements such as (relation, entity 1, entity 2), but such an expression is sometimes very limited. For example, a general purchase behavior can be a ternary relationship involving a buyer, an item, and a salesperson, but sports event awards usually involve a quaternary relationship such as an athlete, a team, an award, and a season. However, most traditional knowledge graph processing methods cannot be directly extended to multi-dimensional relationships (e.g., multi-dimensional relationships such as (relation, entity 1, entity 2, entity 3, ...)), and some tensor models (e.g., binary models based on Turker and CANDECOMP / PARAFAC (CP)) can be extended, but they have problems with insufficient expression or too many parameters.
[0005] Therefore, a model is needed that has sufficient expressive power but does not require too many parameters to process knowledge graphs with multivariate relationships. Summary of the invention
[0006] According to an embodiment of the present invention, a method for constructing a multivariate relational knowledge base is provided, the method comprising: constructing a multivariate relational prediction tensor model for a multivariate relational group in a multivariate relational knowledge base, and training the multivariate relational prediction tensor model using training samples obtained from the multivariate relational knowledge base, wherein the multivariate relational knowledge base has multiple multivariate relations, each multivariate is composed of a relation element and multiple entity elements, and the training samples are multivariate relations in the multivariate relational knowledge base that do not have missing entity elements; predicting and completing missing entity elements in multivariate relations with missing entity elements in the multivariate relational knowledge base based on the trained multivariate relational prediction tensor model; and constructing a complete multivariate relational knowledge base based on each multivariate with completed missing entity elements.
[0007] Optionally, the step of training the multivariate relationship prediction tensor model using the training samples obtained from the multivariate relationship knowledge base may include: initializing the model parameters of the multivariate relationship prediction tensor model; based on the initialized model parameters, performing at least one iterative update operation to update the model parameters. Each iterative update operation may include: selecting a predetermined number of training samples as a positive sample set and setting an initial loss parameter; for each positive sample in the positive sample set, performing an iterative loss update operation to update the loss parameter; updating the model parameter according to the loss gradient of the loss parameter. Each iterative loss update operation may include: constructing a negative sample set of the current positive sample in the positive sample set; using the estimated score function of the multivariate relationship prediction tensor model to calculate the score of the current positive sample and the negative sample constructed for the current positive sample, wherein the estimated score function is used to determine the probability of the existence of the estimated multivariate group; based on the calculated score, using the loss function of the multivariate relationship prediction tensor model to calculate the current loss parameter; determining the loss parameter obtained by the current iterative loss update operation based on the calculated current loss parameter and the loss parameter obtained by the previous iterative loss update operation.
[0008] Optionally, the scoring function can be expressed as:
[0009]
[0010] Among them, (i r ,i1,i2,...,i n ) represents the (n+1) tuple in the n-tuple relation knowledge base, i r Indicates the relation element in the (n+1) tuple and i r ∈Relational Domain i m Indicates the mth entity element in the (n+1) tuple and i m ∈Entity domain ε, is the relation element i rThe embedding vector of is the mth entity element i m The embedding vector of , and 1≤m≤n, n≥2 and m and n are positive integers,
[0011] in, Represents the (n+1)-order tensor corresponding to the n-ary relational knowledge base The (n+1)-order kernel tensor and Yes The k-order tensor obtained by reshaping is yes of (p1, p2, ..., p k ) elements and represents the jth 3rd-order TR implicit tensor and express The pth j cross-slice matrix and r = [r1, r2, ..., r k ] is a preset parameter used to indicate the size of the implicit tensor and r1=r k+1 , n j express The dimension of the second module, n e and n r Respectively represent the number of entity elements and relationship elements in the n-ary relationship knowledge base, d e and d r Respectively represent the dimensions of the embedding vectors of the entity elements and the embedding vectors of the relationship elements in the (n+1) tuple, k is a preset reshaped tensor order and k≥n+1, 1≤j≤k, j and k are positive integers.
[0012] Optionally, for the positive sample (i r ,i1,i2,...,i n ), a set of n groups of negative samples constructed in, Represents the entity element i in the entity domain ε and the positive sample q Another entity element that is different, Represents the set of training samples.
[0013] Optionally, the loss function can be expressed as:
[0014]
[0015] in,
[0016]
[0017] in, Indicates the replacement of positive samples (i r ,i1,i2,...,i n ), 1≤q≤n and q is a positive integer.
[0018] Optionally, the step of predicting and completing missing entity elements in a multi-tuple with missing entity elements in the multi-tuple relationship knowledge base based on a trained multi-tuple relationship prediction tensor model may include: predicting the entity element in the multi-tuple relationship knowledge base that is most likely to be the missing entity element in the multi-tuple with missing entity elements based on the scoring function; and using the predicted entity element to complete the missing entity elements in the multi-tuple with missing entity elements.
[0019] The method may further include: when the multivariate relational knowledge base includes multiple multivariate groups, extracting multiple sub-knowledge bases from the multivariate relational knowledge base so that the number of entity elements included in the multivariate groups in each sub-knowledge base is equal, and establishing a corresponding multivariate relational prediction tensor model for each sub-knowledge base.
[0020] According to another embodiment of the present invention, a multivariate relational knowledge base construction system is provided, the system comprising: a model construction device, configured to construct a multivariate relation prediction tensor model for a multivariate relational group in the multivariate relational knowledge base, and train the multivariate relation prediction tensor model using training samples obtained from the multivariate relational knowledge base, wherein the multivariate relational knowledge base has multiple multivariate relations, each multivariate is composed of a relationship element and multiple entity elements, and the training samples are multivariate relations in the multivariate relational knowledge base that do not have missing entity elements; a completion device, configured to predict and complete the missing entity elements in the multivariate relational group with missing entity elements in the multivariate relational knowledge base based on the trained multivariate relational prediction tensor model; and a knowledge base construction device, configured to construct a complete multivariate relational knowledge base based on each multivariate with the missing entity elements completed.
[0021] Optionally, the model building device may be configured to train the multivariate relationship prediction tensor model by the following operations: initializing the model parameters of the multivariate relationship prediction tensor model; based on the initialized model parameters, performing at least one iterative update operation to update the model parameters. Each iterative update operation may include: selecting a predetermined number of training samples as a positive sample set and setting an initial loss parameter; for each positive sample in the positive sample set, performing an iterative loss update operation to update the loss parameter; updating the model parameter according to the loss gradient of the loss parameter. Each iterative loss update operation may include: constructing a negative sample set of the current positive sample in the positive sample set; using the estimated score function of the multivariate relationship prediction tensor model to calculate the score of the current positive sample and the negative sample constructed for the current positive sample, wherein the estimated score function is used to determine the probability of the existence of the estimated multivariate group; based on the calculated score, using the loss function of the multivariate relationship prediction tensor model to calculate the current loss parameter; determining the loss parameter obtained by the current iterative loss update operation based on the calculated current loss parameter and the loss parameter obtained by the previous iterative loss update operation.
[0022] Optionally, the scoring function can be expressed as:
[0023]
[0024] Among them, (i r ,i1,i2,...,i n ) represents the (n+1) tuple in the n-tuple relation knowledge base, i r Indicates the relation element in the (n+1) tuple and i r ∈Relational Domain i m Indicates the mth entity element in the (n+1) tuple and i m ∈Entity domain ε, is the relation element i r The embedding vector of is the mth entity element i m The embedding vector of , and 1≤m≤n, n≥2 and m and n are positive integers,
[0025] in, Represents the (n+1)-order tensor corresponding to the n-ary relational knowledge base The (n+1)-order kernel tensor and Yes The k-order tensor obtained by reshaping is yes of (p1, p2, ..., pk ) elements and represents the jth 3rd-order TR implicit tensor and express The pth j cross-slice matrix and r = [r1, r2, ..., r k ] is a preset parameter used to indicate the size of the implicit tensor and r1=r k+1 , n j express The dimension of the second module, n e and n r Respectively represent the number of entity elements and relationship elements in the n-ary relationship knowledge base, d e and d r Respectively represent the dimensions of the embedding vectors of the entity elements and the embedding vectors of the relationship elements in the (n+1) tuple, k is a preset reshaped tensor order and k≥n+1, 1≤j≤k, j and k are positive integers.
[0026] Optionally, for the positive sample (i r ,i1,i2,...,i n ), a set of n groups of negative samples constructed in, Represents the entity element i in the entity domain ε and the positive sample q Another entity element that is different, Represents the set of training samples.
[0027] Optionally, the loss function can be expressed as:
[0028]
[0029] in,
[0030]
[0031] in, Indicates the replacement of positive samples (i r ,i1,i2,...,i n ), 1≤q≤n and q is a positive integer.
[0032] Optionally, the completion device can be configured to: predict the entity element in the multivariate relationship knowledge base that is most likely to be the missing entity element in the multivariate group with missing entity elements based on the scoring function; and use the predicted entity element to complete the missing entity element in the multivariate group with missing entity elements.
[0033] Optionally, the model building device can also be configured as: when the multivariate relationship knowledge base includes multiple multivariate groups, multiple sub-knowledge bases are extracted from the multivariate relationship knowledge base so that the number of entity elements included in the multivariate groups in each sub-knowledge base is equal, and a corresponding multivariate relationship prediction tensor model is established for each sub-knowledge base.
[0034] According to another embodiment of the present invention, a computer-readable storage medium storing instructions is provided, wherein when the instructions are executed by at least one computing device, the at least one computing device is prompted to execute the aforementioned multi-relational knowledge base construction method.
[0035] According to another embodiment of the present invention, a system is provided, which includes at least one computing device and at least one storage device storing instructions, wherein when the instructions are executed by the at least one computing device, the at least one computing device is prompted to execute the aforementioned multivariate relational knowledge base construction method.
[0036] Beneficial Effects
[0037] By applying the method and system for constructing a multivariate relational knowledge base according to an exemplary embodiment of the present invention, it is possible to establish a multivariate relational prediction tensor model with sufficient expressive power and without requiring too many parameters for link prediction (i.e., prediction of links between relationships and entities) for a knowledge graph with multivariate relations (hereinafter referred to as the multivariate relational knowledge base), thereby accurately predicting the missing entity elements of the multivariate groups in the knowledge base, thereby completing and constructing a complete multivariate relational knowledge base. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] These and / or other aspects and advantages of the present invention will become more clear and easier to understand from the following detailed description of the embodiments of the present invention in conjunction with the accompanying drawings, in which:
[0039] Figure 1 is a block diagram illustrating a multivariate relationship knowledge base construction system according to an exemplary embodiment of the present disclosure;
[0040] Figure 2 is a flowchart illustrating a method for constructing a multi-relation knowledge base according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the present invention, exemplary embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0042] Before starting the description of the inventive concept below, for ease of understanding, some parameter expressions used in this application will first be explained:
[0043] Multi-relational knowledge base (KB) is the abbreviation of knowledge graph composed of multi-tuples with multi-relationships.
[0044] Vectors are denoted by lowercase bold and matrices are denoted by uppercase bold.
[0045] - represents a tensor of order n, and Among them, I i represents the dimension of its i-th mode, 1≤i≤n, and i and n are both positive integers. In an exemplary embodiment of the present invention, an n-ary relational knowledge base can be represented as a binary-valued (n+1)-order tensor
[0046] n e , n r - respectively represent the number of entity elements e and relationship elements r in the multi-relation knowledge base, n e =|ε|,
[0047] ε-represents the relation domain for relation element r (i.e., ) and the entity domain for entity element e (i.e., e∈ε).
[0048] d e , d r - respectively represent the dimensions of the embedding vectors of entity elements and relationship elements in the multi-relational knowledge base.
[0049] E, R-represent the entity embedding vector matrix and the relationship embedding vector matrix, respectively, and the embedding vectors of entity elements and the embedding vectors of relationship elements constitute the columns of E and R, respectively.
[0050] -express of (i1, i2, ..., i n ) elements.
[0051] - means about The n-th order core tensor, and J i represents the dimension of its i-th module, 1≤i≤n, and i and n are both positive integers, J1,…,J n Usually smaller than I1,...,I n .
[0052] A (k) - represents the k-mode factor matrix, and - indicates A (k) The j-th column vector of .
[0053] - represents the k-th tensor ring (TR) latent tensor and
[0054] -express The i k a lateralslice matrix and
[0055] r = [r1, r2, ..., r n ] - used to indicate the size of the implicit tensor.
[0056] n k -express The dimension of the second modulus of .
[0057] o- represents vector outer product.
[0058] × n - represents the n-mode product of tensors.
[0059] <·> - represents multilinear dot product.
[0060] trace{·}- represents the matrix trace operator.
[0061] Furthermore, in the context of the present disclosure, parameters having the same expression form have the same definition.
[0062] Figure 1 is a block diagram illustrating a multi-relation knowledge base construction system 100 according to an exemplary embodiment of the present disclosure.
[0063] Reference Figure 1 According to an exemplary embodiment of the present disclosure, a multi-relation knowledge base construction system 100 includes: a model construction device 110 , a completion device 120 , and a knowledge base construction device 130 .
[0064] The model building device 110 according to an exemplary embodiment of the present invention can build a multivariate relationship prediction tensor model for a multivariate relationship knowledge base, and train the multivariate relationship prediction tensor model using a training sample obtained from the multivariate relationship knowledge base. Here, the multivariate relationship knowledge base may have multiple multivariate groups, each of which may be composed of a relationship element and multiple entity elements. In addition, the training sample may be a multivariate group in the multivariate relationship knowledge base that does not have a missing entity element.
[0065] In an exemplary embodiment of the present invention, the model building device 110 may use various algorithms (eg, stochastic gradient descent, proximal gradient descent, alternating direction multiplier algorithm, etc.) to train the multivariate relationship prediction tensor model.
[0066] As an example only, the model building device 110 may train the multivariate relationship prediction tensor model as shown in Algorithm 1 below. In Algorithm 1 below, an n-ary relationship database is used as an example for explanation. is the set of training samples, and the meanings of other parameters will be explained later below.
[0067]
[0068] Before explaining Algorithm 1, for ease of understanding, we first explain the definitions of some parameters and functions used in Algorithm 1. Here, the scoring function used in Algorithm 1 above can be expressed as:
[0069] In equation (1), (i r ,i1,i2,...,i n ) can represent the (n+1) tuple in the n-tuple relation knowledge base, i r can indicate the relation element in the (n+1) tuple and i r ∈Relational Domain i m It can indicate the mth entity element in the (n+1) tuple and i m ∈Entity domain ε, is the relation element i r The embedding vector of is the mth entity element i m The embedding vector of , and 1≤m≤n, n≥2, and m and n are positive integers.
[0070] also, Represents the (n+1)-order tensor corresponding to the n-ary relational knowledge base The (n+1)-order kernel tensor and Yes The k-order tensor obtained by reshaping is yes of (p1, p2, ..., p k ) elements and represents the jth 3rd-order TR implicit tensor and express The pth j cross-slice matrix and r = [r1, r2, ..., r k ] is a preset parameter used to indicate the size of the implicit tensor and r1=r k+1 , n j express The dimension of the second module, n e and n r Respectively represent the number of entity elements and relationship elements in the n-ary relationship knowledge base, d e and d r Respectively represent the dimensions of the embedding vectors of the entity elements and the embedding vectors of the relationship elements in the (n+1) tuple, k is a preset reshaped tensor order and k≥n+1, 1≤j≤k, j and k are positive integers.
[0071] In an exemplary embodiment of the present invention, the scoring function is used to determine the probability of the existence of the estimated multi-tuple. That is, when the estimated multi-tuple exists in the multi-tuple relationship knowledge base, the score determined by the scoring function is 1, and if the estimated multi-tuple does not exist, the score is 0. Therefore, in an exemplary embodiment of the present invention, the higher the score of the multi-tuple estimated by the scoring function, the greater the possibility that the multi-tuple exists in the knowledge base.
[0072] In addition, in the above algorithm 1, the negative samples in the negative sample set can be generated by changing a specific entity element in the positive sample (i.e., a multi-tuple without missing entity elements in the multi-tuple relational knowledge base) to another entity element in the entity domain. r ,i1,i2,...,i n ), a set of n groups of negative samples can be constructed here, It can represent the entity element i in the entity domain ε and the entity element i in the positive sample q Another different entity element (i.e., to replace i q To constitute the entity elements of negative samples), and the negative samples in the constructed negative sample set do not belong to the set
[0073] In addition, the loss function used in Algorithm 1 can be expressed as:
[0074]
[0075] in,
[0076]
[0077] In the above equation, Indicates the replacement of positive samples (i r ,i1,i2,...,i n ) is the set of negative samples obtained from the qth entity element in , 1≤q≤n and q is a positive integer. In other words,
[0078] It should be understood that the specific forms of the above-mentioned loss function and scoring function are merely examples, and the present application is not limited thereto. Various other forms of scoring functions and loss functions may also be used or set, as long as they can achieve the essential intent of the scoring function and loss function of the present application.
[0079] Therefore, as shown in the above algorithm 1, when training the multivariate relationship prediction tensor model, the model building device 110 may first randomly initialize the model parameters of the multivariate relationship prediction tensor model (line 1 in algorithm 1). Here, the model parameters may include the relationship embedding vector matrix R, the entity embedding vector matrix E, and the TR latent tensor
[0080] Afterwards, the model building device 110 may perform at least one iterative update operation (line 2 to line 10 in Algorithm 1) based on the initialized model parameters to update the model parameters, thereby implementing the training of the tensor model. Here, the number of iterative update operations (i.e., n epoch ) can be a preset number of times (for example, a number preset based on experience).
[0081] In an exemplary embodiment of the present invention, each iterative update operation (line 3 to line 10 in Algorithm 1) may include the following processing:
[0082] A) Select (e.g., sample) a predetermined number (i.e., m) of b ) as the positive sample set (i.e., the set S batch ), and the initial loss parameters can also be set at this time For example, set it to 0 (lines 3-4 in Algorithm 1, it should be understood that the execution order of the corresponding operations in these two lines can be set arbitrarily, and can be performed simultaneously or successively);
[0083] B) For each positive sample in the positive sample set, perform an iterative loss update operation (lines 5 to 9 in Algorithm 1) to update the loss parameter;
[0084] C) Loss gradient according to the loss parameter To update the model parameters (line 10 in Algorithm 1). Specifically, the loss gradient can be first calculated based on the loss parameter Then use gradient back propagation to update the model parameters. Here, the method of calculating the loss gradient and using the gradient to update the model parameters is known to those skilled in the art (for example, a gradient descent algorithm can be used), so for the sake of simplicity it will not be described in detail.
[0085] Here, each iterative loss update operation may include:
[0086] Construct a negative sample set of the current positive sample in the positive sample set (line 6 in Algorithm 1);
[0087] Use the score estimation function of the aforementioned multivariate relationship prediction tensor model to calculate the scores of the current positive sample and the negative sample constructed for the current positive sample (line 7 in Algorithm 1);
[0088] Based on the calculated score, the current loss parameter is calculated using the loss function of the multivariate relationship prediction tensor model (line 8 in Algorithm 1);
[0089] The loss parameter obtained by the current iterative loss update operation is determined based on the calculated current loss parameter and the loss parameter obtained by the last iterative loss update operation (i.e., the last iterative loss update operation performed on another positive sample in the positive sample set) (line 9 in Algorithm 1).
[0090] As described above, Algorithm 1 shows an example of using a mini-batch method to train a multivariate relationship prediction tensor model according to an exemplary embodiment of the present invention. However, it should be understood that the present application is not limited to this, and various other algorithms (for example, stochastic gradient descent, proximity gradient descent, alternating direction method of multipliers, etc.) may also be used to train the multivariate relationship prediction tensor model.
[0091] After completing the model training, the completion device 120 can predict and complete the missing entity elements in each multi-tuple with missing entity elements in the multi-tuple relationship knowledge base based on the trained multi-tuple relationship prediction tensor model.
[0092] Specifically, the completion device 120 can predict the entity element that is most likely to be the missing entity element in the multi-tuple with missing entity elements in the multi-tuple relationship knowledge base based on the aforementioned scoring function, and then use the predicted entity element to complete the missing entity element in the multi-tuple with missing entity elements.
[0093] That is, for example, the completion device 120 can use each entity element in the multi-relation knowledge base to complete the missing entity elements in the multi-tuple with missing entity elements, and then use the scoring function to calculate the score of such multi-tuple, and determine the entity element used when the score is the highest as the entity element ultimately used to complete the multi-tuple with missing entity elements.
[0094] Afterwards, the knowledge base construction device 130 may construct a complete multi-tuple relationship knowledge base based on each multi-tuple that completes the missing entity elements.
[0095] According to the multivariate relationship prediction tensor model in the exemplary embodiment of the present invention, not only can the multivariate group be completed when one entity element is missing in the multivariate group, but also the multivariate group can be completed when more than one entity element is missing in the multivariate group.
[0096] In addition, the above example describes the case where the multivariate relational knowledge base is an n-tuple relational knowledge base. However, the present application is not limited to this. When the multivariate relational knowledge base is a complex multivariate relational knowledge base that includes multiple tuples (for example, in addition to (n+1) tuples, it also includes other types of tuples such as n-tuples and (n-1)-tuples), the model building device 110 can first extract multiple sub-knowledge bases from the multivariate relational knowledge base so that the number of entity elements included in each tuple in each sub-knowledge base is equal (for example, the multivariate relational knowledge base is divided into an n-tuple relational sub-knowledge base, a (n-1)-tuple relational sub-knowledge base, and a (n-2)-tuple relational sub-knowledge base, etc.), and then establish a corresponding multivariate relational prediction tensor model for each sub-knowledge base. After that, the completion device 120 can use the multivariate relational prediction tensor model for each sub-knowledge base to complete the tuples in each sub-knowledge base, thereby ultimately achieving the completion and construction of the complex multivariate relational knowledge base.
[0097] Figure 2 is a flowchart illustrating a method for constructing a multi-relation knowledge base according to an exemplary embodiment of the present disclosure.
[0098] Reference Figure 2 In step S210, the model building device 110 may build a multivariate relationship prediction tensor model for a multivariate relationship knowledge base, and use a training sample obtained from the multivariate relationship knowledge base to train the multivariate relationship prediction tensor model. Here, the multivariate relationship knowledge base may have multiple multivariate relationships, each of which may be composed of a relationship element and multiple entity elements, and the training sample may be a multivariate relationship knowledge base that does not have a missing entity system element.
[0099] Then, in step S220, the completion device 120 may predict and complete the missing entity elements in the multi-tuple with missing entity elements in the multi-tuple knowledge base based on the trained multi-tuple relationship prediction tensor model.
[0100] Finally, in step S230 , the knowledge base construction device 130 may construct a complete multi-tuple relationship knowledge base based on each multi-tuple that completes the missing entity elements.
[0101] The above has been combined Figure 1 The specific process of the detailed operations performed by the above-mentioned constituent elements of the multi-relation knowledge base construction system 100 according to the exemplary embodiment of the present disclosure has been described in detail, and therefore, for the sake of brevity, it will not be repeated here.
[0102] In addition, according to the exemplary embodiment of the present disclosure, the method for constructing a multi-relational knowledge base can also use the multi-relational knowledge base obtained in step S230 to train a machine learning model to obtain a target machine learning model for performing at least one of relationship retrieval, semantic retrieval, intelligent retrieval, intelligent recommendation, intelligent question and answer, personalized recommendation, and content distribution, and the target machine learning model can be used to perform prediction tasks, wherein the prediction tasks include at least one of relationship retrieval, semantic retrieval, intelligent retrieval, intelligent recommendation, intelligent question and answer, personalized recommendation, and content distribution.
[0103] That is to say, the multi-relational knowledge base construction method and system of the exemplary embodiments of the present disclosure can be applied to various fields, such as relationship retrieval, semantic retrieval, intelligent retrieval, intelligent recommendation, intelligent question and answer, personalized recommendation, anti-fraud, content distribution, etc.
[0104] Just as an example, among the various application scenarios of the multi-relational knowledge base construction method and system according to the exemplary embodiments of the present disclosure, for example, for retrieval (such as relationship retrieval, semantic retrieval, intelligence, etc.), the relationship between them or the corresponding other entity can be retrieved by entering multiple keywords.
[0105] For example, for intelligent question answering, if you input "Which team is the champion of the 2018 World Cup?", the system will accurately return "France", thereby truly understanding the user's intention through the knowledge base.
[0106] For example, for anti-fraud, when the borrower's (entity) information is added to the knowledge base, by reading the relationship between the borrower and other people in the knowledge base, or whether the information they share is consistent, it can be determined whether there is a risk of fraud.
[0107] For example, for intelligent recommendation (e.g., personalized recommendation), similar content can be recommended to entities of a multi-tuple group with similar relationships. For example, for (Zhang San is a student of A High School Track and Field Team) (i.e., Zhang San is a student of A High School Track and Field Team), recommendations can be made to Zhang San based on the information of other A High School students in the knowledge base.
[0108] By applying the method and system for constructing a multivariate relational knowledge base according to an exemplary embodiment of the present invention, it is possible to accurately and quickly complete the missing entity elements in the multivariate relational knowledge base to construct a complete multivariate relational knowledge base, thereby further utilizing such a knowledge base to achieve more accurate prediction, recommendation and other effects.
[0109] The above has been referred to Figure 1 to Figure 2 A method and system for constructing a multivariate relational knowledge base according to an exemplary embodiment of the present disclosure are described. However, it should be understood that the devices and systems shown in the accompanying drawings may be configured as software, hardware, firmware, or any combination of the above items to perform specific functions. For example, these systems and devices may correspond to dedicated integrated circuits, pure software codes, or modules that combine software and hardware. In addition, one or more functions implemented by these systems or devices may also be uniformly executed by components in physical entity devices (e.g., processors, clients, or servers, etc.).
[0110] In addition, the above method can be implemented by instructions recorded on a computer-readable storage medium. For example, according to an exemplary embodiment of the present application, a computer-readable storage medium storing instructions can be provided, wherein, when the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the following steps: construct a multivariate relationship prediction tensor model for a multivariate relationship group in a multivariate relationship knowledge base, and train the multivariate relationship prediction tensor model using training samples obtained from the multivariate relationship knowledge base, wherein the multivariate relationship knowledge base has multiple multivariate groups, each of which is composed of a relationship element and multiple entity elements, and the training samples are multivariate groups in the multivariate relationship knowledge base that do not have missing relationship elements; predict and complete the missing entity elements in the multivariate relationship group with missing entity elements in the multivariate relationship knowledge base based on the trained multivariate relationship prediction tensor model; and construct a complete multivariate relationship knowledge base based on each multivariate group with completed missing entity elements.
[0111] The instructions stored in the computer-readable storage medium can be executed in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. It should be noted that the instructions can also be used to perform additional steps in addition to the above steps or perform more specific processing when performing the above steps. The contents of these additional steps and further processing have been described in reference to Figure 1 to Figure 2It is mentioned in the description of the related method, so it will not be repeated here to avoid repetition.
[0112] It should be noted that the multi-relational knowledge base construction system according to the exemplary embodiment of the present disclosure can completely rely on the operation of computer programs or instructions to realize corresponding functions, that is, each device corresponds to each step in the functional architecture of the computer program, so that the entire system is called through a special software package (for example, lib library) to realize the corresponding function.
[0113] On the other hand, when Figure 1 When the systems and devices shown are implemented in software, firmware, middleware, or microcode, the program code or code segments for performing the corresponding operations may be stored in a computer-readable medium such as a storage medium, so that at least one processor or at least one computing device may perform the corresponding operations by reading and running the corresponding program code or code segments.
[0114] For example, according to an exemplary embodiment of the present application, a system including at least one computing device and at least one storage device storing instructions may be provided, wherein the instructions, when executed by the at least one computing device, prompt the at least one computing device to perform the following steps: constructing a multivariate relationship prediction tensor model for a tuple in a multivariate relationship knowledge base, and training the multivariate relationship prediction tensor model using training samples obtained from the multivariate relationship knowledge base, wherein the multivariate relationship knowledge base has multiple tuples, each tuple consists of a relationship element and multiple entity elements, and the training samples are tuples in the multivariate relationship knowledge base that do not have missing relationship elements; predicting and completing missing entity elements in a tuple with missing entity elements in the multivariate relationship knowledge base based on the trained multivariate relationship prediction tensor model; and constructing a complete multivariate relationship knowledge base based on each tuple with completed missing entity elements.
[0115] Specifically, the above system can be deployed in a server or client, or on a node in a distributed network environment. In addition, the system can be a PC computer, a tablet device, a personal digital assistant, a smart phone, a web application or other device capable of executing the above instruction set. In addition, the system can also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, a mouse, a touch input device, etc.). In addition, all components of the system can be connected to each other via a bus and / or a network.
[0116] Here, the system is not necessarily a single system, but may be any collection of devices or circuits that can execute the above instructions (or instruction sets) individually or jointly. The system may also be part of an integrated control system or system manager, or may be configured as a portable electronic device that is interconnected with a local or remote (e.g., via wireless transmission) interface.
[0117] In the system, the at least one computing device may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller or a microprocessor. As an example and not limitation, the at least one computing device may also include an analog processor, a digital processor, a microprocessor, a multi-core processor, a processor array, a network processor, etc. The computing device may run instructions or codes stored in one of the storage devices, wherein the storage device may also store data. Instructions and data may also be sent and received over a network via a network interface device, wherein the network interface device may use any known transmission protocol.
[0118] The storage device may be integrated with the computing device, for example, RAM or flash memory is arranged within an integrated circuit microprocessor, etc. In addition, the storage device may include a separate device, such as an external disk drive, a storage array, or any other storage device that can be used by a database system. The storage device and the computing device may be operatively coupled, or may communicate with each other, such as through an I / O port, a network connection, etc., so that the computing device can read instructions stored in the storage device.
[0119] The above describes the exemplary embodiments of the present application. It should be understood that the above description is only exemplary and not exhaustive, and the present application is not limited to the disclosed exemplary embodiments. Without departing from the scope and spirit of the present application, many modifications and changes are obvious to those of ordinary skill in the art. Therefore, the scope of protection of the present application should be based on the scope of the claims.
Claims
1. A method for performing prediction based on a constructed multivariate relational knowledge base, the method comprising: Constructing a multivariate relationship prediction tensor model for a multivariate relationship group in a multivariate relationship knowledge base, and using training samples obtained from the multivariate relationship knowledge base to train the multivariate relationship prediction tensor model, wherein the multivariate relationship knowledge base is a knowledge graph composed of multiple multivariate groups, each multivariate group is composed of a relationship element and multiple entity elements, each relationship element and each entity element is text data, and the training samples are multivariate groups in the multivariate relationship knowledge base that do not have missing entity elements; Predicting and completing missing entity elements in a tuple with missing entity elements in the tuple knowledge base based on a trained multi-relation prediction tensor model, wherein the tuple with missing entity elements includes a tuple consisting of one relationship element and three or more entity elements; and Construct a complete multi-relation knowledge base based on each multi-group that completes the missing entity elements; Using the complete multivariate relational knowledge base as input data to train a machine learning model; Predicting the entity information and / or relationship information to be predicted based on the trained machine learning model to perform a prediction task; The prediction task includes at least one of the following items: relationship retrieval, semantic retrieval, intelligent retrieval, intelligent recommendation, intelligent question and answer, personalized recommendation, and content distribution.
2. The method of claim 1, wherein: The step of training the multivariate relationship prediction tensor model using training samples obtained from the multivariate relationship knowledge base comprises: Initialize the model parameters of the multivariate relationship prediction tensor model; Based on the initialized model parameters, performing at least one iterative update operation to update the model parameters, Each iterative update operation includes: Select a predetermined number of training samples as the positive sample set and set the initial loss parameter; For each positive sample in the positive sample set, perform an iterative loss update operation to update the loss parameter; The model parameters are updated according to the loss gradient of the loss parameters, Among them, each iterative loss update operation includes: Construct a negative sample set of the current positive sample in the positive sample set; Using the estimated score function of the multivariate relationship prediction tensor model to calculate the scores of the current positive sample and the negative sample constructed for the current positive sample, wherein the estimated score function is used to determine the probability of the existence of the estimated multivariate group; Based on the calculated score, using the loss function of the multivariate relationship prediction tensor model to calculate the current loss parameter; The loss parameter obtained by the current iterative loss update operation is determined based on the calculated current loss parameter and the loss parameter obtained by the previous iterative loss update operation.
3. The method of claim 2, wherein: The scoring function is expressed as: Among them, (i r ,i1,i2,…,i n ) represents the (n+1) tuple in the n-tuple relation knowledge base, i r Indicates the relation element in the (n+1) tuple and i r ∈Relational Domain i m Indicates the mth entity element in the (n+1) tuple and i m ∈Entity domain ε, is the relation element i r The embedding vector of is the mth entity element i m The embedding vector of , and 1≤m≤n, n≥2 and m and n are positive integers, in, Represents the (n+1)-order tensor corresponding to the n-ary relational knowledge base The (n+1)-order kernel tensor and Yes The k-order tensor obtained by reshaping is yes of (p1,p2,…,p k ) elements and represents the jth 3rd-order TR implicit tensor and express The pth j cross-slice matrix and r=[r1,r2,…,r k ] is a preset parameter used to indicate the size of the implicit tensor and r1=r k+1 , n j express The dimension of the second module, n e and n r Respectively represent the number of entity elements and relationship elements in the n-ary relationship knowledge base, d e and d r Respectively represent the dimensions of the embedding vectors of the entity elements and the embedding vectors of the relationship elements in the (n+1) tuple, k is a preset reshaped tensor order and k≥n+1, 1≤j≤k, j and k are positive integers.
4. The method of claim 3, wherein: For positive samples (i r ,i1,i2,…,i n ), a set of n groups of negative samples constructed in, Represents the entity element i in the entity domain ε and the positive sample q Another entity element that is different, Represents the set of training samples.
5. The method of claim 4, wherein: The loss function is expressed as: in, in, Indicates the replacement of positive samples (i r ,i1,i2,…,i n ), 1≤q≤n and q is a positive integer.
6. The method of claim 2, wherein: The step of predicting and completing missing entity elements in a multi-tuple with missing entity elements in the multi-tuple relationship knowledge base based on the trained multi-tuple relationship prediction tensor model includes: predicting, based on the scoring function, an entity element in the multi-tuple relational knowledge base that is most likely to be a missing entity element in the multi-tuple with missing entity elements; The predicted entity elements are used to complete missing entity elements in the tuple having missing entity elements.
7. The method of claim 1, further comprising: When the multivariate relational knowledge base includes multiple multivariate groups, multiple sub-knowledge bases are extracted from the multivariate relational knowledge base so that the number of entity elements included in the multivariate groups in each sub-knowledge base is equal, and a corresponding multivariate relational prediction tensor model is established for each sub-knowledge base.
8. A system for performing prediction based on a constructed multivariate relational knowledge base, the system comprising: A model building device is configured to build a multivariate relationship prediction tensor model for a multivariate relationship group in a multivariate relationship knowledge base, and train the multivariate relationship prediction tensor model using training samples obtained from the multivariate relationship knowledge base, wherein the multivariate relationship knowledge base is a knowledge graph composed of multiple multivariate groups, each multivariate group is composed of a relationship element and multiple entity elements, each relationship element and each entity element is text data, and the training sample is a multivariate group in the multivariate relationship knowledge base that does not have a missing entity element; a completion device configured to predict and complete missing entity elements in a tuple with missing entity elements in the tuple of the multivariate relation knowledge base based on a trained multivariate relation prediction tensor model, wherein the tuple with missing entity elements includes a tuple consisting of one relation element and three or more entity elements; and A knowledge base construction device configured to construct a complete multi-relation knowledge base based on each multi-group that completes the missing entity elements; A model training device configured to use the complete multivariate relationship knowledge base as input data to train a machine learning model; A prediction device is configured to predict the entity information and / or relationship information to be predicted based on the trained machine learning model to perform a prediction task; wherein the prediction task includes at least one of the following items: relationship retrieval, semantic retrieval, intelligent retrieval, intelligent recommendation, intelligent question and answer, personalized recommendation, and content distribution.
9. The system of claim 8, wherein: The model building device is configured to train the multivariate relationship prediction tensor model through the following operations: Initialize the model parameters of the multivariate relationship prediction tensor model; Based on the initialized model parameters, performing at least one iterative update operation to update the model parameters, Each iterative update operation includes: Select a predetermined number of training samples as the positive sample set and set the initial loss parameter; For each positive sample in the positive sample set, perform an iterative loss update operation to update the loss parameter; The model parameters are updated according to the loss gradient of the loss parameters, Among them, each iterative loss update operation includes: Construct a negative sample set of the current positive sample in the positive sample set; Using the estimated score function of the multivariate relationship prediction tensor model to calculate the scores of the current positive sample and the negative sample constructed for the current positive sample, wherein the estimated score function is used to determine the probability of the existence of the estimated multivariate group; Based on the calculated score, using the loss function of the multivariate relationship prediction tensor model to calculate the current loss parameter; The loss parameter obtained by the current iterative loss update operation is determined based on the calculated current loss parameter and the loss parameter obtained by the previous iterative loss update operation.
10. The system of claim 9, wherein: The scoring function is expressed as: Among them, (i r ,i1,i2,…,i n ) represents the (n+1) tuple in the n-tuple relation knowledge base, i r Indicates the relation element in the (n+1) tuple and i r ∈Relational Domain i m Indicates the mth entity element in the (n+1) tuple and i m ∈Entity domain ε, is the relation element i r The embedding vector of is the mth entity element i m The embedding vector of , and 1≤m≤n, n≥2 and m and n are positive integers, in, Represents the (n+1)-order tensor corresponding to the n-ary relational knowledge base The (n+1)-order kernel tensor and Yes The k-order tensor obtained by reshaping is yes of (p1,p2,…,p k ) elements and represents the jth 3rd-order TR implicit tensor and express The pth j cross-slice matrix and r=[r1,r2,…,r k ] is a preset parameter used to indicate the size of the implicit tensor and r1=r k+1 , n j express The dimension of the second module, n e and n r Respectively represent the number of entity elements and relationship elements in the n-ary relationship knowledge base, d e and d r Respectively represent the dimensions of the embedding vectors of the entity elements and the embedding vectors of the relationship elements in the (n+1) tuple, k is a preset reshaped tensor order and k≥n+1, 1≤j≤k, j and k are positive integers.
11. The system of claim 10, wherein: For positive samples (i r ,i1,i2,…,i n ), a set of n groups of negative samples constructed in, Represents the entity element i in the entity domain ε and the positive sample q Another entity element that is different, Represents the set of training samples.
12. The system of claim 11, wherein: The loss function is expressed as: in, in, Indicates the replacement of positive samples (i r ,i1,i2,…,i n ), 1≤q≤n and q is a positive integer.
13. The system of claim 9, wherein: The completion device is configured as: predicting, based on the scoring function, an entity element in the multi-tuple relational knowledge base that is most likely to be a missing entity element in the multi-tuple with missing entity elements; The predicted entity elements are used to complete missing entity elements in the tuple having missing entity elements.
14. The system of claim 8, wherein: The model building device is also configured to: When the multivariate relational knowledge base includes multiple multivariate groups, multiple sub-knowledge bases are extracted from the multivariate relational knowledge base so that the number of entity elements included in the multivariate groups in each sub-knowledge base is equal, and a corresponding multivariate relational prediction tensor model is established for each sub-knowledge base.
15. A computer-readable storage medium storing instructions, wherein: When the instructions are executed by at least one computing device, the at least one computing device is prompted to perform the method according to any one of claims 1 to 7.
16. A system comprising at least one computing device and at least one storage device storing instructions, wherein: When the instructions are executed by the at least one computing device, the at least one computing device is prompted to perform the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Complementing method and device for knowledge base
CN108304933A
