Abnormity detection method and device for Chinese medical text, equipment and medium
By generating an adversarial network model, the problem of identifying abnormalities in high-dimensional complex texts is solved by generating an adversarial network model, which improves the accuracy and security of detection, and ensures the normal judgment of medical texts.
Patent Information
- Application Number
- CN202411031446.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-12
AI Technical Summary
Traditional abnormality detection methods often encounter dimensional disaster problems when facing high-dimensional complex Chinese medical texts, making it difficult to effectively identify abnormal data, resulting in an increase in the possibility of medical accidents and affecting the safety of patients' medical treatment.
The generative adversarial network model is adopted, and the Chinese medical text is projected into the target distribution through a distribution converter. The distribution discriminator recognizes whether it belongs to the normal distribution, and then determines whether the text is an abnormal text, and uses adversarial training to improve the recognition ability of the model.
Accurate abnormal detection of high-dimensional complex Chinese medical texts has been achieved, reducing the possibility of medical accidents, and ensuring the safety of patients' medical treatment.
Smart Images

Figure CN118942609A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of text detection, and in particular to an anomaly detection method, device, equipment and medium for Chinese medical texts. Background Art
[0002] The anomaly detection method is a data analysis and processing method that integrates knowledge and technology in the fields of probability statistics and machine learning. Its main purpose is to find possible anomalies and existing abnormal data in real data, so as to discover possible problems, loopholes, failures, etc. in the system, records or equipment, so as to actively warn and reduce the impact of such risk factors on people's production and life. Due to the great randomness of the generation of abnormal data, most of the collected and observed data are normal data. The proportion of abnormal data is often very low and its acquisition requires strong domain knowledge or time and cost consumption; therefore, anomaly detection often belongs to unsupervised learning, and its problem can be regarded as a one-class classification problem. Traditional anomaly detection methods are mainly based on traditional machine learning algorithms, such as Local Outlier Factor and Isolation Forest, to model, analyze and identify abnormal data.
[0003] Anomaly detection technology has a wide range of applications in our production and life, such as detecting equipment failures in industrial manufacturing, discovering fraud in financial transactions, or discovering possible lesions in medical tests. The inventors found that anomaly detection in medical tests mainly involves anomaly detection of medical texts, and Chinese medical texts contain detailed medical history, symptom descriptions, test results, and treatment plans. These information may be written by doctors, nurses, or other medical professionals, with many professional terms and rich and complex content. In addition, different hospitals, departments, and even different doctors may record in different ways, and there are inconsistencies in wording and expression. For example, the same disease may have multiple different names or abbreviations. With such diverse and highly complex text content, using traditional anomaly detection methods for anomaly detection often encounters the problem of dimensionality disaster. Therefore, there is an urgent need for a solution that can detect anomalies in high-dimensional and complex Chinese medical texts. Summary of the invention
[0004] In order to solve the problems in the related art, the embodiments of the present disclosure provide an anomaly detection method, apparatus, device and medium for Chinese medical text.
[0005] In a first aspect, an embodiment of the present disclosure provides an anomaly detection method for Chinese medical texts, the method comprising:
[0006] Preprocessing the Chinese medical text to be detected to generate word vector data corresponding to the Chinese medical text to be detected;
[0007] Input the word vector data into a distribution converter in a pre-trained generative adversarial network model, execute the distribution converter, and convert the word vector data into target word vector data that conforms to the target distribution;
[0008] The target word vector data is input into the distribution discriminator in the pre-trained generative adversarial network model, and the distribution discriminator is executed to determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text.
[0009] In a second aspect, the present disclosure provides a training method for generating an adversarial network model, including:
[0010] Preprocess n normal Chinese medical texts to generate n word vector data;
[0011] Sampling m vector data from vector data that conforms to the target distribution;
[0012] Based on the n word vector data and the m vector data, adversarial training is performed to obtain a trained generative adversarial network model, wherein the generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from vector data that conforms to the target distribution.
[0013] In a third aspect, the present disclosure provides an anomaly detection device for Chinese medical texts, including:
[0014] A processing module, configured to pre-process the Chinese medical text to be detected and generate word vector data corresponding to the Chinese medical text to be detected;
[0015] A conversion module is configured to input the word vector data into a distribution converter in a pre-trained generative adversarial network model, execute the distribution converter, and convert the word vector data into target word vector data that conforms to a target distribution;
[0016] The discrimination module is configured to input the target word vector data into the distribution discriminator in the pre-trained generative adversarial network model, execute the distribution discriminator, and determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text.
[0017] In a third aspect, an embodiment of the present disclosure provides a training device for generating an adversarial network model, including:
[0018] A generation module is configured to pre-process n normal Chinese medical texts and generate n word vector data;
[0019] A sampling module is configured to obtain m vector data by sampling from the vector data that conforms to the target distribution;
[0020] The training module is configured to perform adversarial training based on the n word vector data and the m vector data to obtain a trained generative adversarial network model, wherein the generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from the vector data that conforms to the target distribution.
[0021] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer instructions, and wherein the one or more computer instructions are executed by the processor to implement a method as described in any one of the first aspect or the second aspect.
[0022] In a sixth aspect, a computer-readable storage medium is provided in an embodiment of the present disclosure, on which computer instructions are stored. When the computer instructions are executed by a processor, a method as described in any one of the first aspect or the second aspect is implemented.
[0023] According to the technical solution provided by the embodiment of the present disclosure, a distribution converter and a distribution discriminator can be trained using a generative adversarial network, wherein the distribution converter is responsible for projecting Chinese medical text into a target distribution, and the distribution discriminator is responsible for identifying whether a vector data belongs to a specific prior distribution in the space of the target distribution. The adversarial training of the generative adversarial network improves the mapping ability of the distribution converter while improving the recognition ability of the distribution discriminator. When the generative adversarial network model trained in this way faces the word vector data corresponding to the Chinese medical text to be detected, it first uses the distribution converter to project it to the target distribution, and then uses the distribution discriminator to determine whether it belongs to the known prior distribution, that is, whether the word vector data of the normal Chinese medical text is converted by the distribution converter, thereby determining whether the Chinese medical text to be detected is an abnormal text. In this way, the distribution converter and the distribution discriminator can be used to accurately identify Chinese medical texts that may have problems, reduce the possibility of medical accidents, and ensure the safety of patients' medical treatment and medication.
[0024] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0026] Figure 1 A flowchart of an anomaly detection method for Chinese medical texts provided by an embodiment of the present disclosure is shown.
[0027] Figure 2 A schematic diagram of a process of abnormality detection provided by an embodiment of the present disclosure is shown.
[0028] Figure 3 A flowchart of a method for training a generative adversarial network model according to an embodiment of the present disclosure is shown.
[0029] Figure 4 A structural block diagram of an abnormality detection device for Chinese medical texts provided by an embodiment of the present disclosure is shown.
[0030] Figure 5 A structural block diagram of a training device for generating an adversarial network model provided by an embodiment of the present disclosure is shown.
[0031] Figure 6 A structural block diagram of an electronic device provided by an embodiment of the present disclosure is shown.
[0032] Figure 7 A schematic diagram showing the structure of a computer system suitable for implementing the method of the embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0033] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0034] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the present specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.
[0035] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0036] Figure 1FIG. 1 is a flowchart of an abnormality detection method for Chinese medical texts provided by an embodiment of the present disclosure. Figure 1 As shown, the anomaly detection method for Chinese medical texts includes the following steps S101-S103:
[0037] In step S101, the Chinese medical text to be detected is preprocessed to generate word vector data corresponding to the Chinese medical text;
[0038] In step S102, the word vector data is input into a distribution converter in a generative adversarial network model, and the distribution converter is executed to convert the word vector data into target word vector data that conforms to a target distribution;
[0039] In step S103, the target word vector data is input into the distribution discriminator in the generative adversarial network model, and the distribution discriminator is executed to determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text.
[0040] In a possible implementation, the anomaly detection method for Chinese medical texts is applicable to computers, computing devices, servers, server clusters and other devices that can perform anomaly detection of Chinese medical texts.
[0041] In a possible implementation, the original Chinese medical text cannot be directly analyzed and processed, and first needs to be preprocessed. Natural language processing (NLP) technology can be used for efficient and feasible preprocessing to convert the Chinese medical text into word vector data. In this implementation, the word vector technology in NLP can be used to convert the Chinese medical text into word vector data, and the conversion process mainly includes text segmentation, word vector model training and word vector data acquisition.
[0042] Here, since there is no obvious separator in Chinese, it is necessary to first use word segmentation technology to segment the Chinese medical text to be detected into individual words. The purpose of word segmentation is to segment the continuous text sequence into a meaningful word sequence, so as to facilitate subsequent text analysis and processing. The present embodiment does not limit the specific word segmentation technology, and the appropriate word segmentation technology can be selected according to the actual scene needs. After the word segmentation is completed, a pre-trained word vector model can be used to obtain the word vector representation corresponding to the word segmentation in the Chinese medical text to be detected, so that the word vector data corresponding to the Chinese medical text to be detected can be obtained. The pre-trained word vector model can be obtained by training an existing standard word vector model using the word segmentation of a large number of Chinese medical texts.
[0043] In a possible implementation, the pre-trained generative adversarial network model can be trained by other servers and sent to the device for anomaly detection, or it can be pre-trained by the device for anomaly detection. The pre-trained generative adversarial network model mainly includes a trained distribution converter and distribution discriminator Among them, θ * Representation Distribution Converter Multiple parameters in φ * Representation Distribution Converter These parameters are obtained after adversarial training of the distribution converter and the distribution discriminator. The distribution discriminator is used to convert the input word vector data into the target word vector data that conforms to the target distribution. Mainly judge whether the input target word vector data is normal Chinese medical text word vector data through the distribution converter If it is converted, then it is determined that the Chinese medical text corresponding to the target word vector data is a normal text; if not, then it is determined that the Chinese medical text corresponding to the target word vector data is an abnormal text.
[0044] In a possible implementation, the target distribution can be any simple and compact data distribution, and the type of the target distribution is not limited. The simplicity ensures the ease of sampling and is conducive to the learning of the decision boundary of the distribution discriminator; the compact target distribution ensures that the Chinese medical text can be mapped to the high-density area in the space where the target distribution is located through the distribution converter, which helps to find a clear and reliable decision boundary.
[0045] In this embodiment, a distribution converter and a distribution discriminator can be trained using a generative adversarial network, wherein the distribution converter is responsible for projecting Chinese medical text into a simple and compact target distribution, and the distribution discriminator is responsible for identifying whether a vector data belongs to a specific prior distribution in the target distribution space. The adversarial training of the generative adversarial network improves the mapping ability of the distribution converter while improving the recognition ability of the distribution discriminator. When the generative adversarial network model trained in this way faces the word vector data corresponding to the Chinese medical text to be tested, it first uses the distribution converter to project it to the target distribution, and then uses the distribution discriminator to determine whether it belongs to the known prior distribution, that is, whether the word vector data of the normal Chinese medical text is converted by the distribution converter, thereby determining whether the Chinese medical text to be tested is an abnormal text. In this way, the distribution converter and the distribution discriminator can be used to accurately identify medical records that may have problems, reduce the possibility of medical accidents, and ensure the safety of patients' medical treatment and medication.
[0046] In a possible implementation, the target distribution Including truncated Gaussian distribution Wherein, z is the vector data that conforms to the target distribution, ‖z‖2 is the L2 norm of z, and r is the cutoff radius of the truncated Gaussian distribution. Indicates that the mean is 0 and the covariance matrix is the identity matrix I m Gaussian distribution.
[0047] In a possible implementation, inputting the word vector data into a distribution converter in a pre-trained generative adversarial network model, executing the distribution converter, and converting the word vector data into target word vector data that conforms to a target distribution includes:
[0048] The word vector data x new Input to a pre-trained distribution transformer Execute the pre-trained distribution converter The word vector data x new Convert to target word vector data that conforms to the target distribution
[0049] Accordingly, the target word vector data is input into the distribution discriminator in the pre-trained generative adversarial network model, and the distribution discriminator is executed to determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text, including:
[0050] The target word vector data Input to the pre-trained distribution discriminator Execute the pre-trained distribution discriminator Get the abnormal score of the Chinese medical text corresponding to the target word vector data
[0051] like Then the word vector data x new The corresponding Chinese medical text is normal text;
[0052] like Then the word vector data x new The corresponding Chinese medical text is abnormal text.
[0053] For example, Figure 2 A schematic diagram of an abnormality detection process provided by an embodiment of the present disclosure is shown. There may be multiple Chinese medical texts to be detected. Multiple word vector data may be generated corresponding to the multiple Chinese medical texts. The set of multiple word vector data is recorded as X*. For a word vector data x in the set X*, new , the word vector data x new Input to Distribution Converter Execute the distributed converter Get distribution converter Output target word vector data that meets the target distribution The target word vector data Input to the distribution discriminator Execute the distribution discriminator Get the distribution discriminator Output anomaly score like This indicates that the target word vector data The word vector data of normal Chinese medical text is obtained through the distribution converter Converted, that is, the target word vector data Distributed converter for word vector data of abnormal Chinese medical text Converted, x new The corresponding Chinese medical text is abnormal text.
[0054] In a possible implementation, in addition to other servers pre-training the generative adversarial network model, the server performing anomaly detection may also pre-train the generative adversarial network model, and the method further includes:
[0055] Preprocess n normal Chinese medical texts to generate n word vector data;
[0056] Sampling m vector data from vector data that conform to the target distribution;
[0057] Based on the n word vector data and the m vector data, adversarial training is performed to obtain a trained generative adversarial network model, wherein the generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from vector data that conforms to the target distribution.
[0058] In this implementation, a normal Chinese medical text refers to a complete and diagnostically valid record of medical treatment and medication, otherwise it is considered an abnormal Chinese medical text; complete means that the Chinese medical text contains the patient's symptom description, the doctor's diagnosis results and the given medication prescription; valid means that the above three records match each other and comply with medical treatment and medication standards (domain experts are required to verify and annotate); this implementation uses normal Chinese medical texts for model training.
[0059] In this implementation, n normal Chinese medical texts can be segmented and input into a pre-trained word vector model, which generates n word vector data corresponding to the n normal Chinese medical texts, with each normal Chinese medical text corresponding to one word vector data.
[0060] In this implementation, m vector data may also be randomly sampled from the vector data that conforms to the target distribution, that is, the m vector data all conform to the target distribution.
[0061] In this embodiment, a distribution converter (DistributionConverter) and a distribution discriminator (Distribution Discriminator) can be trained in an adversarial learning manner. The distribution converter projects the n word vector data obtained by preprocessing normal Chinese medical text into a target distribution (such as a truncated Gaussian distribution). The distribution discriminator is used to identify the vector data projected from the word vector data and the vector data sampled from the target distribution. The distribution converter and the distribution discriminator are adversarially trained. After the generative adversarial network model converges or meets the termination condition, the trained generative adversarial network model is obtained, and then it can be used as Figure 2 As shown, the distribution transformer and distribution discriminant are directly used to calculate the anomaly score and then identify abnormal text.
[0062] In a possible implementation, the loss function of the generative adversarial network model is:
[0063]
[0064] in, Indicates that for the distribution that meets the target The vector data z sampled from the vector data of , the distribution discriminator D in the generative adversarial network model φ The probability of identifying it; Represents the distribution converter C in the generative adversarial network model θ The converted vector data C that conforms to the target distribution θ (x), distribution discriminator D in the generative adversarial network model φ The probability of identifying it; x is the word vector data generated based on normal Chinese medical text The word vector data in .
[0065] In this embodiment, E stands for expectation. Represents z sampling from the target distribution Vector data, D φ is the distribution discriminator for adversarial training, Indicates that for the distribution that meets the target The vector data z sampled from the vector data, the distribution discriminator D φ The probability of identifying it is Represents that x comes from word vector data generated based on normal Chinese medical text C θ For the distribution converter during adversarial training, For the distributed converter C θ The converted vector data C that conforms to the target distribution θ (x), the distribution discriminator D φ The probability of identifying it. During adversarial training, the distribution converter C θ The optimization goal is to make the generated vector data C conform to the target distribution θ (x) Try not to be distributed by the discriminator D φ Identify, the distribution discriminator D φ The optimization goal is to try to identify The vector data and the distribution converter C θ The converted vector data conforming to the target distribution are trained against each other. Through the maximum and minimum game, the above loss function converges to obtain the trained distribution converter. and distribution discriminator
[0066] In a possible implementation, the performing adversarial training based on the n word vector data and the m vector data to obtain a trained generative adversarial network model includes:
[0067] Sample m word vector data from n word vector data as m first samples;
[0068] The distribution discriminator is trained using the m first samples and the m vector data, and the parameter φ in the distribution discriminator in the s+1th cycle is updated using the following formula s+1 :
[0069]
[0070] Sample new m second samples from n word vector data;
[0071] The distribution converter is trained using the m second samples, and the parameter θ in the distribution converter in the s+1th cycle is updated using the following formula s+1 :
[0072]
[0073] Repeat the above steps until the loss function of the generative adversarial network model converges, the training is completed, and the trained distribution converter and distribution identifier are obtained;
[0074] Among them, z i To sample the i-th vector data among the m vector data, x i is the i-th first sample among the m first samples, x i* is the i*th second sample among the m second samples; D φ is the distribution discriminator, C θ For distributed converters, represents the gradient with respect to φ, represents the gradient with respect to θ, φ s represents the parameters in the distribution discriminator at the sth cycle, φ s+1 represents the parameters in the distribution discriminator at the s+1th cycle, θ s Represents the parameters in the distribution converter at the sth cycle.
[0075] In this embodiment, when performing adversarial training, the initial parameter φ in the distribution discriminator is first set s=0 and the parameter θ in the distribution converter s=0 , then, the parameters θ in the distribution transformer s=0 Unchanged, first use m first samples and m vector data to train the distribution discriminator, and use the gradient ascent algorithm to update the parameter φ in the distribution discriminator in the s+1=1th cycle s+1=1 , then, the parameter φ in the distribution discriminator s+1=1 Unchanged, use m second samples to train the distribution converter, and use the gradient ascent algorithm to update the parameters θ in the distribution converter in the s+1=1th cycle s+1=1 ; The above training process is repeated until the loss function reaches the training requirement, that is, converges, the training ends, and the trained distribution converter is obtained and distribution identifier
[0076] The model training process provided in this embodiment can fully explore and utilize normal Chinese medical texts annotated by doctors or domain experts, and use generative adversarial networks to learn to standardize the distribution pattern of normal Chinese medical texts, and then find a credible decision boundary, identify Chinese medical texts that may have problems, that is, abnormal texts, reduce the possibility of medical accidents, and ensure the safety of patients' medical treatment and medication.
[0077] The present disclosure also provides a training method for generating a confrontation network model. Figure 3 A flow chart of a training method for generating an adversarial network model according to an embodiment of the present disclosure is shown. Figure 3As shown, the training method of the generative adversarial network model includes the following steps S301-S303:
[0078] In step S301, n normal Chinese medical texts are preprocessed to generate n word vector data;
[0079] In step S302, m vector data are obtained by sampling from the vector data that conforms to the target distribution;
[0080] In step S303, adversarial training is performed based on the n word vector data and the m vector data to obtain a generative adversarial network model, wherein the generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from vector data that conforms to the target distribution.
[0081] In one possible implementation, the training method for the generative adversarial network model is applicable to computers, computing devices, servers, server clusters and other devices that can train the generative adversarial network model.
[0082] In a possible implementation, a normal Chinese medical text refers to a complete and diagnostically valid medical record, otherwise it is considered an abnormal Chinese medical text; wherein, complete means that the Chinese medical text contains the patient's symptom description, the doctor's diagnosis and the given medication prescription; valid means that the above three records match each other and meet the medical and medication standards (field experts are required to verify and annotate); this implementation uses normal Chinese medical texts for model training. After n normal Chinese medical texts are segmented, they can be input into a pre-trained word vector model, and the word vector model generates n word vector data corresponding to the n normal Chinese medical texts, and each normal Chinese medical text corresponds to one word vector data.
[0083] In a possible implementation, m vector data may be randomly sampled from the vector data that conforms to the target distribution, that is, the m vector data all conform to the target distribution.
[0084] In a possible implementation, the target distribution can be any simple and compact data distribution, and the type of the target distribution is not limited. The simplicity ensures the ease of sampling and is conducive to the learning of the decision boundary of the distribution discriminator; the compact target distribution ensures that the Chinese medical text can be mapped to the high-density area in the space where the target distribution is located through the distribution converter, which helps to find a clear and reliable decision boundary. In this implementation, the target distribution Can be a truncated Gaussian distribution.
[0085] In one possible implementation, a distribution converter (Distribution Converter) and a distribution discriminator (Distribution Discriminator) can be trained in an adversarial learning manner. The distribution converter projects the n word vector data obtained by preprocessing normal Chinese medical text into a target distribution (such as a truncated Gaussian distribution). The distribution discriminator is used to identify the vector data projected from the word vector data and the vector data sampled from the target distribution. The distribution converter and the distribution discriminator are adversarially trained. After the generative adversarial network model converges or meets the termination condition, the trained generative adversarial network model is obtained, and then it can be used as follows. Figure 2 As shown, the distribution transformer and distribution discriminant are directly used to calculate the anomaly score and then identify abnormal text.
[0086] The model training process provided in this embodiment can fully explore and utilize normal Chinese medical texts annotated by doctors or domain experts, and use generative adversarial networks to learn to standardize the distribution pattern of normal Chinese medical texts, and then find a credible decision boundary, identify Chinese medical texts that may have problems, that is, abnormal texts, reduce the possibility of medical accidents, and ensure the safety of patients' medical treatment and medication.
[0087] In a possible implementation, the loss function of the generative adversarial network model is:
[0088]
[0089] in, Indicates that for the distribution that meets the target The vector data z sampled from the vector data of , the distribution discriminator in the generative adversarial network model The probability of identifying it; Represents the distribution converter C in the generative adversarial network model θ The converted vector data C that conforms to the target distribution θ (x), distribution discriminator D in the generative adversarial network model φ The probability of identifying it; x is the word vector data generated based on normal Chinese medical text The word vector data in .
[0090] In this embodiment, It represents expectations. Represents z sampling from the target distribution Vector data, D φ is the distribution discriminator for adversarial training, Indicates that for the distribution that meets the target The vector data z sampled from the vector data, the distribution discriminator D φ The probability of identifying it is Represents that x comes from word vector data generated based on normal Chinese medical text C θ For the distribution converter during adversarial training, For the distributed converter C θ The converted vector data C that conforms to the target distribution θ (x), the distribution discriminator D φ The probability of identifying it. During adversarial training, the distribution converter C θ The optimization goal is to make the generated vector data C conform to the target distribution θ (x) Try not to be distributed by the discriminator D φ Identify, the distribution discriminator D φ The optimization goal is to try to identify The vector data and the distribution converter C θ The converted vector data conforming to the target distribution are trained against each other. Through the maximum and minimum game, the above loss function converges to obtain the trained distribution converter. and distribution discriminator
[0091] In a possible implementation, the performing adversarial training based on the n word vector data and the m vector data to obtain a trained generative adversarial network model includes:
[0092] Sample m word vector data from n word vector data as m first samples;
[0093] The distribution discriminator is trained using the m first samples and the m vector data, and the parameter φ in the distribution discriminator in the s+1th cycle is updated using the following formula s+1 :
[0094]
[0095] Sample new m second samples from n word vector data;
[0096] The distribution converter is trained using the m second samples, and the parameter θ in the distribution converter in the s+1th cycle is updated using the following formula s+1 :
[0097]
[0098] Repeat the above steps until the loss function of the generative adversarial network model converges, the training is completed, and the trained distribution converter and distribution identifier are obtained;
[0099] Among them, z i To sample the i-th vector data among the m vector data, x i is the i-th first sample among the m first samples, x i* is the i*th second sample among the m second samples; D φ is the distribution discriminator, C θ For distributed converters, represents the gradient with respect to φ, represents the gradient with respect to θ, φ s represents the parameters in the distribution discriminator at the sth cycle, φ s+1 represents the parameters in the distribution discriminator at the s+1th cycle, θ s Represents the parameters in the distribution converter at the sth cycle.
[0100] In this embodiment, when performing adversarial training, the initial parameter φ in the distribution discriminator is first set s=0 and the parameter θ in the distribution converter s=0 , then, the parameters θ in the distribution transformer s=0 Unchanged, first use m first samples and m vector data to train the distribution discriminator, and use the gradient ascent algorithm to update the parameter φ in the distribution discriminator in the s+1=1th cycle s+1=1 , then, the parameter φ in the distribution discriminator s+1=1 Unchanged, use m second samples to train the distribution converter, and use the gradient ascent algorithm to update the parameters θ in the distribution converter in the s+1=1th cycle s+1=1 ; The above training process is repeated until the loss function reaches the training requirement, that is, converges, the training ends, and the trained distribution converter is obtained and distribution identifier
[0101] The present disclosure also provides an abnormality detection device for Chinese medical texts. Figure 4 The structure block diagram of an abnormality detection device for Chinese medical texts provided by an embodiment of the present disclosure is shown. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 4 As shown, the anomaly detection device for Chinese medical texts includes:
[0102] The processing module 401 is configured to pre-process the Chinese medical text to be detected and generate word vector data corresponding to the Chinese medical text to be detected;
[0103] A conversion module 402 is configured to input the word vector data into a distribution converter in a pre-trained generative adversarial network model, execute the distribution converter, and convert the word vector data into target word vector data that conforms to a target distribution;
[0104] The discrimination module 403 is configured to input the target word vector data into the distribution discriminator in the pre-trained generative adversarial network model, execute the distribution discriminator, and determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text.
[0105] In one possible implementation, the target distribution includes a truncated Gaussian distribution Wherein, z is the vector data that conforms to the target distribution, ‖z‖2 is the L2 norm of z, and r is the cutoff radius of the truncated Gaussian distribution. Indicates that the mean is 0 and the covariance matrix is the identity matrix I m Gaussian distribution.
[0106] In a possible implementation, the inputting the word vector data into a distribution converter in a generative adversarial network model, executing the distribution converter, and converting the word vector data into target word vector data that conforms to a target distribution includes:
[0107] The word vector data x new Distribution Transformer Input to Generative Adversarial Network Model Execute the distributed converter The word vector data x new Convert to target word vector data that conforms to the target distribution
[0108] Accordingly, the target word vector data is input into the distribution discriminator in the generative adversarial network model, and the distribution discriminator is executed to determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text, including:
[0109] The target word vector data Distribution discriminator input to the generative adversarial network model Execute the distribution discriminator Get the abnormal score of the Chinese medical text corresponding to the target word vector data
[0110] like Then the word vector data x new The corresponding Chinese medical text is normal text;
[0111] like Then the word vector data x newThe corresponding Chinese medical text is abnormal text.
[0112] In a possible implementation manner, the method further includes:
[0113] Preprocess n normal Chinese medical texts to generate n word vector data;
[0114] Sampling m vector data from vector data that conform to the target distribution;
[0115] Based on the n word vector data and the m vector data, adversarial training is performed to obtain a trained generative adversarial network model, wherein the trained generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from vector data that conforms to the target distribution.
[0116] The loss function of the generative adversarial network model is:
[0117]
[0118] in, Indicates that for the distribution that meets the target The vector data z sampled from the vector data of , the distribution discriminator D in the generative adversarial network model φ The probability of identifying it; Represents the distribution converter C in the generative adversarial network model θ The converted vector data C that conforms to the target distribution θ (x), distribution discriminator D in the generative adversarial network model φ The probability of identifying it; x is the word vector data generated based on normal Chinese medical text The word vector data in .
[0119] In a possible implementation, performing adversarial training based on the n word vector data and the m vector data to obtain a trained generative adversarial network model includes:
[0120] Sample m word vector data from n word vector data as m first samples;
[0121] The distribution discriminator is trained using the m first samples and the m vector data, and the parameter φ in the distribution discriminator in the s+1th cycle is updated using the following formula s+1 :
[0122]
[0123] Sample new m second samples from n word vector data;
[0124] The distribution converter is trained using the m second samples, and the parameter θ in the distribution converter in the s+1th cycle is updated using the following formula s+1 :
[0125]
[0126] Repeat the above steps until the loss function of the generative adversarial network model converges, the training is completed, and the trained distribution converter and distribution identifier are obtained;
[0127] Among them, z i To sample the i-th vector data among the m vector data, x i is the i-th first sample among the m first samples, x i* is the i*th second sample among the m second samples; D φ is the distribution discriminator during adversarial training, Cθ 为 Distribution transformer for adversarial training, represents the gradient with respect to φ, represents the gradient with respect to θ, φ s represents the parameters in the distribution discriminator at the sth cycle, φ s+1 represents the parameters in the distribution discriminator at the s+1th cycle, θ s Represents the parameters in the distribution converter at the sth cycle.
[0128] The present disclosure also provides a training device for generating a confrontation network model. Figure 5 The structural block diagram of a training device for generating an adversarial network model provided by an embodiment of the present disclosure is shown. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 5 As shown, the training device for generating an adversarial network model includes:
[0129] A generating module 501 is configured to pre-process n normal Chinese medical texts to generate n word vector data;
[0130] A sampling module 502 is configured to sample m vector data from the vector data that conforms to the target distribution;
[0131] The training module 503 is configured to perform adversarial training based on the n word vector data and the m vector data to obtain a generative adversarial network model, wherein the generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from vector data that conforms to the target distribution.
[0132] In a possible implementation, the loss function of the generative adversarial network model is:
[0133]
[0134] in, Indicates that for the distribution that meets the target The vector data z sampled from the vector data, the distribution discriminator D φ The probability of identifying it is For the distributed converter C θ The converted vector data C that conforms to the target distribution θ (x), the distribution discriminator D φ The probability of identifying it.
[0135] In a possible implementation, performing adversarial training based on the n word vector data and the m vector data to obtain a trained generative adversarial network model includes:
[0136] Sample m word vector data from n word vector data as m first samples;
[0137] The distribution discriminator is trained using the m first samples and the m vector data, and the parameter φ in the distribution discriminator in the s+1th cycle is updated using the following formula s+1 :
[0138]
[0139] Sample new m second samples from n word vector data;
[0140] The distribution converter is trained using the m second samples, and the parameter θ in the distribution converter in the s+1th cycle is updated using the following formula s+1 :
[0141]
[0142] Repeat the above steps until the loss function of the generative adversarial network model converges, the training is completed, and the trained distribution converter and distribution identifier are obtained;
[0143] Among them, z i To sample the i-th vector data among the m vector data, x i is the i-th first sample among the m first samples, x i* is the i-th second sample among the m second samples; D φ is the distribution discriminator, C θ For distributed converters, represents the gradient with respect to φ, represents the gradient with respect to θ, φ s represents the parameters in the distribution discriminator at the sth cycle, φ s+1 represents the parameters in the distribution discriminator at the s+1th cycle, θ s Represents the parameters in the distribution converter at the sth cycle.
[0144] The technical terms and technical features mentioned in the implementation manner of the present device are the same as or similar to those mentioned in the implementation manner of the above method. For the explanation and description of the technical terms and technical features involved in the present device, reference may be made to the explanation and description of the implementation manner of the above method, and they will not be repeated here.
[0145] The present disclosure also discloses an electronic device, Figure 6 A structural block diagram of an electronic device provided by an embodiment of the present disclosure is shown.
[0146] like Figure 6 As shown, the electronic device 600 includes a memory 601 and a processor 602, wherein the memory 601 is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 602 to implement the method according to an embodiment of the present disclosure.
[0147] Figure 7 A schematic diagram showing the structure of a computer system suitable for implementing the method of the embodiment of the present disclosure is shown.
[0148] like Figure 7 As shown, the computer system 700 includes a processing unit 701, which can perform various processes in the above-mentioned embodiments according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the computer system 700 are also stored. The processing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0149] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed. Among them, the processing unit 701 can be implemented as a processing unit such as a CPU, a GPU, a TPU, an FPGA, an NPU, etc.
[0150] In particular, according to an embodiment of the present disclosure, the method described above can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes computer instructions, and the computer instructions are executed by a processor to implement the method steps described above. In such an embodiment, the computer program product can be downloaded and installed from a network through the communication part 709, and / or installed from a removable medium 711.
[0151] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0152] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or programmable hardware. The units or modules described may also be set in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.
[0153] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into a device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.
[0154] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. An anomaly detection method for Chinese medical texts, It is characterized in that The method comprises: Preprocessing the Chinese medical text to be detected to generate word vector data corresponding to the Chinese medical text to be detected; Input the word vector data into a distribution converter in a pre-trained generative adversarial network model, execute the distribution converter, and convert the word vector data into target word vector data that conforms to the target distribution; The target word vector data is input into the distribution discriminator in the pre-trained generative adversarial network model, and the distribution discriminator is executed to determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text.
2. The method according to claim 1, It is characterized in that The target distribution includes a truncated Gaussian distribution Among them, z is the vector data that conforms to the target distribution, ‖z‖ 2 is the L2 norm of z, r is the cutoff radius of the truncated Gaussian distribution, Indicates that the mean is 0 and the covariance matrix is the identity matrix I m Gaussian distribution.
3. The method according to claim 2, It is characterized in that The step of inputting the word vector data into a distribution converter in a pre-trained generative adversarial network model, executing the distribution converter, and converting the word vector data into target word vector data that conforms to a target distribution includes: The word vector data x new Input to a pre-trained distribution transformer Execute the pre-trained distribution converter The word vector data x new Convert to target word vector data that conforms to the target distribution Accordingly, the target word vector data is input into the distribution discriminator in the pre-trained generative adversarial network model, and the distribution discriminator is executed to determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text, including: The target word vector data Input to the pre-trained distribution discriminator Execute the pre-trained distribution discriminator Get the abnormal score of the Chinese medical text corresponding to the target word vector data like Then the word vector data x new The corresponding Chinese medical text is normal text; like Then the word vector data x new The corresponding Chinese medical text is abnormal text.
4. The method according to claim 1, It is characterized in that The method further comprises: Preprocess n normal Chinese medical texts to generate n word vector data; Sampling m vector data from vector data that conform to the target distribution; Based on the n word vector data and the m vector data, adversarial training is performed to obtain a trained generative adversarial network model, wherein the trained generative adversarial network model includes a distribution converter and a distribution discriminator. When adversarial training is performed on the distribution converter and the distribution discriminator, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from the vector data that conforms to the target distribution; Wherein, m and n are both positive integers.
5. The method according to claim 4, It is characterized in that The loss function of the generative adversarial network model is: in, Indicates that for the distribution that meets the target The vector data z sampled from the vector data of , the distribution discriminator D in the generative adversarial network model φ The probability of identifying it; Represents the distribution converter C in the generative adversarial network model θ The converted vector data C that conforms to the target distribution θ (x), distribution discriminator D in the generative adversarial network model φ The probability of identifying it; x is the word vector data generated based on normal Chinese medical text The word vector data in .
6. The method according to claim 5, It is characterized in that The method of performing adversarial training based on the n word vector data and the m vector data to obtain a trained generative adversarial network model includes: Sample m word vector data from n word vector data as m first samples; The distribution discriminator is trained using the m first samples and the m vector data, and the parameter φ in the distribution discriminator in the s+1th cycle is updated using the following formula s+1 : Sample new m second samples from n word vector data; The distribution converter is trained using the m second samples, and the parameter θ in the distribution converter in the s+1th cycle is updated using the following formula s+1 : The above steps are repeated until the loss function of the generative adversarial network model converges, and the training is completed to obtain a trained generative adversarial network model; Among them, z i To sample the i-th vector data among the m vector data, x i is the i-th first sample among the m first samples, x i* is the i*th second sample among the m second samples; D φ is the distribution discriminator during adversarial training, C θ For the distribution converter during adversarial training, represents the gradient with respect to φ, represents the gradient with respect to θ, φ s represents the parameters in the distribution discriminator at the sth cycle, φ s+1 represents the parameters in the distribution discriminator at the s+1th cycle, θ s Represents the parameters in the distribution converter at the sth cycle.
7. A training method for generating adversarial network models, It is characterized in that include: Preprocess n normal Chinese medical texts to generate n word vector data; Sampling m vector data from vector data that conforms to the target distribution; Based on the n word vector data and the m vector data, adversarial training is performed to obtain a trained generative adversarial network model, wherein the generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from vector data that conforms to the target distribution.
8. An anomaly detection device for Chinese medical texts, It is characterized in that include: A processing module, configured to pre-process the Chinese medical text to be detected and generate word vector data corresponding to the Chinese medical text to be detected; A conversion module is configured to input the word vector data into a distribution converter in a pre-trained generative adversarial network model, execute the distribution converter, and convert the word vector data into target word vector data that conforms to a target distribution; The discrimination module is configured to input the target word vector data into the distribution discriminator in the pre-trained generative adversarial network model, execute the distribution discriminator, and determine whether the Chinese medical text corresponding to the target word vector data is an abnormal text.
9. A training device for generating adversarial network models, It is characterized in that include: A generation module is configured to pre-process n normal Chinese medical texts and generate n word vector data; A sampling module is configured to obtain m vector data by sampling from the vector data that conforms to the target distribution; The training module is configured to perform adversarial training based on the n word vector data and the m vector data to obtain a trained generative adversarial network model, wherein the generative adversarial network model includes a distribution converter and a distribution discriminator. When the distribution converter and the distribution discriminator are subjected to adversarial training, the distribution converter is used to convert the input word vector data into vector data that conforms to the target distribution, and the distribution discriminator is used to discriminate whether the input vector data is output by the distribution converter or sampled from the vector data that conforms to the target distribution.
10. An electronic device, It is characterized in that The method comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method according to any one of claims 1 to 7.
11. A readable storage medium, It is characterized in that Computer instructions are stored thereon, and when the computer instructions are executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.
