A sample selection method, a sample selection system, an identification method and an identification system
By updating the labeled sample set through a sampling model based on probability distribution differences, the problem of low recall rate of deep learning models in professional entity recognition is solved, the recognition effect and recall rate are improved, and the labeling cost is reduced.
Patent Information
- Application Number
- CN202311609958.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-11-29
AI Technical Summary
In the existing technology, when the deep learning model cannot obtain more professional samples, the recognition recall rate of professional entities is low, the recognition effect is poor, and the problem of low recall rate cannot be effectively solved.
Adopt a sampling model based on probability distribution differences, quantify the labeling value of unlabeled samples by comparing the difference in probability distribution of entity categories between unlabeled samples and labeled samples, select unlabeled samples with large probability distribution differences as supplementary samples, and update the labeled sample set , and train the entity recognition model again.
The deep learning model improves the recognition recall rate of professional entities, uses fewer samples to achieve better entity recognition results, reduces labeling costs, and improves the recall effect of recognition.
Smart Images

Figure CN117634489B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of entity recognition, and in particular to a sample selection method, a sample selection system, a recognition method and a recognition system. Background Art
[0002] The task of named entity recognition is highly challenging and requires high accuracy and recall. Because deep learning models have data-driven context encoding capabilities, they have become the mainstream method for named entity recognition tasks. To achieve high accuracy and recall in professional field named entity recognition based on deep learning, it is usually necessary to collect a large amount of labeled data in professional fields and fully train the model. However, many professional fields such as finance, medicine, and law require a certain degree of expertise to label data. Compared with general fields, the cost of obtaining and labeling data is relatively high. The existing sampling strategies are generally based on the maximum length of the sample, the recognition probability of the sample, and other characteristics, including random sampling strategies, entropy-based sampling strategies, minimum confidence-based sampling strategies, and edge sampling strategies. They mainly focus on the low accuracy of the identified entities and cannot solve the problem of low recall.
[0003] In the process of implementing the present invention, the applicant discovered that there are at least the following problems in the prior art: when more professional samples are not available, the trained deep learning model has a low recognition recall rate for professional entities and poor recognition effect. Summary of the invention
[0004] The embodiments of the present invention provide a sample selection method, a sample selection system, an identification method and an identification system, which can solve the technical problem in the prior art that when more professional samples cannot be obtained, the trained deep learning model has a low recognition recall rate and poor recognition effect for professional entities.
[0005] To achieve the above objectives, in a first aspect, an embodiment of the present invention provides a sample selection method, comprising:
[0006] Reasoning entities: Input unlabeled samples into the preliminary entity recognition model to reason and identify entities in the unlabeled samples, and output the reasoning results corresponding to each unlabeled sample. The reasoning results include: entity, entity type, the number of each entity, and the number of entities of each type;
[0007] Calculate the probability distribution difference: For each inference result corresponding to an unlabeled sample, determine the probability distribution difference value of each type of entity in the inference result based on the sampling model of probability distribution difference;
[0008] Update the labeled sample set: take the unlabeled samples whose probability distribution difference value is not less than the threshold as supplementary samples; the supplementary samples are used to supplement the labeled sample set to form an updated labeled sample set, and the updated labeled sample set is used to re-train the preliminary entity recognition model to obtain the final entity recognition model.
[0009] In a second aspect, an embodiment of the present invention provides a method for identifying a named entity, including the aforementioned sample selection method;
[0010] The method for identifying the named entity further includes:
[0011] Labeled samples: add the manually labeled supplementary samples to the labeled sample set to form an updated labeled sample set;
[0012] Update the entity recognition model: Use all the labeled samples in the updated labeled sample set to train the preliminary entity recognition model to obtain the final entity recognition model;
[0013] Entity recognition: Identify named entities in the data to be recognized through the final entity recognition model.
[0014] In a third aspect, an embodiment of the present invention provides a sample selection system, including:
[0015] An entity reasoning unit is used to input unlabeled samples into a preliminary entity recognition model to reason and recognize entities in the unlabeled samples, and output reasoning results corresponding to each unlabeled sample. The reasoning results include: entity, entity type, number of each entity, and number of entities of each type;
[0016] A probability distribution difference calculation unit, for determining, for each inference result corresponding to an unlabeled sample, a probability distribution difference value of each type of entity in the inference result based on a sampling model of probability distribution difference;
[0017] Labeled sample set updating unit: used to take unlabeled samples whose probability distribution difference values are not less than a threshold as supplementary samples; the supplementary samples are used to supplement the labeled sample set to form an updated labeled sample set, and the updated labeled sample set is used to re-train the preliminary entity recognition model to obtain the final entity recognition model.
[0018] In a fourth aspect, an embodiment of the present invention provides a named entity recognition system, including the aforementioned sample selection system;
[0019] The named entity recognition system also includes:
[0020] A labeling unit, used to add manually labeled supplementary samples to the labeled sample set to form an updated labeled sample set;
[0021] An entity recognition model training unit, used to train a preliminary entity recognition model using all the labeled samples in the updated labeled sample set to obtain a final entity recognition model;
[0022] The entity recognition unit is used to identify the named entities in the data to be recognized through the final entity recognition model.
[0023] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by a computer device, the computer device executes the aforementioned sample selection method.
[0024] In a sixth aspect, an embodiment of the present invention provides a computer device, including:
[0025] A processor; and a memory arranged to store computer executable instructions, which, when executed, cause the processor to perform the aforementioned sample selection method.
[0026] The above technical solution has the following beneficial effects: a sampling model based on probability distribution difference is adopted to compare the probability distribution difference of entity categories between unlabeled samples and labeled samples to quantify the labeling value of unlabeled samples, and unlabeled samples with large probability distribution difference are selected as supplementary samples with labeling value to update the labeled sample set. The updated labeled sample set is used as samples for retraining the entity recognition model. The final entity recognition model can recognize entities of the same entity type as those in the supplementary samples, so better entity recognition effect can be achieved using fewer samples, thereby improving the recognition recall rate and achieving good recall effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 is a flow chart of a sample selection method according to an embodiment of the present invention;
[0029] Figure 2 is a flow chart of a method for identifying a named entity according to an embodiment of the present invention;
[0030] Figure 3 is a logical structure diagram of a sample selection system according to an embodiment of the present invention;
[0031] Figure 4is a logical structure diagram of a named entity recognition system according to an embodiment of the present invention;
[0032] Figure 5 is a logical structure diagram of a computer device according to an embodiment of the present invention;
[0033] Figure 6 It is an example of a sample sampling function according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0035] The definitions of some technical terms involved in the embodiments of the present invention are as follows:
[0036] BERT-CRF is a sequence labeling model that combines pre-trained bidirectional encoder representations (BidirectionalEncoder Representations from Transformers, BERT) and conditional random fields (CRF).
[0037] BERT is a pre-trained language model based on the Transformer architecture. It learns rich language representations by pre-training on large-scale unlabeled text. BERT can capture contextual information and semantic relationships and has strong representation capabilities. In sequence labeling tasks, BERT can be used as an encoder to convert the input sequence into a context-related representation.
[0038] CRF is a statistical model that is often used in sequence labeling tasks. It can model and optimize the consistency of label sequences by modeling the global features of the label sequence and the transition probability between labels. CRF can solve the dependency problem between labels, allowing the model to more accurately predict the label at each position in the sequence.
[0039] BERT-CRF combines the advantages of BERT and CRF. It can not only use the BERT model to learn context-related language representations, but also model the dependencies between tags through the CRF model. This enables BERT-CRF to perform well in sequence labeling tasks, such as named entity recognition (NER) and part-of-speech tagging. By jointly training BERT and CRF, BERT-CRF can achieve more accurate and consistent label predictions in sequence labeling tasks.
[0040] BiLSTN-CRF is a sequence labeling model that combines two technologies: Bidirectional Long Short-Term Memory (BiLSTM) and Conditional Random Field (CRF).
[0041] BiLSTM is a variant of Recurrent Neural Network (RNN) that can effectively capture contextual information in sequence data. By introducing two LSTM layers, forward and backward, in the model, BiLSTM can simultaneously consider the context before and after the current position, thereby better understanding the dependencies and semantic information in the sequence.
[0042] like Figure 1 As shown, in combination with an embodiment of the present invention, a sample selection method is provided, comprising:
[0043] S101, inferring entities: inputting unlabeled samples into a preliminary entity recognition model to infer and recognize entities in the unlabeled samples, and outputting inference results corresponding to each unlabeled sample, the inference results including: entity, entity type, the number of each entity, and the number of entities of each type;
[0044] S102, calculating probability distribution difference: for each inference result corresponding to the unlabeled sample, determine the probability distribution difference value of each type of entity in the inference result based on the sampling model of probability distribution difference;
[0045] S103, updating the labeled sample set: taking the unlabeled samples whose probability distribution difference values are not less than the threshold as supplementary samples; the supplementary samples are used to supplement the labeled sample set to form an updated labeled sample set, and the updated labeled sample set is used to retrain the preliminary entity recognition model to obtain the final entity recognition model.
[0046] A sampling model based on probability distribution difference is adopted to compare the probability distribution difference of entity categories between unlabeled samples and labeled samples to quantify the labeling value of unlabeled samples. Unlabeled samples with large probability distribution difference are selected as supplementary samples with labeling value to update the labeled sample set. The updated labeled sample set is used as samples for re-training the entity recognition model. The final entity recognition model can recognize entities of the same type as those in the supplementary samples. Therefore, better entity recognition effect can be achieved with fewer samples, which improves the recognition recall rate and has a good recall effect.
[0047] Preferably, the sample selection method further includes: constructing a sampling model based on probability distribution differences, and constructing a sampling model based on probability distribution differences specifically includes:
[0048] Obtain the labeling results of each labeling sample in the manually labeled labeling sample set, the labeling results include: entity, entity type, the number of each entity and the number of entities of each type;
[0049] The Gaussian probability density function of the entity type is determined based on the number of entities of each type in each labeled sample, and the Gaussian probability density function is used as a sampling model based on probability distribution differences.
[0050] Preferably, constructing a sampling model based on probability distribution differences specifically includes:
[0051] The Gaussian probability density function is normalized so that the value of the Gaussian probability density function is controlled within the range of [0, 1], and the sample sampling function is obtained, and the sample sampling function is used as the final sampling model based on probability distribution difference. The value of the Gaussian probability density function is controlled within the range of [0, 1]. When the probability difference value of the unlabeled sample is obtained through the sampling model based on probability distribution difference, it is easy to distinguish what kind of probability distribution difference value corresponds to the unlabeled sample that is worth labeling.
[0052] Preferably, the sample selection method further includes:
[0053] Update the sampling model based on probability distribution differences: according to each labeled sample in the updated labeled sample set, update the parameter value of the sampling model based on probability distribution differences to obtain an updated sampling model based on probability distribution differences, and the updated sampling model based on probability distribution differences is used to select new unlabeled samples as supplementary samples; wherein the parameter values include: a mean matrix of the number of each type of entity and a covariance matrix formed by the number of each type of entity.
[0054] The parameter values of the sampling model based on probability distribution differences are updated. The sampling model based on probability distribution differences is used to select new unlabeled samples. It can identify samples that are different from the labeled samples that currently constitute the sampling model based on probability distribution differences, and select more different types of samples, thereby improving the recognition ability of the entity recognition model and the recall rate of entity recognition.
[0055] In conjunction with an embodiment of the present invention, a method for identifying a named entity is provided, comprising any of the aforementioned sample selection methods, wherein a method for identifying a named entity is as follows: Figure 2 As shown;
[0056] The method for identifying the named entity further includes:
[0057] S201, labeling samples: adding manually labeled supplementary samples to the labeled sample set to form an updated labeled sample set;
[0058] S202, updating the entity recognition model: using all the labeled samples in the updated labeled sample set to train the preliminary entity recognition model to obtain a final entity recognition model;
[0059] S203, entity recognition: identifying named entities in the data to be recognized through the final entity recognition model.
[0060] Preferably, S202, updating the entity recognition model, specifically includes:
[0061] Using all the labeled samples in the updated labeled sample set to train the preliminary entity recognition model to obtain the current entity recognition model;
[0062] The method for identifying the named entity further includes:
[0063] Test verification: Use the test set to test and verify the current entity recognition model, obtain the recognition result, and determine whether the accuracy of the recognition result reaches the preset accuracy;
[0064] When the accuracy of the recognition result does not reach the preset accuracy, the steps of inferring the entity, calculating the probability distribution difference, updating the labeled sample set, labeling the sample and updating the entity recognition model are looped in sequence for the new unlabeled sample, until the recognition result obtained by testing and verifying the current entity recognition model reaches the preset accuracy in the step of testing and verifying, the loop is stopped, and the current entity recognition model is used as the final entity recognition model;
[0065] When the accuracy of the recognition result reaches the preset accuracy, the current entity recognition model is used as the final entity recognition model.
[0066] When the entity recognition model determined when the accuracy of the recognition result reaches a preset accuracy rate is used to recognize the data to be recognized, the recall rate of the named entity can be improved.
[0067] like Figure 3 As shown, in combination with an embodiment of the present invention, a sample selection system is provided, comprising:
[0068] An entity reasoning unit 31 is used to input the unlabeled samples into a preliminary entity recognition model to reason and recognize entities in the unlabeled samples, and output reasoning results corresponding to each unlabeled sample, wherein the reasoning results include: entities, entity types, the number of each entity, and the number of entities of each type;
[0069] A probability distribution difference calculation unit 32 is used to determine the probability distribution difference value of each type of entity in the reasoning result based on the sampling model of probability distribution difference for the reasoning result corresponding to each unlabeled sample;
[0070] The labeled sample set updating unit 33 is used to take the unlabeled samples whose probability distribution difference values are not less than the threshold as supplementary samples; the supplementary samples are used to supplement the labeled sample set to form an updated labeled sample set, and the updated labeled sample set is used to re-train the preliminary entity recognition model to obtain the final entity recognition model.
[0071] Preferably, the sample selection system further comprises a unit for constructing a sampling model based on probability distribution differences, wherein the unit for constructing a sampling model based on probability distribution differences is used to:
[0072] Obtain the labeling results of each labeling sample in the manually labeled labeling sample set, the labeling results include: entity, entity type, the number of each entity and the number of entities of each type;
[0073] The Gaussian probability density function of the entity type is determined based on the number of entities of each type in each labeled sample, and the Gaussian probability density function is used as a sampling model based on probability distribution differences.
[0074] Preferably, the construction unit of the sampling model based on probability distribution difference is further used for:
[0075] The Gaussian probability density function is normalized so that the value of the Gaussian probability density function is controlled within the range of [0, 1], and a sample sampling function is obtained. The sample sampling function is used as the final sampling model based on probability distribution differences.
[0076] Preferably, the sample selection system further comprises:
[0077] A sampling model updating unit is used to update the parameter value of the sampling model based on probability distribution difference according to each labeled sample in the updated labeled sample set, so as to obtain an updated sampling model based on probability distribution difference, and the updated sampling model based on probability distribution difference is used for selecting new unlabeled samples as supplementary samples; wherein the parameter value includes: a mean matrix of the number of entities of each type and a covariance matrix formed by the number of entities of each type.
[0078] like Figure 4 As shown, in combination with an embodiment of the present invention, a named entity recognition system is provided, including any of the aforementioned sample selection systems;
[0079] The named entity recognition system also includes:
[0080] A labeling unit 41, used to add the manually labeled supplementary samples to the labeled sample set to form an updated labeled sample set;
[0081] An entity recognition model training unit 42 is used to train a preliminary entity recognition model using all the labeled samples in the updated labeled sample set to obtain a final entity recognition model;
[0082] The entity recognition unit 43 is used to recognize named entities in the data to be recognized through the final entity recognition model.
[0083] Preferably, the named entity recognition system further includes a testing unit, wherein:
[0084] The entity recognition model training unit 42 is specifically used to train the preliminary entity recognition model using all the labeled samples in the updated labeled sample set to obtain the current entity recognition model; and when the accuracy of the recognition result obtained in the testing unit reaches a preset accuracy, the current entity recognition model is used as the final entity recognition model;
[0085] The testing unit is used to test and verify the current entity recognition model using a test set, obtain a recognition result, and determine whether the accuracy of the recognition result reaches a preset accuracy rate;
[0086] The entity reasoning unit 31, the probability distribution difference calculation unit 32, the labeled sample set updating unit 33, the labeling unit 41 and the entity recognition model training unit 42 are all used for when the accuracy of the recognition result obtained in the test unit does not reach the preset accuracy, for new unlabeled samples, the entity reasoning unit 31, the probability distribution difference calculation unit 32, the labeled sample set updating unit 33, the labeling unit 41 and the entity recognition model training unit 42 are executed in sequence until the recognition result obtained by testing and verifying the current entity recognition model in the test unit reaches the preset accuracy, and the sequential cycle execution is stopped.
[0087] Preferably, in combination with an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a computer device, the computer device executes any of the aforementioned sample selection methods.
[0088] Preferably, if Figure 5 As shown, in combination with an embodiment of the present invention, a computer device is provided, including:
[0089] A processor; and a memory arranged to store computer executable instructions, which, when executed, cause the processor to perform any of the aforementioned sample selection methods.
[0090] The beneficial technical effects achieved by the embodiments of the present invention are as follows:
[0091] The annotation value of unlabeled samples is quantified by comparing the probability distribution difference values of the entity categories of unlabeled samples and labeled samples, and the unlabeled samples with large probability distribution difference values are manually labeled, and the entity recognition model is trained again, and the entity recognition performance of the entity recognition model is continuously enhanced through cyclic iterative training. Practical applications in financial and medical scenarios show that compared with existing algorithms, the training samples determined by the algorithm based on probability distribution difference in the embodiment of the present invention can significantly reduce the number of iterations required for the convergence of the entity recognition model and the amount of labeled samples required to achieve the corresponding performance. Thus, better entity recognition effects can be achieved with fewer samples. At the same time, under the same amount of labeled samples, the algorithm can improve the recall rate of the entity recognition model, thereby effectively improving the overall performance of the entity recognition model. The algorithm can effectively reduce the dependence of the named entity recognition task on labeled samples, select samples with more learning value, and reduce the labeling cost.
[0092] The sampling model based on probability distribution difference is used to actively learn and select samples, and the named entity recognition model is built using deep learning technology. New samples are added through sample sampling and the entity recognition model is retrained using labeled samples containing new samples to gradually improve the model's predictive reasoning effect.
[0093] The above technical solution of the embodiment of the present invention is described in detail below in conjunction with specific application examples. For technical details not introduced during the implementation process, please refer to the relevant description in the previous text.
[0094] An embodiment of the present invention is an entity recognition method based on the difference in probability distribution of label categories. Sample selection is achieved through an active learning algorithm based on the difference in label probability distribution. This active learning algorithm based on the difference in label probability distribution quantifies the annotation value of non-standardized samples by comparing the probability distribution difference value of the number of entity types between non-standardized samples and labeled samples, thereby focusing the annotation on samples associated with low recall rates.
[0095] The steps of a sample selection method and entity recognition method in an embodiment of the present invention are as follows:
[0096] 1. Labeling samples
[0097] Some samples L are randomly selected from the unlabeled sample set U, and manually labeled through the labeling platform to form a labeled sample set; because the entity type data of the labeled samples needs to be calculated later to form a sampling model algorithm P based on probability distribution, the sample labeling is improved on the basis of the traditional BIO form, and the number of types to which different entities belong is added. In the BIO form, B is the abbreviation of begin, which represents the beginning of the entity; I is the abbreviation of inside, which represents the middle of the entity; O is the abbreviation of outside, which represents not belonging to a noun phrase.
[0098] Suppose that two types of entities are obtained by annotating the sample: the first entity type is a person's name, and the second entity type is a place. For example, the sample is: Xiao Ming and Xiao Hong both love Beijing, the person's name is represented by c, and the place is represented by d. The annotation result is [c: {[0, 1, "Xiao Ming"], [2, 3, "Xiao Hong"], 2}, d: {[7, 8, "Beijing"], 1}], the number of person names c is the number 2 before the first}, and the number of place names d is the number 1 before the second}.
[0099] 2. Build a preliminary entity recognition model, using deep learning techniques such as BERT-CRF and BiLSTN-CRF, and conduct multiple rounds of training on the labeled samples of the labeled sample set through the training platform. When the test set tends to be stable, the entity recognition model M is obtained;
[0100] 3. The specific steps of constructing the sampling model P based on probability distribution differences are as follows:
[0101] For the aforementioned annotated sample set, according to the annotation results of each annotated sample, the number of entities of different categories of each annotated sample is obtained, based on the number of two types of entities (namely, names and places) existing in each annotated sample: i represents the number of the labeled sample, is the number of entities corresponding to the first entity type in the i-th labeled sample (the number of names), is the number of entities (number of locations) corresponding to the second entity type in the i-th annotation sample, and the vector X is formed according to the number of times the first type of entity appears in each annotation sample. b and the vector X formed according to the number of times the second type of entity appears in each labeled sample c , n represents the number of labeled samples.
[0102]
[0103]
[0104] Based on vector X b and X c , calculate the Gaussian probability density function of the number of entities of each type of labeled samples:
[0105]
[0106] The Gaussian probability density function is used as a sampling model based on the difference of probability distributions.
[0107] Among them, μ X is the mean matrix μ X =[X b ,X c ], is the mean of each type of entity in the labeled sample set; for example, for X b , μ X All X of this type b The mean of X c , μ X Indicates that all X of this type c The mean of ; if there are other types of entities, then so on. Σ is the covariance matrix x represents the vector of labeled samples T represents the transposed matrix and m represents the number of entity types.
[0108] According to formula (3), the Gaussian probability density f(x) of the number of entity types in the labeled sample set can be obtained. In order to better describe the abnormality of the entity type distribution, formula (3) is further normalized to obtain the sample sampling function P(x):
[0109]
[0110] The sample sampling function P(x) is used as the final sampling model based on probability distribution difference, where P(x) compresses the difference value in the range of [0,1].
[0111] 4. Reasoning Entities
[0112] The entity recognition model M is used to infer the unlabeled samples in the unlabeled sample set U to obtain the inference results, which include: entities, types corresponding to each entity and the number of entities of each type.
[0113] 5. There is no need to manually judge whether the inference results are correct or not. The inference results are directly input into the sampling model P based on the probability distribution difference to obtain the probability distribution difference values of each type of entity. The larger the probability distribution difference value, the greater the difference between the entity type distribution of the unlabeled sample and the entity type distribution of the labeled data set. In other words, the greater the difference characteristics of the entity type from the labeled sample, the more outliers it is and the more worthy of attention it deserves. Sort the difference distribution values of the unlabeled samples. The unlabeled samples that are not lower than the threshold are used as supplementary samples to form a supplementary data set N, and the supplementary data set N is handed over to the labelers for labeling. The supplementary data set is added to the labeled sample set, and the entity recognition model is trained and updated again. The updated entity recognition model can recognize entities of the same entity type as those in the supplementary samples, so the recall rate is improved.
[0114] The specific example of constructing and applying the sampling model P based on probability distribution difference is as follows: Taking the actual data of medical examination text as an example, there are 1000 annotated samples in the annotated sample set, and each annotated sample is annotated with two types of medical entities, namely, examination part and examination method, forming a vector X of two types of medical entities, namely, examination part and examination method. b and X c These two 1000-dimensional vectors X b , X c Respectively represent the number of occurrences of the corresponding medical entity in each labeled sample:
[0115] X b =[1,2,3...,2,1]
[0116] X c =[1,1,3,...,1,1]
[0117] Then based on X b and X c Calculate the mean matrix μ X and covariance matrix Σ, mean matrix μ X The covariance matrix Σ is the key parameter of the sample sampling function P(x):
[0118] μ X =[1.55,1.52]
[0119]
[0120] Thus, the sample sampling function P(x) is obtained:
[0121]
[0122] like Figure 6 As shown in the figure, the probability distribution function is obtained based on the above 1000 labeled samples. Among them, the X-axis and Y-axis correspond to the number of entities of each type of inspection part and inspection method, respectively, and the units of the X-axis and Y-axis are 100; Z represents the value of P(x). The Z value describes the difference in the probability distribution of the labeled sample. The more similar it is to the probability distribution of the labeled sample, the smaller the Z value. The more it deviates from the probability distribution of the labeled sample, the larger the Z value. The larger the Z value, the greater the difference between the labeled sample and the labeled data set, and it is more worthy of being provided to the entity recognition model for learning and training after labeling to update the entity recognition model and improve the entity recognition performance of the entity recognition model.
[0123] Assume that the unlabeled samples are s1 and s2:
[0124] s1 = chest coronal imaging plus;
[0125] s2 = increased sternal lateral position;
[0126] The inference result is output by performing inference recognition through the entity recognition model:
[0127] p1 = [b:{[0,1,"Breast"],1},c:{[],0}];
[0128] p2 = [b:{[2,3,“Chest”],1},c:{[4,5,“Lateral”],1}];
[0129] Input the vectors x1=[1,0] and x2=[1,1] corresponding to the unlabeled samples s1 and s2 into the sample sampling function P(x) and output the corresponding probability distribution difference values:
[0130] P(x1)=0.988;
[0131] P(x2)=0.166;
[0132] Since the probability distribution difference value P(x1) of s1 is significantly greater than the probability distribution difference value P(x2) of s2, and P(x1) is greater than the threshold, manually annotating the unlabeled sample s1 and using it to re-train the entity recognition model will bring greater improvement to the entity recognition performance of the model.
[0133] 6. The annotators annotate the supplementary dataset N and put it into the annotated dataset to obtain an updated annotated dataset: L = L + N;
[0134] 7. Update the key parameter mean matrix μ of the sampling function P corresponding to the sampling model based on probability distribution difference through the updated labeled sample set L X and the values of the covariance matrix Σ;
[0135] 8. Retrain the entity recognition model M with the updated sample set L;
[0136] 9. Verify the updated entity recognition model M in the test set to obtain the recognition result; determine whether the accuracy of the recognition result reaches the preset accuracy;
[0137] 10. When the accuracy of the recognition result reaches the preset accuracy, stop training;
[0138] When the accuracy of the recognition result does not reach the preset accuracy, the iteration steps four to nine are repeated for new unlabeled samples, and the iteration is stopped when the entity recognition model reaches the required accuracy.
[0139] The beneficial technical effects achieved by the embodiments of the present invention are as follows:
[0140] The annotation value of unlabeled samples is quantified by comparing the probability distribution difference values of the entity categories of unlabeled samples and labeled samples, and the unlabeled samples with large probability distribution difference values are manually labeled, and the entity recognition model is trained again, and the entity recognition performance of the entity recognition model is continuously enhanced through cyclic iterative training. Practical applications in financial and medical scenarios show that compared with existing algorithms, the training samples determined by the algorithm based on probability distribution difference in the embodiment of the present invention can significantly reduce the number of iterations required for the convergence of the entity recognition model and the amount of labeled samples required to achieve the corresponding performance. Thus, better entity recognition effects can be achieved with fewer samples. At the same time, under the same amount of labeled samples, the algorithm can improve the recall rate of the entity recognition model, thereby effectively improving the overall performance of the entity recognition model. The algorithm can effectively reduce the dependence of the named entity recognition task on labeled samples, select samples with more learning value, and reduce the labeling cost.
[0141] The sampling model based on probability distribution difference is used to actively learn and select samples, and the named entity recognition model is built using deep learning technology. New samples are added through sample sampling and the entity recognition model is retrained using labeled samples containing new samples to gradually improve the model's predictive reasoning effect.
[0142] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.
[0143] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.
[0144] The disclosed embodiments are described above to enable any person skilled in the art to implement or use the present invention. Various modifications of these embodiments are obvious to those skilled in the art, and the general principles defined herein may also be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments given herein, but is consistent with the broadest scope of the principles and novel features disclosed in this application.
[0145] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".
[0146] Those skilled in the art may also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention may be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly demonstrate the interchangeability of hardware and software, the various illustrative components, units, and steps described above have generally described their functions. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art may use various methods to implement the described functions for each specific application, but such implementation should not be understood as exceeding the scope of protection of the embodiments of the present invention.
[0147] The various illustrative logic blocks or units described in the embodiments of the present invention can be implemented or operated by a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of the above. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a digital signal processor core, or any other similar configuration.
[0148] The steps of the method or algorithm described in the embodiments of the present invention can be directly embedded in hardware, a software module executed by a processor, or a combination of the two. The software module can be stored in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or other storage media of any form in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be arranged in an ASIC, and the ASIC can be arranged in a user terminal. Optionally, the processor and the storage medium can also be arranged in different components in the user terminal.
[0149] In one or more exemplary designs, the above functions described in the embodiments of the present invention can be implemented in hardware, software, firmware or any combination of the three. If implemented in software, these functions can be stored on a computer-readable medium, or transmitted in the form of one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media that facilitate the transfer of computer programs from one place to another. The storage medium can be any available medium that can be accessed by any general or special computer. For example, such computer-readable media can include but are not limited to RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store program codes in the form of instructions or data structures and other forms that can be read by general or special computers, or general or special processors. In addition, any connection can be appropriately defined as a computer-readable medium, for example, if the software is transmitted from a website site, server or other remote resource through a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL) or wirelessly, such as infrared, wireless and microwave, it is also included in the defined computer-readable medium. The disk and disc include compact disk, laser disk, optical disk, DVD, floppy disk and blue-ray disk. Disks usually copy data magnetically, while discs usually copy data optically with lasers. The above combination can also be included in computer readable media.
[0150] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A sample selection method, characterized in that: include: Reasoning entities: Input unlabeled samples into the preliminary entity recognition model to reason and identify entities in the unlabeled samples, and output reasoning results corresponding to each unlabeled sample. The reasoning results include: entity, entity type, number of entities, and number of entities of each type; Calculate the probability distribution difference: for each inference result corresponding to the unlabeled sample, determine the probability distribution difference value of each type of entity in the inference result based on the sampling model of the probability distribution difference, and express the probability distribution difference between the entity category of the unlabeled sample and the entity category of the labeled sample through the probability distribution difference value of each type of entity; Update the labeled sample set: use the unlabeled samples whose probability distribution difference value is not less than a threshold as supplementary samples; the supplementary samples are used to supplement the labeled sample set to form an updated labeled sample set, and the updated labeled sample set is used to re-train the preliminary entity recognition model to obtain the final entity recognition model.
2. The sample selection method according to claim 1, characterized in that: Also includes: Constructing a sampling model based on probability distribution differences, wherein constructing a sampling model based on probability distribution differences specifically includes: Obtaining the labeling result of each labeling sample in the manually labeled labeling sample set, wherein the labeling result includes: entity, entity type, the number of each entity, and the number of entities of each type; A Gaussian probability density function of the entity type is determined based on the number of entities of each type in each of the labeled samples, and the Gaussian probability density function is used as a sampling model based on probability distribution differences.
3. The sample selection method according to claim 2, characterized in that: The construction of a sampling model based on probability distribution differences specifically includes: The Gaussian probability density function is normalized so that the value of the Gaussian probability density function is controlled within the range of [0, 1], and a sample sampling function is obtained. The sample sampling function is used as the final sampling model based on probability distribution difference.
4. The sample selection method according to claim 1, characterized in that: Also includes: Update the sampling model based on probability distribution differences: according to each labeled sample in the updated labeled sample set, update the parameter value of the sampling model based on probability distribution differences to obtain an updated sampling model based on probability distribution differences, and the updated sampling model based on probability distribution differences is used to select new unlabeled samples as supplementary samples; wherein the parameter values include: a mean matrix of the number of entities of each type and a covariance matrix formed by the number of entities of each type.
5. A method for identifying a named entity, characterized in that: A sample selection method comprising any one of claims 1 to 4; The method for identifying named entities further includes: Labeling samples: adding the manually labeled supplementary samples to the labeled sample set to form an updated labeled sample set; Updating the entity recognition model: using all the labeled samples in the updated labeled sample set to train the preliminary entity recognition model to obtain the final entity recognition model; Entity recognition: Identify named entities in the data to be recognized through the final entity recognition model.
6. The method for identifying named entities according to claim 5, characterized in that: The updating of the entity recognition model specifically includes: Using all the labeled samples in the updated labeled sample set to train a preliminary entity recognition model to obtain a current entity recognition model; The method for identifying named entities further includes: Test verification: Use the test set to test and verify the current entity recognition model, obtain the recognition result, and determine whether the accuracy of the recognition result reaches the preset accuracy; When the accuracy of the recognition result does not reach the preset accuracy, the step of inferring the entity, the step of calculating the probability distribution difference, the step of updating the labeled sample set, the step of labeling the sample and the step of updating the entity recognition model are looped in sequence for the new unlabeled sample, until in the step of testing and verifying, the recognition result obtained by testing and verifying the current entity recognition model reaches the preset accuracy, the loop is stopped, and the current entity recognition model is used as the final entity recognition model; When the accuracy of the recognition result reaches a preset accuracy, the current entity recognition model is used as the final entity recognition model.
7. A sample selection system, characterized in that: include: An entity reasoning unit is used to input unlabeled samples into a preliminary entity recognition model to perform reasoning and recognition on entities in the unlabeled samples, and output reasoning results corresponding to each unlabeled sample, wherein the reasoning results include: entity, entity type, number of each entity, and number of entities of each type; A probability distribution difference calculation unit is used to determine, for each inference result corresponding to the unlabeled sample, a probability distribution difference value of each type of entity in the inference result based on a sampling model of probability distribution difference, and to represent the probability distribution difference between the entity category of the unlabeled sample and the entity category of the labeled sample through the probability distribution difference value of each type of entity; The labeled sample set updating unit is used to take the unlabeled samples whose probability distribution difference value is not less than a threshold as supplementary samples; the supplementary samples are used to supplement the labeled sample set to form an updated labeled sample set, and the updated labeled sample set is used to re-train the preliminary entity recognition model to obtain the final entity recognition model.
8. The sample selection system according to claim 7, characterized in that: The invention also includes a sampling model construction unit based on probability distribution difference, wherein the sampling model construction unit based on probability distribution difference is used to: Obtaining the labeling result of each labeling sample in the manually labeled labeling sample set, wherein the labeling result includes: entity, entity type, the number of each entity, and the number of entities of each type; A Gaussian probability density function of the entity type is determined based on the number of entities of each type in each of the labeled samples, and the Gaussian probability density function is used as a sampling model based on probability distribution differences.
9. The sample selection system according to claim 8, characterized in that: The building blocks of the sampling model based on probability distribution differences are: It is also used to normalize the Gaussian probability density function so that the value of the Gaussian probability density function is controlled within the range of [0, 1], to obtain a sample sampling function, and to use the sample sampling function as the final sampling model based on probability distribution differences.
10. The sample selection system according to claim 7, characterized in that: Also includes: A sampling model updating unit is used to update the parameter value of the sampling model based on probability distribution difference according to each labeled sample in the updated labeled sample set, so as to obtain an updated sampling model based on probability distribution difference, wherein the updated sampling model based on probability distribution difference is used for selecting new unlabeled samples as supplementary samples; wherein the parameter value includes: a mean matrix of the number of entities of each type and a covariance matrix formed by the number of entities of each type.
11. A named entity recognition system, characterized in that: A sample selection system comprising any one of claims 7 to 10; The named entity recognition system further includes: A labeling unit, used for adding the manually labeled supplementary samples to the labeled sample set to form an updated labeled sample set; An entity recognition model training unit, used to train a preliminary entity recognition model using all the labeled samples in the updated labeled sample set to obtain a final entity recognition model; The entity recognition unit is used to identify the named entities in the data to be recognized through the final entity recognition model.
12. The named entity recognition system according to claim 11, characterized in that: Also includes a test unit, where: The entity recognition model training unit is specifically used to train a preliminary entity recognition model using all the labeled samples in the updated labeled sample set to obtain a current entity recognition model; and when the accuracy of the recognition result obtained in the testing unit reaches a preset accuracy, the current entity recognition model is used as the final entity recognition model; The testing unit is used to test and verify the current entity recognition model using a test set to obtain a recognition result, and determine whether the accuracy of the recognition result reaches a preset accuracy rate; The entity reasoning unit, the probability distribution difference calculation unit, the labeled sample set updating unit, the labeling unit and the entity recognition model training unit are all used for executing, in sequence, the entity reasoning unit, the probability distribution difference calculation unit, the labeled sample set updating unit, the labeling unit and the entity recognition model training unit for new unlabeled samples in a loop until the recognition result obtained by testing and verifying the current entity recognition model in the test unit reaches the preset accuracy, and then the loop execution is stopped.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and when the one or more programs are executed by a computer device, the computer device executes the sample selection method according to any one of claims 1 to 4.
14. A computer device, characterized in that: include: processor; And, a memory arranged to store computer executable instructions, which, when executed, cause the processor to perform the sample selection method according to any one of claims 1 to 4.
