WO2020224220A1 - 基于知识图谱的问答方法、电子装置、设备及存储介质 - Google Patents
基于知识图谱的问答方法、电子装置、设备及存储介质 Download PDFInfo
- Publication number
- WO2020224220A1 WO2020224220A1 PCT/CN2019/118003 CN2019118003W WO2020224220A1 WO 2020224220 A1 WO2020224220 A1 WO 2020224220A1 CN 2019118003 W CN2019118003 W CN 2019118003W WO 2020224220 A1 WO2020224220 A1 WO 2020224220A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- model
- question
- answer
- relationship
- final
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
Definitions
- This application relates to the field of intelligent technology, and in particular to a question and answer method, electronic device, equipment and storage medium based on a knowledge graph.
- QA system is a system used to answer natural language questions raised by people.
- One of the main reasons that hinder the improvement of algorithm accuracy is that for an entity in the graph, there are often hundreds of one-hop relationships connected to it. If multi-hop relationships are counted, the number will explode in geometric progression. Such a huge search space poses a huge challenge to the training of the model.
- a real question only corresponds to one relationship (or relationship string) in the knowledge graph.
- the algorithm generally takes this as a positive sample, and then selects other relationships corresponding to the entity by random sampling as a negative sample. However, when the ratio of positive and negative samples is unbalanced, the accuracy of the question answering system based on the knowledge graph is greatly reduced.
- this application proposes a question and answer method, electronic device, equipment and storage medium based on a knowledge graph, which can be used in the question answering system based on the knowledge graph by adding confrontation generation to the upper layer of the conventional deep network-based relation classification model Training effectively improves the accuracy of the model and makes the question and answer more accurate.
- this application proposes a question answering method based on a knowledge graph, which is applied to an electronic device.
- the method includes the steps of: determining that the first model after pre-training is a generator for generating a confrontation network; and determining pre-training
- the latter second model is a discriminator that generates a confrontation network; through the first model, the acquired question data input by the user is searched on the knowledge graph, and N question and answer relations connected by the question data are found, and the N question and answer relations
- the relationship and the real answer form a set of positive and negative sample groups;
- the confrontation generation network is trained according to the two-person zero-sum game through the first model and the second model, and the final model relationship is determined; the question data is passed according to the final model relationship
- the query map matches the final answer data.
- the present application also provides an electronic device, which includes: a first determining module adapted to determine that the first model after pre-training is a generator for generating a confrontation network; and a second determining module adapted to determine The second model after pre-training is a discriminator that generates a confrontation network;
- the query module is adapted to perform a knowledge graph query on the obtained question data input by the user through the first model, and find N question and answer relationships connected by the question data, And the N question and answer relationships and real answers form a set of positive and negative sample groups;
- the confrontation generation network module is suitable for training the confrontation generation network according to the two-person zero-sum game through the first model and the second model To determine the final model relationship;
- the matching module is suitable for matching the question data to the final answer data through the query map according to the final model relationship.
- this application also provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and running on the processor, and the processor executes the computer-readable instructions When implementing the steps of the above method.
- the present application also provides a non-volatile computer-readable storage medium on which computer-readable instructions are stored, and the computer-readable instructions implement the steps of the foregoing method when executed by a processor.
- FIG. 1 is an optional application environment diagram of the electronic device of the embodiment of the present application
- FIG. 2 is a schematic diagram of the hardware architecture of the electronic device according to the first embodiment of the present application.
- FIG. 3 is a schematic diagram of program modules of the electronic device according to the first embodiment of the present application.
- FIG. 4 is a schematic diagram of program modules of an electronic device according to a second embodiment of the present application.
- FIG. 5 is a schematic flowchart of a question and answer method based on a knowledge graph in the first embodiment of the present application
- Fig. 6 is a schematic flowchart of a question and answer method based on a knowledge graph in a second embodiment of the present application.
- FIG. 1 it is a schematic diagram of an optional application environment of the electronic device 20 of the present application.
- the electronic device 20 can communicate with the client 10 and the server 30 in a wired or wireless manner.
- the electronic device 20 obtains the voice input voice information of the user terminal 10 through the interface 23, obtains the response voice of the server 30 according to the obtained voice information, and performs voice playback on the user terminal 10 through the interface. , So as to realize the voice matching of the intelligent dialogue system.
- the virtual reality device 10 includes glasses, a helmet, a handle, and the like.
- the electronic device 20 may also be embedded in the client 10 or the server 30.
- FIG. 2 is a schematic diagram of an optional hardware architecture of the electronic device 20 of the present application.
- the electronic device 20 includes, but is not limited to, a memory 21, a processing 22, and an interface 23 that can communicate with each other through a system bus.
- FIG. 6 only shows the electronic device 20 with components 21-23, but it should be understood that it is not required All the illustrated components are implemented, and more or fewer components may be implemented instead.
- the memory 21 includes at least one type of readable storage medium, the readable storage medium includes flash memory, hard disk, multimedia card, card type memory (for example, SD or DX memory, etc.), random access memory (RAM), static memory Random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disks, optical disks, etc.
- the memory 21 may be an internal storage unit of the electronic device 20, such as a hard disk or a memory of the electronic device 20.
- the memory may also be an external storage device of the electronic device 20, for example, a plug-in hard disk equipped on the electronic device 20, a smart media card (SMC), a secure digital ( Secure Digital, SD card, Flash Card, etc.
- the memory 21 may also include both an internal storage unit of the electronic device 20 and an external storage device thereof.
- the memory 21 is generally used to store an operating system and various application software installed in the electronic device 20, such as the program code of the data visualization system 24.
- the memory 21 can also be used to temporarily store various types of data that have been output or will be output.
- the processor 22 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments.
- the processor 22 is generally used to control the overall operation of the electronic device 20.
- the processor 22 is used to run the program code or process data stored in the memory 21, for example, to run the intelligent dialogue system 24.
- the interface 23 may include a wireless interface or a wired interface, and the interface 23 is generally used to establish a communication connection between the electronic device 20 and other electronic devices.
- this application proposes an electronic device 20.
- FIG. 3 is a schematic diagram of the program modules of the electronic device according to the first embodiment of the present application.
- the electronic device 20 includes a series of computer-readable instructions stored on the memory 21.
- the knowledge-based instructions of the various embodiments of the present application can be implemented.
- the question and answer operation of the graph is a series of computer-readable instructions stored on the memory 21.
- the electronic device 20 may be divided into one or more modules based on specific operations implemented by the various parts of the computer-readable instructions. For example, in FIG. 3, the electronic device 20 may be divided into a first determination module 201, a second determination module 202, a query module 203, a confrontation generation network module 204, and a matching module 205. among them:
- the first determining module 201 is adapted to determine that the pre-trained first model is a generator for generating a confrontation network.
- the first determining module 201 models the joint probability. Specifically, the model is used to model the probability of whether the problem and the relationship are related, which represents the distribution of the data from a statistical perspective, and describes how the data is generated , The convergence speed is fast.
- the second determining module 202 is adapted to determine that the second pre-trained model is a discriminator for generating a confrontation network.
- the second determining module 202 models the conditional probability P(Y
- the second determination module 202 has achieved great success in the field of deep learning and even machine learning. Its essence is to map the feature vector of the sample to the corresponding label; and the generation model requires a lot of prior knowledge to model the real world, and The choice of the prior distribution directly affects the performance of the model.
- the query module 203 is adapted to perform a knowledge graph query on the acquired question data input by the user through the first model, find N question and answer relations connected by the question data, and form a set of the N question and answer relations and real answers Positive and negative sample group.
- the confrontation generation network module 204 is adapted to train the confrontation generation network according to the two-person zero-sum game through the first model and the second model, and determine the final model relationship.
- the matching module 205 is adapted to match the question data to the final answer data through the query map according to the final model relationship.
- adversarial generation training can be added to the upper layer of the conventional deep network-based relationship classification model to effectively improve the accuracy of the model and make the question answering more accurate.
- FIG. 4 is a schematic diagram of the program modules of the electronic device according to the second embodiment of the present application.
- the electronic device 20 includes a series of computer-readable instructions stored on the memory 21.
- the knowledge-based instructions of the various embodiments of the present application can be implemented.
- the question and answer operation of the graph is a series of computer-readable instructions stored on the memory 21.
- the electronic device 20 may be divided into one or more modules based on specific operations implemented by the various parts of the computer-readable instruction.
- the electronic device 20 can be divided into a first determination module 201, a second determination module 202, a query module 203, a confrontation generation network module 204, a matching module 205, an acquisition module 206, and a pre-training module 207. . among them:
- the obtaining module 206 is adapted to obtain question data corresponding to the natural query sentence input by the user.
- the pre-training module 207 is adapted to pre-train the first model and the second model of the neural network-based KGQA relationship classification model with preset training data.
- the network structures of the first model and the second model are different, the training data is randomly generated according to a preset ratio of positive and negative samples (such as 1:50), and the negative samples in the training data of the two models are sampled independently.
- the first determining module 201 is adapted to determine that the pre-trained first model is a generator for generating a confrontation network.
- the first determining module 201 models the joint probability. Specifically, the model is used to model the probability of whether the problem and the relationship are related, which represents the distribution of the data from a statistical perspective, and describes how the data is generated , The convergence speed is fast.
- the second determining module 202 is adapted to determine that the second pre-trained model is a discriminator for generating a confrontation network.
- the second determining module 202 models the conditional probability P(Y
- the second determination module 202 has achieved great success in the field of deep learning and even machine learning. Its essence is to map the feature vector of the sample to the corresponding label; and the generation model requires a lot of prior knowledge to model the real world, and The choice of the prior distribution directly affects the performance of the model.
- the query module 203 is adapted to perform a knowledge graph query on the acquired question data input by the user through the first model, find N question and answer relations connected by the question data, and form a set of the N question and answer relations and real answers Positive and negative sample group.
- the query module 203 is adapted to physically connect the obtained question data input by the user through the first model to find the corresponding subject entity, perform a knowledge graph query on the subject entity, and find N pieces of the question data connected Question answering relationship: N said question answering relationships and real answers are formed into a positive and negative sample group through the first model.
- the query module 203 is adapted to score the correlation with the question data on the N question-and-answer relationships through the first model; select the score ranking according to the result of the correlation score as the M with the preset ranking number.
- the query module 203 is adapted to physically connect the obtained question data input by the user through the first model to find the corresponding subject entity, perform a knowledge graph query on the subject entity, and find N pieces of the question data connected Question answering relationship: N said question answering relationships and real answers are formed into a positive and negative sample group through the first model. For example, knowing that the relationship between a user's question sentence and the graph has a matching probability, sampling can be done by probability, and focusing on high-quality negative samples can improve the quality of training.
- the entity connection step first finds the subject entity, and then queries the graph to find all the relationships it is connected to, and then the first model will score the relevance of these relationships to the question, and select the highest relevance score
- the first 51 of (if the answer is not included in the top 51, select the first 50, and then these 50 and the real answer form a positive and negative sample group).
- the second model is used as a discriminator to generate a confrontation network, and its task is to select the correct one among the 51 possible answers given.
- the first model has some data that is very close to the question. This makes the negative samples more difficult to be distinguished by the discriminator (second model) than simple random sampling, which makes the second model require Only by getting better can we complete the correct judgment.
- the confrontation generation network module 204 is adapted to train the confrontation generation network according to the two-person zero-sum game through the first model and the second model, and determine the final model relationship.
- the confrontation generation network module 204 is adapted to perform reinforcement learning of the policy gradient algorithm on the parameters of the first model and the second model; determine the first model or the model according to the reinforcement learning result of the policy gradient algorithm
- One of the second models is the final relationship classifier, and the final model relationship is determined.
- the confrontation generation network module 204 is adapted to perform reinforcement learning of the policy gradient algorithm on the parameters of the first model and the second model; determining the first model after the reinforcement learning of the policy gradient algorithm And the second model to reach the Nash equilibrium; according to the results of the first model and the second model, determine the optimal first model or the second model as the final relationship classifier, and determine the final model relationship.
- the training process of the confrontation generation network can be regarded as a two-person zero-sum game.
- the parameters of the first model and the second model finally reach the Nash equilibrium through the REINFORCE method.
- the training process of generating the first model and the second model of the confrontation network is a two-person zero-sum game, and the parameters of the first model and the second model need to be optimized through Reinforcement Learning.
- the parameters of the first model and the second model adopt Markov decision for the reinforcement learning of the gradient descent method of the strategy gradient algorithm, so that the first model as a generator has a better effect of M question answering relations (That is closer to the relationship between the real answer and the question), at the same time, the second model is used as a discriminator to accurately distinguish.
- the reinforcement learning of the strategy gradient algorithm is well known to those skilled in the art, and will not be described in detail here.
- the reinforcement learning based on the gradient descent method of the policy gradient algorithm enables the first model and the second model to reach a stable balance during the training of the confrontation generation network, that is, the data generated by the first model as the generator and the real The samples are indistinguishable, and the second model as a discriminator cannot correctly distinguish the generated data from the real data.
- the matching module 205 is adapted to match the question data to the final answer data through the query map according to the final model relationship.
- the matching module 205 determines the relationship according to the final model, combines the previously determined entities, finds the answer by querying the graph, and returns the answer to the user terminal.
- this application also proposes a question and answer method based on the knowledge graph.
- FIG. 5 is a schematic flowchart of the first embodiment of the question and answer method based on the knowledge graph of this application.
- the question answering method based on the knowledge graph is applied to the electronic device 20.
- the execution order of the steps in the flowchart shown in FIG. 5 can be changed, and some steps can be omitted.
- Step S500 Determine that the pre-trained first model is a generator for generating a confrontation network.
- the generator refers to a model that models the probability of whether the problem and the relationship are related, but the general generator may be a deep neural network, for example, and the specific content of the model is not limited in this embodiment.
- Step S501 Determine that the pre-trained second model is a discriminator for generating a confrontation network
- the discriminator is to model the conditional probability P(Y
- the discriminator is used to evaluate the degree of matching between the problem and the relationship.
- the discriminator and generator of this embodiment can be models with exactly the same structure (different parameters). ), playing different roles.
- Step S502 Perform a knowledge graph query on the obtained question data input by the user through the first model, find N question and answer relations connected by the question data, and form a set of positive and negative samples of the N question and answer relations and the real answers group;
- the obtained question data input by the user is entity-connected to find the corresponding subject entity through the first model, the subject entity is searched on the knowledge graph, and the N question-and-answer relationships connected by the question data are found;
- a model forms a set of positive and negative sample groups of N said question and answer relationships and real answers.
- Step S503 Train the confrontation generation network according to the two-person zero-sum game through the first model and the second model, and determine the final model relationship;
- step S504 the question data is matched to the final answer data through the query map according to the final model relationship.
- FIG. 6 is a schematic flowchart of the second embodiment of the question and answer method based on the knowledge graph of this application.
- the question answering method based on the knowledge graph is applied to the electronic device 20.
- the execution order of the steps in the flowchart shown in FIG. 6 can be changed, and some steps can be omitted.
- step S600 question data corresponding to several natural query sentences input by the user in history are extracted from the database.
- Step S601 Perform pre-training of preset training data on the first model and the second model of the KGQA relationship classification model based on the neural network.
- pre-training two different neural network-based KGQA relationship classification models is that the first model and the second model in the first model and the second model have different network structures, and the training data is based on the pre-trained The ratio of positive and negative samples (such as 1:50) is randomly generated, and the negative samples in the preset training data of the two models are sampled independently.
- Step S602 Determine that the pre-trained first model is a generator for generating a confrontation network
- the generator refers to a model that models the probability of whether the problem and the relationship are related, but the general generator may be, for example, a deep neural network, and the specific content of the model is not limited in this embodiment.
- Step S603 determining that the second model after pre-training is a discriminator for generating a confrontation network
- the discriminator is to model the conditional probability P(Y
- the discriminator is used to evaluate the degree of matching between the problem and the relationship.
- the discriminator and generator of this embodiment can be models with exactly the same structure (different parameters). ), playing different roles.
- Step S604 Use the first model to perform entity connection of the obtained question data input by the user to find a corresponding subject entity, perform a knowledge graph query on the subject entity, and find N question and answer relationships connected by the question data;
- the obtained question data input by the user is entity-connected to find the corresponding subject entity, the subject entity is searched on the knowledge graph, and the N of the question data is found.
- a question-and-answer relationship; N said question-and-answer relationships and real answers form a positive and negative sample group through the first model.
- step S605 the N question and answer relationships are scored for their relevance to the question data through the first model; specifically, for each question sentence, the entity connection step first finds the subject entity, and then queries the graph to find all the connected relationships , And then the first model will score the relevance of these relationships with questions.
- Step S606 According to the result of the correlation score, select the M question and answer relations whose score rank is before the preset number, where N>M.
- the second model is used as a discriminator to generate a confrontation network, and its task is to select the correct one among the 51 possible answers given.
- the first model has some data that is very close to the question. This makes the negative samples more difficult to be distinguished by the discriminator (second model) than simple random sampling, which makes the second model require Only by getting better can we complete the correct judgment.
- step S607 the M question and answer relationships and the real answers are formed into a positive and negative sample group through the first model.
- Step S608 Perform reinforcement learning of the strategy gradient algorithm on the parameters of the first model and the second model.
- Reinforcement learning is to learn the mapping relationship between state and behavior to maximize the numerical return. In other words, without knowing which behavior to take, the learner must find out which behavior can produce the greatest return through constant experimentation, that is, finally find that the first model and the second model can produce the greatest return.
- the training process of generating the first model and the second model of the confrontation network is a two-person zero-sum game, and the parameters of the first model and the second model need to be optimized through Reinforcement Learning.
- the parameters of the first model and the second model adopt Markov decision for the reinforcement learning of the gradient descent method of the strategy gradient algorithm, so that the first model as a generator has a better effect of M question answering relations (That is closer to the relationship between the real answer and the question), at the same time, the second model is used as a discriminator to accurately distinguish.
- the reinforcement learning of the strategy gradient algorithm is well known to those skilled in the art, and will not be described in detail here.
- Step S609 Determine that the first model and the second model after the reinforcement learning of the strategy gradient algorithm reach the Nash equilibrium.
- the reinforcement learning based on the gradient descent method of the policy gradient algorithm in step S608 enables the first model and the second model to reach a stable balance during the training of the confrontation generation network, that is, the first model is generated as a generator The data is indistinguishable from the real sample, and the second model as a discriminator cannot correctly distinguish the generated data from the real data.
- Step S610 According to the results of the first model and the second model, determine the optimal first model or the second model as the final relationship classifier, and determine the final model relationship.
- step S611 the question data is matched to the final answer data through the query graph according to the final model relationship. Specifically, the relationship is determined according to the final model, combined with the previously determined entities, the answer is found by querying the graph, and the answer is returned to the client.
- This application also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including independent servers, or more A server cluster composed of two servers), etc.
- the computer device in this embodiment at least includes, but is not limited to: a memory, a processor, etc. that can be communicatively connected to each other through a system bus.
- This embodiment also provides a non-volatile computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, server, App application mall, etc., on which storage There are computer-readable instructions, and the corresponding functions are realized when the program is executed by the processor.
- the non-volatile computer-readable storage medium of this embodiment is used to store the electronic device 20, and when executed by the processor, realizes the question and answer method based on the knowledge graph of the present application.
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种基于知识图谱的问答方法、电子装置(20)、设备及存储介质,能够在基于知识图谱的问答系统中,通过在常规的基于深度网络的关系分类模型的上层加入对抗生成训练,有效地提升模型精度,使得问答更加准确。以及由于实际应用中限于效率的要求,不可能进行多个模型的集成。这就要进行模型选择,但是有时模型的表现比较接近,这时可以通过对抗训练,来看模型两两对抗的结果,选取更加鲁棒的模型来使用,大大地降低了研发成本。
Description
本申请要求于2019年5月7日提交中国专利局,专利名称为“基于知识图谱的问答方法、电子装置、设备及存储介质”,申请号为201910376927.8的发明专利的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及智能技术领域,尤其涉及一种基于知识图谱的问答方法、电子装置、设备及存储介质。
随着计算机技术的普及,当今人们的生活已经逐渐走入智能时代。不仅仅是电脑,手机,PAD,人们的衣食住行的方方面面都开始应用出现不久的智能技术,智能电视,智能导航,智能家居等等,智能技术将在人们生活的各个方面提供方便快捷的服务。问答系统(Question Answering system,QA system)是用来回答人提出的自然语言问题的系统。
发明人发现基于知识图谱的问答系统(KGQA)越来越受到重视,目前尚处于研究与探索阶段。主要原因是算法研究还刚起步,模型表现仍然有待提高。阻碍算法精度提高的一个主要原因是:对于图谱中一个实体,其所连接的一跳关系往往以百计,如果算上多跳关系,数量将是几何级数爆炸式增多。这样巨大的搜索空间,对模型的训练提出了巨大挑战。问答数据集中,一个真实问句,只对应知识图谱中的一个关系(或关系串)。算法一般以此为正样本,然后以随机采样的方式选取实体对应的其他关系,来作为负样本。然而,当正负样本的比例失衡的情况下,基于知识图谱的问答系统的问答结果准确率大大地降低。
发明内容
有鉴于此,本申请提出一种基于知识图谱的问答方法、电子装置、设备及存储介质,能够在基于知识图谱的问答系统中,通过在常规的基于深度网络的关系分类模型的上层加入对抗生成训练,有效地提升模型精度,使得问答更加准确。
首先,为实现上述目的,本申请提出一种基于知识图谱的问答方法,应用于电子装置中,该方法包括步骤:确定预训练后的第一模型为生成对抗网络的生成器;及确定预训练 后的第二模型为生成对抗网络的判别器;通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组;通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系;根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
此外,为实现上述目的,本申请还提供一种电子装置,其包括:第一确定模块,适于确定预训练后的第一模型为生成对抗网络的生成器;第二确定模块,适于确定预训练后的第二模型为生成对抗网络的判别器;查询模块,适于通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组;对抗生成网络模块,适于通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系;匹配模块,适于根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
为实现上述目的,本申请还提供一种计算机设备,包括存储器、处理器以及存储在存储器上并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述方法的步骤。
为实现上述目的,本申请还提供非易失性计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述方法的步骤。
图1是本申请实施例之电子装置一可选的应用环境图;
图2是本申请第一实施例之电子装置的硬件架构示意图;
图3是本申请第一实施例之电子装置的程序模块示意图;
图4是本申请第二实施例之电子装置的程序模块示意图;
图5是本申请第一实施例之基于知识图谱的问答方法的流程示意图;
图6是本申请第二实施例之基于知识图谱的问答方法的流程示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
参阅图1所示,是本申请电子装置20一可选的应用环境示意图。
本实施例中,所述电子装置20可通过有线或无线方式与用户端10以及服务器30进行通信。所述电子装置20通过接口23获取所述用户端10的语音输入语音信息,根据获取到的语 音信息获取服务器30的回应语音,并将所述回应语音通过接口于所述用户端10进行语音播放,从而实现智能对话系统的语音匹配。所述虚拟现实设备10包括眼镜、头盔以及手柄等。所述电子装置20还可以是嵌入在用户端10或服务器30。
参阅图2所示,是本申请电子装置20一可选的硬件架构示意图。电子装置20包括,但不仅限于,可通过系统总线相互通信连接存储器21、处理22以及接口23,图6仅示出了具有组件21-23的电子装置20,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
所述存储器21至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器21可以是所述电子装置20的内部存储单元,例如该电子装置20的硬盘或内存。在另一些实施例中,所述存储器也可以是所述电子装置20的外部存储设备,例如该电子装置20上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器21还可以既包括所述电子装置20的内部存储单元也包括其外部存储设备。本实施例中,所述存储器21通常用于存储安装于所述电子装置20的操作系统和各类应用软件,例如数据可视化系统24的程序代码等。此外,所述存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。
所述处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制所述电子装置20的总体操作。本实施例中,所述处理器22用于运行所述存储器21中存储的程序代码或者处理数据,例如运行所述智能对话系统24等。
所述接口23可包括无线接口或有线接口,该接口23通常用于在所述电子装置20与其他电子设备之间建立通信连接。
至此,己经详细介绍了本申请相关设备的硬件结构和功能。下面,将基于上述介绍提出本申请的各个实施例。
首先,本申请提出一种电子装置20。
第一实施例
参阅图3所示,是本申请第一实施例之电子装置的程序模块示意图。
本实施例中,所述电子装置20包括一系列的存储于存储器21上的计算机可读指令指 令,当该计算机可读指令指令被处理器22执行时,可以实现本申请各实施例的基于知识图谱的问答操作。
在一些实施例中,基于该计算机可读指令指令各部分所实现的特定的操作,电子装置20可以被划分为一个或多个模块。例如,在图3中,所述电子装置20可以被分割成第一确定模块201、第二确定模块202、查询模块203、对抗生成网络模块204、匹配模块205。其中:
第一确定模块201,适于确定预训练后的第一模型为生成对抗网络的生成器。
具体地,第一确定模块201,对联合概率进行建模,具体的是通过对问题和关系是否相关的概率进行建模的模型,从统计的角度表示数据的分布情况,刻画数据是如何生成的,收敛速度快。
第二确定模块202,适于确定预训练后的第二模型为生成对抗网络的判别器。
具体地,第二确定模块202,对条件概率P(Y|X)进行建模,具体地是评价问题与关系的匹配程度。
第二确定模块202在深度学习乃至机器学习领域取得了巨大成功,其本质是将样本的特征向量映射成对应的label;而生成模型由于需要大量的先验知识去对真实世界进行建模,且先验分布的选择直接影响模型的性能。
查询模块203,适于通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组。
对抗生成网络模块204,适于通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系。
匹配模块205,适于根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
通过本实施例,能够在基于知识图谱的问答系统中,通过在常规的基于深度网络的关系分类模型的上层加入对抗生成训练,有效地提升模型精度,使得问答更加准确。
第二实施例
参阅图4所示,是本申请第二实施例之电子装置的程序模块示意图。
本实施例中,所述电子装置20包括一系列的存储于存储器21上的计算机可读指令指令,当该计算机可读指令指令被处理器22执行时,可以实现本申请各实施例的基于知识图谱的问答操作。
在一些实施例中,基于该计算机可读指令指令各部分所实现的特定的操作,电子装置 20可以被划分为一个或多个模块。例如,在图4中,所述电子装置20可以被分割成第一确定模块201、第二确定模块202、查询模块203、对抗生成网络模块204、匹配模块205、获取模块206、预训练模块207。其中:
获取模块206,适于获取用户输入的自然查询语句对应的问题数据。
预训练模块207,适于对基于神经网络的KGQA关系分类模型的所述第一模型和所述第二模型进行预置训练数据的预训练。
具体地,第一模型和第二模型的网络结构不同,训练数据按照预置正负样本比例(如1:50)随机生成,两个模型的训练数据中的负样本采样是独立进行的。
第一确定模块201,适于确定预训练后的第一模型为生成对抗网络的生成器。
具体地,第一确定模块201,对联合概率进行建模,具体的是通过对问题和关系是否相关的概率进行建模的模型,从统计的角度表示数据的分布情况,刻画数据是如何生成的,收敛速度快。
第二确定模块202,适于确定预训练后的第二模型为生成对抗网络的判别器。
具体地,第二确定模块202,对条件概率P(Y|X)进行建模,具体地是评价问题与关系的匹配程度。
第二确定模块202在深度学习乃至机器学习领域取得了巨大成功,其本质是将样本的特征向量映射成对应的label;而生成模型由于需要大量的先验知识去对真实世界进行建模,且先验分布的选择直接影响模型的性能。
查询模块203,适于通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组。
在一实施例中,查询模块203,适于通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;通过第一模型将N个所述问答关系与真实答案组成一组正负样本组。
在另一实施例中,查询模块203,适于通过第一模型对N个所述问答关系进行与问题数据的相关性评分;根据相关性评分的结果选取分数排名为预置排名数前的M个问答关系,其中,N>M;通过第一模型将M个所述问答关系与真实答案组成一组正负样本组。
在一实施例中,查询模块203,适于通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;通过第一模型将N个所述问答关系与真实答案组成一组正负样本组。例如 知道一个用户问句和图谱中的关系有匹配的概率,可以通过概率来进行采样,集中于高质量的负样本,可以使得训练质量提高。
需要说明的是,本实施例中,是假设实体识别和连接过程给定。
具体地,对于每一个问句,实体连接步骤先找到主题实体,然后查询图谱找到其所连接的所有关系,然后第一模型会对这些关系进行与问句的相关性打分,选取相关性分数最高的前51个(若答案没有包含在前51,则选取前50个,然后这50个与真实答案组成一组正负样本组)。第二模型作为生成对抗网络的判别器,其任务是在给到的51个可能答案中选取出正确的那一个。正负样本组中,第一模型出了一些与问句关系很近的数据,这使得得到的负样本比简单随机采样要更加难以被判别器(第二模型)区分,这使得第二模型需要变得更好,才能完成正确的判别。
对抗生成网络模块204,适于通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系。
具体地,对抗生成网络模块204,适于对所述第一模型和所述第二模型的参数进行策略梯度算法的强化学习;根据策略梯度算法的强化学习后的结果确定所述第一模型或所述第二模型中一个为最终关系分类器,并确定最终模型关系。
在一实施例中,对抗生成网络模块204,适于对所述第一模型和所述第二模型的参数进行策略梯度算法的强化学习;确定策略梯度算法的强化学习之后的所述第一模型和所述第二模型达到纳什均衡;根据所述第一模型和所述第二模型的结果,确定最优的所述第一模型或所述第二模型为最终关系分类器,并确定最终模型关系。
具体地,对抗生成网络的训练过程可看成是一个二人零和博弈。第一模型和所述第二模型的参数通过REINFORCE方法,最终达到纳什均衡。最终,根据两个模型改变后的表现,来决定最终选取哪个模型作为最终的关系分类器。
在一具体实施方式中,生成对抗网络的第一模型和第二模型的训练过程是一个二人零和博弈,需要通过Reinforcement Learning(强化学习)对第一模型和第二模型的参数进行优化,以达到纳什均衡,具体地,第一模型和第二模型的参数通过采用马尔科夫决策进行策略梯度算法的梯度下降方式的强化学习,使得第一模型作为生成器更好的M个问答关系效果(即更接近真实答案与问题的关系),同时,第二模型作为判别器精确地判别。策略梯度算法的强化学习为本领域技术人员公知的,此处不再具体赘述。
在一具体实施方式中,基于策略梯度算法的梯度下降方式的强化学习,使得第一模型和第二模型在对抗生成网络训练达到稳定的平衡状态,即第一模型作为生成器生成的数据 与真实样本无差别,第二模型作为判别器也无法正确的区分生成数据和真实数据。
匹配模块205,适于根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
在一实施例中,匹配模块205根据最终模型确定关系,结合前面确定的实体,通过查询图谱找到答案,并返回答案给用户端。
通过本实施例,能够在基于知识图谱的问答系统中,通过在常规的基于深度网络的关系分类模型的上层加入对抗生成训练,有效地提升模型精度,使得问答更加准确。以及由于实际应用中限于效率的要求,不可能进行多个模型的集成。这就要进行模型选择,但是有时模型的表现比较接近,这时可以通过对抗训练,来看模型两两对抗的结果,选取更加鲁棒的模型来使用,大大地降低了研发成本。
此外,本申请还提出一种基于知识图谱的问答方法。参阅图5所示,是本申请基于知识图谱的问答方法之第一实施例的流程示意图。所述基于知识图谱的问答方法应用于电子装置20中。在本实施例中,根据不同的需求,图5所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。
步骤S500,确定预训练后的第一模型为生成对抗网络的生成器。具体地,生成器是指对通过对问题和关系是否相关的概率进行建模的模型,但是一般生成器例如可以是深度神经网络,本实施例不限制模型具体内容。
步骤S501,确定预训练后的第二模型为生成对抗网络的判别器;
具体地,判别器是对条件概率P(Y|X)进行建模,判别器用于评价问题与关系的匹配程度,本实施例的判别器和生成器可以是结构完全相同的模型(不同的参数),扮演的角色不同。
步骤S502,通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组;
在其中一个实施例中,通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;通过第一模型将N个所述问答关系与真实答案组成一组正负样本组,通过生成器,知道一个用户问句和图谱中的关系有匹配的概率,可以通过概率来进行采样,集中于高质量的负样本,可以使得训练质量提高。
步骤S503,通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系;
步骤S504,根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
通过本实施例,能够在基于知识图谱的问答系统中,通过在常规的基于深度网络的关系分类模型的上层加入对抗生成训练,有效地提升模型精度,使得问答更加准确。以及由于实际应用中限于效率的要求,不可能进行多个模型的集成。这就要进行模型选择,但是有时模型的表现比较接近,这时可以通过对抗训练,来看模型两两对抗的结果,选取更加鲁棒的模型来使用,大大地降低了研发成本。
参阅图6所示,是本申请基于知识图谱的问答方法之第二实施例的流程示意图。所述基于知识图谱的问答方法应用于电子装置20中。在本实施例中,根据不同的需求,图6所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。
步骤S600,从数据库提取若干个用户历史输入的自然查询语句对应的问题数据。
步骤S601,对基于神经网络的KGQA关系分类模型的所述第一模型和所述第二模型进行预置训练数据的预训练。
在一个实施例中,预训练两个不同的基于神经网络的KGQA关系分类模型为所述第一模型和所述第二模型中的第一模型和第二模型的网络结构不同,训练数据按照预置正负样本比例(如1:50)随机生成,两个模型的预置训练数据中的负样本采样是独立进行的。
步骤S602,确定预训练后的第一模型为生成对抗网络的生成器;
具体地,生成器是指通过对问题和关系是否相关的概率进行建模的模型,但是一般生成器例如可以是深度神经网络,本实施例不限制模型具体内容。
步骤S603,确定预训练后的第二模型为生成对抗网络的判别器;
具体地,判别器是对条件概率P(Y|X)进行建模,判别器用于评价问题与关系的匹配程度,本实施例的判别器和生成器可以是结构完全相同的模型(不同的参数),扮演的角色不同。
步骤S604,通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;
在其中一个实施例中,在一实施例中,通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;通过第一模型将N个所述问答关系与真实答案组成一组正负样本组。通过生成器,知道一个用户问句和图谱中的关系有匹配的概率,可以通过概率来进行采样,集中于高质量的负样本,可以使得训练质量提高。
需要说明的是,本实施例中,是假设实体识别和连接过程给定。
步骤S605,通过第一模型对N个所述问答关系进行与问题数据的相关性评分;具体地,对于每一个问句,实体连接步骤先找到主题实体,然后查询图谱找到其所连接的所有关系,然后第一模型会对这些关系进行与问句的相关性打分。
步骤S606,根据相关性评分的结果选取分数排名为预置排名数前的M个问答关系,其中,N>M。
具体地,选取相关性分数最高的前51个(若答案没有包含在前51,则选取前50个,然后这50个与真实答案组成一组正负样本组)。第二模型作为生成对抗网络的判别器,其任务是在给到的51个可能答案中选取出正确的那一个。正负样本组中,第一模型出了一些与问句关系很近的数据,这使得得到的负样本比简单随机采样要更加难以被判别器(第二模型)区分,这使得第二模型需要变得更好,才能完成正确的判别。
步骤S607,通过第一模型将M个所述问答关系与真实答案组成一组正负样本组。
步骤S608,对所述第一模型和所述第二模型的参数进行策略梯度算法的强化学习。
具体地,对所述第一模型和所述第二模型进行强化学习的目标是使得回报最大化。强化学习和非监督学习的关键部分就是回报的选择。强化学习是学习状态和行为之间的映射关系,以使得数值回报达到最大化。换句话说,在未知采取何种行为的情况下,学习者必须通过不断尝试才能发现采取哪种行为能够产生最大回报,即最后发现所述第一模型和所述第二模型能够产生最大回报。
在一具体实施方式中,生成对抗网络的第一模型和第二模型的训练过程是一个二人零和博弈,需要通过Reinforcement Learning(强化学习)对第一模型和第二模型的参数进行优化,以达到纳什均衡,具体地,第一模型和第二模型的参数通过采用马尔科夫决策进行策略梯度算法的梯度下降方式的强化学习,使得第一模型作为生成器更好的M个问答关系效果(即更接近真实答案与问题的关系),同时,第二模型作为判别器精确地判别。策略梯度算法的强化学习为本领域技术人员公知的,此处不再具体赘述。
步骤S609,确定策略梯度算法的强化学习之后的所述第一模型和所述第二模型达到纳什均衡。
在一具体实施方式中,基于步骤S608的策略梯度算法的梯度下降方式的强化学习,使得第一模型和第二模型在对抗生成网络训练达到稳定的平衡状态,即第一模型作为生成器生成的数据与真实样本无差别,第二模型作为判别器也无法正确的区分生成数据和真实数据。
步骤S610,根据所述第一模型和所述第二模型的结果,确定最优的所述第一模型或所 述第二模型为最终关系分类器,并确定最终模型关系。
具体地,根据纳什均衡状态下的两个模型,决定最终选取哪个模型作为最终的关系分类器。
步骤S611,根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。具体地,根据最终模型确定关系,结合前面确定的实体,通过查询图谱找到答案,并返回答案给用户端。
通过本实施例,能够在基于知识图谱的问答系统中,通过在常规的基于深度网络的关系分类模型的上层加入对抗生成训练,有效地提升模型精度,使得问答更加准确。以及由于实际应用中限于效率的要求,不可能进行多个模型的集成。这就要进行模型选择,但是有时模型的表现比较接近,这时可以通过对抗训练,来看模型两两对抗的结果,选取更加鲁棒的模型来使用,大大地降低了研发成本。
本申请还提供一种计算机设备,如可以执行程序的智能手机、平板电脑、笔记本电脑、台式计算机、机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。本实施例的计算机设备至少包括但不限于:可通过系统总线相互通信连接的存储器、处理器等。
本实施例还提供一种非易失性计算机可读存储介质,如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘、服务器、App应用商城等等,其上存储有计算机可读指令,程序被处理器执行时实现相应功能。本实施例的非易失性计算机可读存储介质用于存储电子装置20,被处理器执行时实现本申请的基于知识图谱的问答方法。
Claims (20)
- 一种基于知识图谱的问答方法,应用于电子装置中,所述方法包括步骤:确定预训练后的第一模型为生成对抗网络的生成器;及确定预训练后的第二模型为生成对抗网络的判别器;通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组;通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系;根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
- 如权利要求1所述的基于知识图谱的问答方法,通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组的步骤,包括:通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;通过第一模型将N个所述问答关系与真实答案组成一组正负样本组。
- 如权利要求2所述的基于知识图谱的问答方法,通过第一模型将N个所述问答关系与真实答案组成一组正负样本组的步骤,包括:通过第一模型对N个所述问答关系进行与问题数据的相关性评分;根据相关性评分的结果选取分数排名为预置排名数前的M个问答关系,其中,N>M;通过第一模型将M个所述问答关系与真实答案组成一组正负样本组。
- 如权利要求1所述的基于知识图谱的问答方法,通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系的步骤,包括:对所述第一模型和所述第二模型的参数进行策略梯度算法的强化学习;根据策略梯度算法的强化学习后的结果确定所述第一模型或所述第二模型中一个为最终关系分类器,并确定最终模型关系。
- 如权利要求4所述的基于知识图谱的问答方法,根据策略梯度算法的强化学习后的结果确定所述第一模型或所述第二模型中一个为最终关系分类器,并确定最终模型关系的步骤,包括:确定策略梯度算法的强化学习之后的所述第一模型和所述第二模型达到纳什均衡;根据所述第一模型和所述第二模型的结果,确定最优的所述第一模型或所述第二模型为最终关系分类器,并确定最终模型关系。
- 如权利要求5所述的基于知识图谱的问答方法,确定预训练后的第一模型为生成对抗网络的生成器,及确定预训练后的第二模型为生成对抗网络的判别器的步骤,之前还包括:对基于神经网络的KGQA关系分类模型的所述第一模型和所述第二模型进行预置训练数据的预训练;其中,第一模型和第二模型的网络结构不同,预置训练数据按照预置正负样本比例随机生成。
- 如权利要求6所述的基于知识图谱的问答方法,通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组的步骤,之前还包括:获取用户输入的自然查询语句对应的问题数据;从数据库提取若干个用户历史输入的自然查询语句对应的问题数据。
- 一种电子装置,其包括:第一确定模块,适于确定预训练后的第一模型为生成对抗网络的生成器;第二确定模块,适于确定预训练后的第二模型为生成对抗网络的判别器;查询模块,适于通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组;对抗生成网络模块,适于通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系;匹配模块,适于根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
- 一种计算机设备,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现基于知识图谱的问答方法包括步骤:确定预训练后的第一模型为生成对抗网络的生成器;及确定预训练后的第二模型为生成对抗网络的判别器;通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组;通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系;根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
- 如权利要求9所述的计算机设备,通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组的步骤,包括:通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;通过第一模型将N个所述问答关系与真实答案组成一组正负样本组。
- 如权利要求10所述的计算机设备,通过第一模型将N个所述问答关系与真实答案组成一组正负样本组的步骤,包括:通过第一模型对N个所述问答关系进行与问题数据的相关性评分;根据相关性评分的结果选取分数排名为预置排名数前的M个问答关系,其中,N>M;通过第一模型将M个所述问答关系与真实答案组成一组正负样本组。
- 如权利要求9所述的计算机设备,通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系的步骤,包括:对所述第一模型和所述第二模型的参数进行策略梯度算法的强化学习;根据策略梯度算法的强化学习后的结果确定所述第一模型或所述第二模型中一个为最终关系分类器,并确定最终模型关系。
- 如权利要求12所述的计算机设备,根据策略梯度算法的强化学习后的结果确定所述第一模型或所述第二模型中一个为最终关系分类器,并确定最终模型关系的步骤,包括:确定策略梯度算法的强化学习之后的所述第一模型和所述第二模型达到纳什均衡;根据所述第一模型和所述第二模型的结果,确定最优的所述第一模型或所述第二模型为最终关系分类器,并确定最终模型关系。
- 如权利要求13所述的计算机设备,确定预训练后的第一模型为生成对抗网络的生成器,及确定预训练后的第二模型为生成对抗网络的判别器的步骤,之前还包括:对基于神经网络的KGQA关系分类模型的所述第一模型和所述第二模型进行预置训练数据的预训练;其中,第一模型和第二模型的网络结构不同,预置训练数据按照预置正负样本比例随机生成。
- 如权利要求14所述的计算机设备,通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组的步骤,之前还包括:获取用户输入的自然查询语句对应的问题数据;从数据库提取若干个用户历史输入的自然查询语句对应的问题数据。
- 一种非易失性计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现基于知识图谱的问答方法包括步骤:确定预训练后的第一模型为生成对抗网络的生成器;及确定预训练后的第二模型为生成对抗网络的判别器;通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组;通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系;根据最终模型关系对问题数据通过查询图谱匹配到最终答案数据。
- 如权利要求16所述的非易失性计算机可读存储介质,通过第一模型对获取到的用户输入的问题数据进行知识图谱查询,找到所述问题数据连接的N个问答关系,并将N个所述问答关系与真实答案组成一组正负样本组的步骤,包括:通过第一模型将获取的用户输入的问题数据进行实体连接找到对应的主题实体,对主题实体进行知识图谱查询,找到所述问题数据连接的N个问答关系;通过第一模型将N个所述问答关系与真实答案组成一组正负样本组。
- 如权利要求17所述的非易失性计算机可读存储介质,通过第一模型将N个所述问答关系与真实答案组成一组正负样本组的步骤,包括:通过第一模型对N个所述问答关系进行与问题数据的相关性评分;根据相关性评分的结果选取分数排名为预置排名数前的M个问答关系,其中,N>M;通过第一模型将M个所述问答关系与真实答案组成一组正负样本组。
- 如权利要求16所述的非易失性计算机可读存储介质,通过所述第一模型和所述第二模型根据二人零和博弈对对抗生成网络进行训练,确定最终模型关系的步骤,包括:对所述第一模型和所述第二模型的参数进行策略梯度算法的强化学习;根据策略梯度算法的强化学习后的结果确定所述第一模型或所述第二模型中一个为最终关系分类器,并确定最终模型关系。
- 如权利要求19所述的非易失性计算机可读存储介质,根据策略梯度算法的强化学习后的结果确定所述第一模型或所述第二模型中一个为最终关系分类器,并确定最终模型关系的步骤,包括:确定策略梯度算法的强化学习之后的所述第一模型和所述第二模型达到纳什均衡;根据所述第一模型和所述第二模型的结果,确定最优的所述第一模型或所述第二模型为最终关系分类器,并确定最终模型关系。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910376927.8A CN110263133B (zh) | 2019-05-07 | 2019-05-07 | 基于知识图谱的问答方法、电子装置、设备及存储介质 |
CN201910376927.8 | 2019-05-07 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020224220A1 true WO2020224220A1 (zh) | 2020-11-12 |
Family
ID=67914379
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/118003 WO2020224220A1 (zh) | 2019-05-07 | 2019-11-13 | 基于知识图谱的问答方法、电子装置、设备及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110263133B (zh) |
WO (1) | WO2020224220A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112395429A (zh) * | 2020-12-02 | 2021-02-23 | 上海三稻智能科技有限公司 | 基于图神经网络的hs编码判定、推送、应用方法、系统及存储介质 |
CN117609470A (zh) * | 2023-12-08 | 2024-02-27 | 中科南京信息高铁研究院 | 基于大语言模型和知识图谱的问答系统、其构建方法及智能化数据治理平台 |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110263133B (zh) * | 2019-05-07 | 2023-11-24 | 平安科技(深圳)有限公司 | 基于知识图谱的问答方法、电子装置、设备及存储介质 |
CN110909159B (zh) * | 2019-09-29 | 2022-09-16 | 珠海格力电器股份有限公司 | 一种用户意图识别方法、装置、终端及存储介质 |
CN110766086B (zh) * | 2019-10-28 | 2022-07-22 | 支付宝(杭州)信息技术有限公司 | 基于强化学习模型对多个分类模型进行融合的方法和装置 |
CN111985238B (zh) * | 2020-06-30 | 2024-07-26 | 联想(北京)有限公司 | 一种答案生成方法及设备 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107423437A (zh) * | 2017-08-04 | 2017-12-01 | 逸途(北京)科技有限公司 | 一种基于对抗网络强化学习的问答模型优化方法 |
US20180330226A1 (en) * | 2016-01-29 | 2018-11-15 | Alibaba Group Holding Limited | Question recommendation method and device |
CN109271483A (zh) * | 2018-09-06 | 2019-01-25 | 中山大学 | 基于递进式多判别器的问题生成方法 |
CN109344322A (zh) * | 2018-08-16 | 2019-02-15 | 中国电子科技集团公司电子科学研究院 | 复杂网络的关系图谱挖掘分析平台、方法及存储介质 |
CN110263133A (zh) * | 2019-05-07 | 2019-09-20 | 平安科技(深圳)有限公司 | 基于知识图谱的问答方法、电子装置、设备及存储介质 |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103038765B (zh) * | 2010-07-01 | 2017-09-15 | 诺基亚技术有限公司 | 用于适配情境模型的方法和装置 |
CN107368752B (zh) * | 2017-07-25 | 2019-06-28 | 北京工商大学 | 一种基于生成式对抗网络的深度差分隐私保护方法 |
CN108509519B (zh) * | 2018-03-09 | 2021-03-09 | 北京邮电大学 | 基于深度学习的通用知识图谱增强问答交互系统及方法 |
CN108923922B (zh) * | 2018-07-26 | 2021-04-23 | 北京工商大学 | 一种基于生成对抗网络的文本隐写方法 |
-
2019
- 2019-05-07 CN CN201910376927.8A patent/CN110263133B/zh active Active
- 2019-11-13 WO PCT/CN2019/118003 patent/WO2020224220A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180330226A1 (en) * | 2016-01-29 | 2018-11-15 | Alibaba Group Holding Limited | Question recommendation method and device |
CN107423437A (zh) * | 2017-08-04 | 2017-12-01 | 逸途(北京)科技有限公司 | 一种基于对抗网络强化学习的问答模型优化方法 |
CN109344322A (zh) * | 2018-08-16 | 2019-02-15 | 中国电子科技集团公司电子科学研究院 | 复杂网络的关系图谱挖掘分析平台、方法及存储介质 |
CN109271483A (zh) * | 2018-09-06 | 2019-01-25 | 中山大学 | 基于递进式多判别器的问题生成方法 |
CN110263133A (zh) * | 2019-05-07 | 2019-09-20 | 平安科技(深圳)有限公司 | 基于知识图谱的问答方法、电子装置、设备及存储介质 |
Non-Patent Citations (1)
Title |
---|
LI, YIFU: "Study of knowledge graph question answering systems based on generative adversarial learning", INFORMATION & TECHNOLOGY, CHINA MASTER’S THESES FULL-TEXT DATABASE, no. 1,, 15 January 2019 (2019-01-15), pages 1 - 77, XP055751500, ISSN: 1674-0246 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112395429A (zh) * | 2020-12-02 | 2021-02-23 | 上海三稻智能科技有限公司 | 基于图神经网络的hs编码判定、推送、应用方法、系统及存储介质 |
CN117609470A (zh) * | 2023-12-08 | 2024-02-27 | 中科南京信息高铁研究院 | 基于大语言模型和知识图谱的问答系统、其构建方法及智能化数据治理平台 |
Also Published As
Publication number | Publication date |
---|---|
CN110263133A (zh) | 2019-09-20 |
CN110263133B (zh) | 2023-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020224220A1 (zh) | 基于知识图谱的问答方法、电子装置、设备及存储介质 | |
US11294953B2 (en) | Similar face retrieval method, device and storage medium | |
KR102260554B1 (ko) | 학습 컨텐츠 생성 방법 | |
CN110795543B (zh) | 基于深度学习的非结构化数据抽取方法、装置及存储介质 | |
CN111444320B (zh) | 文本检索方法、装置、计算机设备和存储介质 | |
WO2021159632A1 (zh) | 智能问答方法、装置、计算机设备及计算机存储介质 | |
CN109376222B (zh) | 问答匹配度计算方法、问答自动匹配方法及装置 | |
CN109635083B (zh) | 一种用于搜索ted演讲中话题式查询的文档检索方法 | |
CN112287069B (zh) | 基于语音语义的信息检索方法、装置及计算机设备 | |
CN112685550B (zh) | 智能问答方法、装置、服务器及计算机可读存储介质 | |
CN113656547B (zh) | 文本匹配方法、装置、设备及存储介质 | |
CN112084307B (zh) | 一种数据处理方法、装置、服务器及计算机可读存储介质 | |
CN111753075A (zh) | 客服机器人问答数据的创建方法、装置和计算机设备 | |
CN118575173A (zh) | 使用搜索引擎结果增强机器学习语言模型 | |
CN117094395B (zh) | 对知识图谱进行补全的方法、装置和计算机存储介质 | |
CN112307048B (zh) | 语义匹配模型训练方法、匹配方法、装置、设备及存储介质 | |
CN113821527A (zh) | 哈希码的生成方法、装置、计算机设备及存储介质 | |
CN117494815A (zh) | 面向档案的可信大语言模型训练、推理方法和装置 | |
WO2021000400A1 (zh) | 导诊相似问题对生成方法、系统及计算机设备 | |
CN112966095A (zh) | 一种基于jean的软件代码推荐方法 | |
CN114841471B (zh) | 知识点预测方法、装置、电子设备和存储介质 | |
CN116701593A (zh) | 基于GraphQL的中文问答模型训练方法及其相关设备 | |
CN111339258A (zh) | 基于知识图谱的大学计算机基础习题推荐方法 | |
US11755671B2 (en) | Projecting queries into a content item embedding space | |
CN117290563B (zh) | 垂类搜索方法及装置、搜索系统、存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19928038 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19928038 Country of ref document: EP Kind code of ref document: A1 |