Training methods, usage methods, devices, equipment and media for risk identification models
By performing data augmentation and analysis of word vectors and word vectors on the training samples in news reports, the problems of insufficient samples and uneven distribution in the training of risk identification model in news reports are solved, and the accuracy of risk identification is improved.
Patent Information
- Application Number
- CN202111607174.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2041-12-24
AI Technical Summary
In news reports, in the automatic risk identification process, due to the small number of news samples that reflect risks and the uneven distribution of risks in various categories, an effective risk identification model cannot be trained.
By performing data augmentation processing on the training samples, more training samples are generated, and risk classification models and subject recognition models are trained using word vectors and word vector sets, considering the connection between words and subject names in news statements.
The number of news samples reflecting risks has been increased, the distribution differences between various categories of risks has been narrowed, and the accuracy of risk category prediction and subject identification has been improved.
Smart Images

Figure CN114265938B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of machine learning, and more specifically, to a risk identification model training, use method, device, equipment, medium and program product. Background Art
[0002] News reports are characterized by high timeliness, authenticity, and extensiveness. Therefore, the purpose of risk identification can be achieved by judging the content of news reports. News reports generally include the names of legal persons or citizens. When conducting risk identification, the subject and risk category of the news release can be obtained.
[0003] When risk identification is performed based on news content, it can be done manually by monitoring and identifying, but the labor cost is high and the timeliness is poor. In the process of realizing automatic risk identification, due to the small number of news samples reflecting risks and the uneven distribution of news samples of various categories of risks in these samples, it is impossible to train an effective risk identification model. Summary of the invention
[0004] In view of the above problems, the present disclosure provides a training method that can obtain an effective risk identification model by performing data enhancement on training samples, as well as a method for using the risk identification model, and also provides corresponding devices, equipment, media and program products.
[0005] One aspect of an embodiment of the present disclosure provides a method for training a risk identification model, wherein the risk identification model includes a risk classification model and a subject identification model, and specifically includes: obtaining a first training sample, wherein the first training sample is any one of N news sentences in a training set, and N is an integer greater than or equal to 1; performing data enhancement processing on the first training sample to obtain M second training samples, wherein the data enhancement processing includes replacing at least one word in the first training sample, and M is an integer greater than or equal to 1; training the risk classification model based on a set of word vectors obtained from each of the second training samples, wherein the set of word vectors is obtained by decomposing each of the second training samples to obtain a first set of words; training the subject identification model based on a set of character vectors obtained from each of the second training samples, wherein the set of character vectors is obtained by decomposing each of the second training samples to obtain a first set of characters.
[0006] According to an embodiment of the present disclosure, the first training sample includes subject-class words and non-subject-class words, and the replacing of at least one word in the first training sample includes: replacing at least one of the subject-class words and non-subject-class words; wherein, in the case of replacing the subject-class words, the subject-class words are replaced with different subjects, and in the case of replacing the non-subject-class words, the non-subject-class words are replaced with synonyms or near-synonyms.
[0007] According to an embodiment of the present disclosure, the replacing of at least one word in the first training sample includes: replacing at least one word in the first training sample based on a preset replacement ratio, wherein the preset replacement ratio includes the ratio of the number of replaced words to the number of all words in the first training sample.
[0008] According to an embodiment of the present disclosure, after obtaining the first training sample, the method further includes: marking at least one risk category label for each of the first training samples; and / or marking a subject category label for each word in each of the first training samples.
[0009] According to an embodiment of the present disclosure, the risk classification model includes a first pre-trained model and a first bidirectional long short-term memory model, and the word vector set obtained based on each second training sample, training the risk classification model includes: inputting the first word set into the first pre-trained model so that the first pre-trained model outputs the word vector set; inputting the word vector set into the first bidirectional long short-term memory model so that the first bidirectional long short-term memory model outputs at least one first predicted risk category; and training based on the degree of difference between the at least one first predicted risk category and at least one risk category label corresponding to the second training sample.
[0010] According to an embodiment of the present disclosure, the risk classification model also includes a first conditional random field model, and the training based on the degree of difference between the at least one first predicted risk category and at least one risk category label corresponding to the second training sample includes: inputting the at least one predicted risk category into the first conditional random field model so that the first conditional random field model outputs at least one second predicted risk category; and training based on the degree of difference between the at least one second predicted risk category and at least one risk category label corresponding to the second training sample.
[0011] According to an embodiment of the present disclosure, the subject recognition model includes a second pre-trained model and a second bidirectional long short-term memory model, and the character vector set obtained based on each second training sample, training the subject recognition model includes: inputting the first character set into the second pre-trained model so that the second pre-trained model outputs the character vector set; inputting the character vector set into the second bidirectional long short-term memory model so that the second bidirectional long short-term memory model outputs at least one first predicted subject result; training is performed based on the degree of difference between at least one of the first predicted subject results and the subject category label corresponding to each character in the second training sample, wherein each of the first predicted subject results corresponds to the predicted subject category of each character in the second training sample.
[0012] According to an embodiment of the present disclosure, the subject recognition model also includes a second conditional random field model, and the training based on the degree of difference between at least one of the first predicted subject results and the subject category label corresponding to each character in the second training sample includes: inputting at least one of the first predicted subject results into the second conditional random field model so that the second conditional random field model outputs a second predicted subject result; and training based on the degree of difference between the second predicted subject result and the subject category label corresponding to each character in the second training sample, wherein the second predicted subject result includes the predicted subject category of each character in the second training sample.
[0013] Another aspect of an embodiment of the present disclosure provides a method for using a risk identification model, wherein the risk identification model is obtained according to any one of the training methods described above, and specifically includes: obtaining a first news sentence to be detected, wherein the first news sentence is any one of S news sentences to be detected, and S is an integer greater than or equal to 1; inputting a second word set into a risk classification model so that the risk classification model outputs at least one third predicted risk category of the first news sentence, wherein the second word set is obtained by decomposing the first news sentence; in the case where there is a specific risk category in the at least one third predicted risk category, inputting a second text set into a subject recognition model so that the subject recognition model outputs the risk subject in the first news sentence, wherein the second text set is obtained by decomposing the first news sentence; and outputting at least one of the at least one third predicted risk category, the risk subject, and the location information of the risk subject.
[0014] Another aspect of an embodiment of the present disclosure provides a training device for a risk identification model, wherein the risk identification model includes a risk classification model and a subject identification model, and specifically includes: a first acquisition module, used to obtain a first training sample, wherein the first training sample is any one of N news sentences in a training set, and N is an integer greater than or equal to 1; an enhancement processing module, used to perform data enhancement processing on the first training sample to obtain M second training samples, wherein the data enhancement processing includes replacing at least one word in the first training sample, and M is an integer greater than or equal to 1; a first training module, used to train the risk classification model based on a word vector set obtained from each of the second training samples, wherein the word vector set is obtained by decomposing each of the second training samples to obtain a first word set; a second training module, used to train the subject identification model based on a character vector set obtained from each of the second training samples, wherein the character vector set is obtained by decomposing each of the second training samples to obtain a first character set.
[0015] Another aspect of an embodiment of the present disclosure provides a device for using a risk identification model, wherein the risk identification model is obtained according to the training device as described above, and specifically includes: a second acquisition module, used to obtain a first news sentence to be detected, wherein the first news sentence is any one of S news sentences to be detected, and S is an integer greater than or equal to 1; a first input module, used to input a second word set into a risk classification model, so that the risk classification model outputs at least one third predicted risk category of the first news sentence, wherein the second word set is obtained by decomposing the first news sentence; a second input module, used to input a second text set into a subject recognition model, when there is a specific risk category in the at least one third predicted risk category, so that the subject recognition model outputs the risk subject in the first news sentence, wherein the second text set is obtained by decomposing the first news sentence; a result output module, used to output at least one of the at least one third predicted risk category, the risk subject, and the location information of the risk subject.
[0016] Another aspect of an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the method as described above.
[0017] Another aspect of the embodiments of the present disclosure further provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the method as described above.
[0018] Another aspect of the embodiments of the present disclosure further provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0019] One or more of the above-mentioned embodiments have the following beneficial effects: first, by performing data enhancement processing on any training sample in the training set, M second training samples can be obtained based on a first training sample, thereby increasing the number of news samples reflecting risks and reducing the distribution differences of news samples of different categories of risks; second, by training the risk classification model with a word vector set obtained based on the word set of each second training sample, the connection between words in the news sentences can be considered, thereby improving the accuracy of risk category prediction; finally, by training the subject recognition model with a character vector set obtained based on the text set of each second training sample, the characteristics of the subject name and the connection between each character in the subject name can be considered, thereby improving the accuracy of subject recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0021] Figure 1 An application scenario diagram schematically illustrates a training method and a use method suitable for implementing a risk identification model according to an embodiment of the present disclosure;
[0022] Figure 2 A flowchart schematically illustrates a method for training a risk identification model according to an embodiment of the present disclosure;
[0023] Figure 3 A schematic diagram schematically shows a data enhancement process according to an embodiment of the present disclosure;
[0024] Figure 4 Schematically shows a flow chart of training a risk classification model according to an embodiment of the present disclosure;
[0025] Figure 5 Schematically shows a data processing diagram for training a risk classification model according to an embodiment of the present disclosure;
[0026] Figure 6 A flowchart of training a subject recognition model according to an embodiment of the present disclosure is schematically shown;
[0027] Figure 7 Schematically shows a data processing diagram for training a subject recognition model according to an embodiment of the present disclosure;
[0028] Figure 8 A flowchart schematically illustrates a method for training a risk identification model according to another embodiment of the present disclosure;
[0029] Fig. 9 A flowchart schematically illustrates a method for using a risk identification model according to an embodiment of the present disclosure;
[0030] Fig.10 The structure block diagram of the training device of the risk identification model according to the embodiment of the present disclosure is schematically shown;
[0031] Fig.11 A structural block diagram schematically shows a device for using a risk identification model according to an embodiment of the present disclosure;
[0032] Fig.12 A block diagram of an electronic device suitable for implementing a training method and a use method of a risk identification model according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0033] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0034] The relevant terms involved in some embodiments of the present disclosure have the meanings commonly understood by those skilled in the art:
[0035] EDA (Easy Data Augmentation): A data augmentation algorithm for text. When the amount of data and corpus are insufficient, it can enhance the corpus to a certain extent and expand the text training set, thereby avoiding overfitting of the model and improving the performance of text classification. EDA can include four operations, namely SR synonym replacement, RI random insertion, RS random exchange and RD random deletion.
[0036] BERT (Bidirectional Encoder Representation From Transformers): A pre-trained language model that uses a multi-layer bidirectional transformer encoder to generate deep bidirectional language representations that incorporate left and right context information.
[0037] Bi-directional Long Short-Term Memory (BiLSTM): is a type of recurrent neural network (RNN). It uses a large number of data samples to learn the features of text sequences and obtain dependencies. Compared with the ordinary LSTM model, BiLSTM obtains positive and negative bidirectional word dependencies.
[0038] Conditional Random Fields (CRF): A basic language model used in scenarios such as word segmentation, entity recognition, and part-of-speech tagging. When CRF selects a label for each node from n labels, it also considers the transition probability between the label of the previous node and the label of this node, and calculates the optimal label sequence based on the two. CRF pays attention to the relationship between adjacent texts.
[0039] It should be noted that all terms (including technical and scientific terms) used in the embodiments of the present disclosure have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0040] In the technical solution disclosed in the present invention, the collection, storage, use, processing, transmission, provision, disclosure and application of the news data involved are in compliance with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and do not violate public order and good morals.
[0041] When the subject in the news is an individual citizen, the risks involved by the individual can be identified. When the subject in the news is a legal person (an organization that has civil rights and civil conduct capacity and independently enjoys civil rights and assumes civil obligations in accordance with the law), the risks involved by the legal person can be identified. In some cases, the relationship between the individual and the legal person can be used to reflect the risks that the legal person may be involved in through the identification of individual risks. In addition, the subject in the news can also be a product name, for example, the evaluation, quality and other risks involved in the product in the market can be identified.
[0042] Taking the identification of financial risks involved in the subject in financial news as an example, different subjects may involve risk categories such as no risk, loss, bankruptcy, shareholder reduction, and major leadership changes. The original news data may have the following characteristics: 1) The news does not involve any risk events, the subject does not exist or the subject does not involve any public opinion warning category; 2) The news contains multiple risk subjects, but the subjects are located in different positions and correspond to multiple risk categories; 3) The subject at the same position in the same news involves multiple risk categories, such as loss and leadership changes at the same time; 4) The number of news in each risk category varies greatly, and the number of news that does not involve any risk far exceeds that of other risk categories. Therefore, there are problems such as uneven distribution of training samples, non-unique risk classification labels, and fuzzy subject information, which make it impossible to train an effective risk identification model.
[0043] The embodiments of the present disclosure provide a method for training a risk identification model. The method first performs data enhancement processing on any training sample in the training set, and can obtain M second training samples based on a first training sample, thereby increasing the news samples reflecting the risk and reducing the distribution differences of news samples of each category of risk. Secondly, by training the risk classification model with a word vector set obtained based on the word set of each second training sample, the connection between words in the news sentence can be considered, thereby improving the accuracy of risk category prediction. Finally, by training the subject recognition model with a word vector set obtained based on the text set of each second training sample, the characteristics of the subject name and the connection between the characters in the subject name can be considered, thereby improving the accuracy of subject recognition.
[0044] Figure 1 An application scenario diagram schematically illustrates a training method and a usage method suitable for implementing a risk identification model according to an embodiment of the present disclosure.
[0045] like Figure 1 As shown, the application scenario 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0046] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0047] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0048] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0049] It should be noted that the training method and the use method of the risk identification model provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the training device and the use device of the risk identification model provided in the embodiment of the present disclosure can generally be set in the server 105. The training method and the use method of the risk identification model provided in the embodiment of the present disclosure can also be executed by a server or a server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the training device and the use device of the risk identification model provided in the embodiment of the present disclosure can also be set in a server or a server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0050] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0051] The following will be based on Figure 1 The scene described by Figure 2~Figure 9 The training method and use method of the risk identification model of the embodiment of the present disclosure are described in detail.
[0052] Figure 2 The flowchart of the risk identification model training method according to the embodiment of the present disclosure is schematically shown. Figure 3 A schematic diagram of data enhancement processing according to an embodiment of the present disclosure is schematically shown.
[0053] like Figure 2 As shown, the training method of the risk identification model of this embodiment includes operations S210 to S240. The risk identification model includes a risk classification model and a subject identification model.
[0054] In operation S210, a first training sample is obtained, wherein the first training sample is any one of N news sentences in a training set, where N is an integer greater than or equal to 1.
[0055] The training samples (i.e., news sentences) in the training set can be obtained from one or more news articles. According to the paragraphs of each news article, the entire news article is decomposed into sentences to obtain N news sentences. The sentences here can be identified by symbols such as periods, question marks, or exclamation marks.
[0056] In operation S220, data enhancement processing is performed on the first training sample to obtain M second training samples, wherein the data enhancement processing includes replacing at least one word in the first training sample, and M is an integer greater than or equal to 1.
[0057] The words include words and phrases, and each word includes one or more characters. A single character is a Chinese character. The M second training samples may include the first training sample and new sentences obtained by replacing the words in the first training sample.
[0058] EDA can be used to implement data enhancement processing to increase the number of training samples and balance the distribution of each risk category. Since the source of the training samples is news reports, random insertion or deletion of text in the news may change the original meaning of the sentence, resulting in distortion of the meaning. Therefore, from the perspective of improving the efficiency and accuracy of risk identification, the subject-type words and non-subject-type words in each training sample are replaced. It should be noted that the embodiments of the present disclosure are not limited to the use of EDA to implement data enhancement, and can be implemented using other means in the prior art or disclosed in the future.
[0059] According to an embodiment of the present disclosure, the first training sample includes subject-type words and non-subject-type words, and replacing at least one word in the first training sample includes: replacing at least one of the subject-type words and the non-subject-type words. Wherein, in the case of replacing the subject-type words, the subject-type words are replaced with different subjects, and in the case of replacing the non-subject-type words, the non-subject-type words are replaced with synonyms or near synonyms.
[0060] Reference Figure 3For example, the content of the first training sample is "Subject 1 lost 29.63 million in the first three quarters". In the process of data enhancement, only subject words can be replaced, only non-subject words can be replaced, or both subject words and non-subject words can be replaced. In the case of replacing subject words, since the role of the subject name is to represent a legal person, an individual, or a commodity, from the perspective of category, subject 1 is replaced with subject 2, subject 3, etc., which are also subject words. Non-subject words are words other than subject words, and their role is to represent the meaning of the news sentence. From the perspective of expressing meaning, quarter is replaced with month, and both can be considered as synonyms of time meaning, and loss is replaced with synonyms or synonyms such as loss. This avoids the distortion of the meaning of the news sentence.
[0061] According to an embodiment of the present disclosure, by performing data enhancement on N sentences in the training set, the number of news in risk categories with fewer instances is further increased on the basis of the original number, thereby narrowing the quantitative differences among risk categories, thereby better learning the sample characteristics of each risk category during the training process and improving the prediction accuracy of the risk identification model.
[0062] According to an embodiment of the present disclosure, operation S220 includes replacing at least one word in the first training sample based on a preset replacement ratio, wherein the preset replacement ratio includes the ratio of the number of replaced words to the number of all words in the first training sample.
[0063] Taking EDA data enhancement as an example, during the processing, you can set parameters such as the number of words replaced in a single news sentence, the ratio of words replaced (i.e., the preset replacement ratio), and the number of sentences derived from a single sentence. When the number of words and the ratio of words conflict, you can set the parameter with the smaller range as the standard. Figure 3 , the preset replacement ratio can range from 20% to 50%. For example, if the preset replacement ratio is 30%, the number of words replaced during data augmentation is less than or equal to 30% of the number of all words in the sentence. If the number of sentences derived from a single sentence is set to 6 (for example only), Figure 3 In the above example, only the subject words are replaced, only the non-subject words are replaced, or both the subject words and the non-subject words are replaced to generate two sentences. Ideally, a single sentence will generate six new sentences. However, in actual operation, errors can be allowed, such as the situation where synonym replacement fails.
[0064] According to the embodiments of the present disclosure, the purpose of data enhancement is to increase the number of samples in each risk category. For risk categories with fewer samples, more samples can be added accordingly. Considering that too many word replacements may distort the meaning of the sentence and no longer belong to the original risk category, the accuracy of the risk category to which the training samples after data enhancement belong is improved by setting a preset replacement ratio.
[0065] In operation S230, a risk classification model is trained based on a word vector set obtained from each second training sample, wherein the word vector set is obtained by decomposing each second training sample to obtain a first word set.
[0066] See also Figure 3 ,Taking the original news as an example, the first word set can be [subject 1, first, three, quarters, loss, 29.63, ten thousand], and the corresponding word vector set can be obtained according to the first word set, so that the risk classification model can learn the ,features of each risk category.
[0067] In operation S240, a subject recognition model is trained based on a word vector set obtained from each second training sample, wherein the word vector set is obtained by decomposing each second training sample to obtain a first character set.
[0068] It should be noted that although the above operation S230 and operation S240 are described in order, this does not limit the order of their execution. For example, operation S230 and operation S240 can be executed at the same time, and operation S230 can be executed after operation S240.
[0069] An optional implementation is to train the risk classification model and the subject identification model separately until a good recognition effect is obtained. Another optional implementation is to train the risk classification model and the subject identification model at the same time. For example, in the process of training the risk classification model according to the word vector set, the predicted risk category of the second training sample is obtained. When the predicted risk category is that there is a risk, the sample word set is input into the subject identification model for training. Finally, according to the output result of the subject identification model, the model parameters of the risk classification model and the subject identification model are updated simultaneously.
[0070] See also Figure 3 ,Take the original news as an example, if the subject 1 is AB shares, the first text set can be [A, B, shares, first, three, quarters, loss, 29,63, ten thousand], and the smallest unit in the set is a single word.
[0071] According to the embodiments of the present disclosure, data enhancement processing is first performed on any training sample in the training set, and M second training samples can be obtained based on a first training sample, thereby increasing the news samples reflecting risks and reducing the distribution differences of news samples of each category of risk. Secondly, the risk classification model is trained by using a word vector set obtained based on the word set of each second training sample, which can consider the connection between words in the news sentences and improve the accuracy of risk category prediction. Finally, the subject recognition model is trained by using a word vector set obtained based on the text set of each second training sample, which can consider the characteristics of the subject name and the connection between the characters in the subject name and improve the accuracy of subject recognition.
[0072] According to an embodiment of the present disclosure, after obtaining the first training sample in operation S220, the method further includes: marking at least one risk category label for each first training sample, and / or marking a subject category label for each word in each first training sample.
[0073] For example, if the first training sample is "AB shares lost 29.63 million in the first three quarters", you can mark it with the "loss" label. If the first training sample is "Chairman XYZ resigned, AB shares lost 29.63 million in the first three quarters", you can mark it with the "main leadership" change label and the "loss" label.
[0074] The subject category label may include the subject start character label "B-Org", the subject middle character label "I-Org", the subject end character label "E-Org", and the non-subject character label "0". Taking the first training sample "AB shares lost 29.63 million in the first three quarters" as an example, Table 1 schematically shows the subject category label for each word tag.
[0075] Table 1
[0076] A B share share forward three season Spend deficit damage 2963 Ten thousand B-Org I-org I-org E-org 0 0 0 0 0 0 0 0
[0077] According to the embodiments of the present disclosure, after the first training sample is labeled with a risk category label and / or a subject category label of each word, the risk category of the sample does not change, and the subject position does not change, because the first training sample is replaced with a subject category word or a non-subject category word. Therefore, each second training sample has the same risk category label and subject category label as the corresponding first training sample. Figure 4~Figure 7 , further illustrating the process of training the risk classification model and the subject identification model using the second training sample.
[0078] Figure 4 A flowchart of training a risk classification model according to an embodiment of the present disclosure is schematically shown. Figure 5The data processing diagram for training a risk classification model according to an embodiment of the present disclosure is schematically shown.
[0079] like Figure 4 As shown, the training of the risk classification model in operation S230 includes operations S410 to S430. The risk classification model includes a first pre-training model and a first bidirectional long short-term memory model.
[0080] In operation S410, a first word set is input into a first pre-trained model so that the first pre-trained model outputs a word vector set.
[0081] The first pre-trained model may include a BERT model, a Roberta-wwm-ext-large model, an ERNIE model, a NEZHA model, or an XLNet model, etc.
[0082] The first pre-trained model incorporates the understanding of context and can better solve the problem of polysemy during feature extraction, thereby improving the overall recognition effect. The word set vectorized by the first pre-trained model will be converted into a word vector set.
[0083] Reference Figure 5 , taking the first pre-trained model as the first BERT model as an example, the first word set [AB shares, first, three, quarters, loss, 29.63, ten thousand] can be input into the first BERT model. Since only the first BERT model will be used for word vector conversion here, the output result of the second-to-last layer of the model can be obtained for subsequent operations, where the input of the model is represented as the sum of the word vector (token embedding), segment vector (segment embedding) and position vector (position embedding), and the output is represented as a word vector with features. Token embedding is used to represent the main information of the previous word. Segment embedding is used to display the global semantic information of the text. Position embedding is used to represent order and position information.
[0084] In operation S420, the word vector set is input into a first bidirectional long short-term memory model, so that the first bidirectional long short-term memory model outputs at least one first predicted risk category.
[0085] After using the first BERT model, each sentence will be presented as a 128-dimensional word vector set. If the sentence length is less than 128, the excess part is represented by 0. This vector is used as the input of the first BiLSTM model at each time step to obtain a bidirectional hidden state sequence. After processing, it is spliced to obtain a complete sequence. h t = [ h 1 , h 2 , h 3 , ⋯ h n ] . Then Mapped to the label category number s dimension, a sequence with a length of label number s is obtained P = [ p 1 , p 2 ,p 3 ⋯ p s ] . Each dimension P of the sequence P i Indicates the score of each corresponding risk category label.
[0086] In operation S430 , training is performed based on a degree of difference between at least one first predicted risk category and at least one risk category label corresponding to a second training sample.
[0087] In some embodiments, at least one score is determined from the sequence P, so as to determine the risk category labels corresponding to each score as the first predicted risk category. For example, a score threshold is set, and risk category labels corresponding to several scores above the threshold are selected. Alternatively, according to the score ranking, risk category labels corresponding to several scores with the highest ranking are selected.
[0088] The purpose of operation S430 is to train the first bidirectional long short-term memory model. Based on the first predicted risk category and the pre-marked risk category label of each second training sample, a loss function A can be constructed to calculate the degree of difference between the two. By defining the convergence condition of the loss function A, it is determined when the training ends.
[0089] In some other embodiments, the risk classification model also includes a first conditional random field model. At least one first predicted risk category can be all elements in the sequence P, and the sequence P is used as the input of the first conditional random field model, and the first conditional random field model is used to determine the final predicted risk category. The function of this training method is to train the first bidirectional long short-term memory model and the first conditional random field model at the same time.
[0090] The first conditional random field model can contain two types of characteristic functions, namely, the transfer characteristic function and the state characteristic function. The transfer characteristic function represents the relationship between the previous output state and the current output state, and the state characteristic function represents the relationship between the input sequence and the current state. Figure 5 The first conditional random field model can consider the relationship between the predicted risk categories based on the input sequence P to obtain at least one second predicted risk category of the corresponding second training sample.
[0091] First, at least one predicted risk category is input into a first conditional random field model so that the first conditional random field model outputs at least one second predicted risk category;
[0092] Secondly, training is performed based on the degree of difference between at least one second predicted risk category and at least one risk category label corresponding to the second training sample.
[0093] A loss function B can be constructed based on the second predicted risk category of each second training sample and the pre-labeled risk category label to calculate the degree of difference between the two, and by defining the convergence condition of the loss function B, it is determined when the training ends.
[0094] According to an embodiment of the present disclosure, in the process of training a risk classification model, the number of layers of the first BERT model can be set to 12, the number of layers of the first bidirectional long short-term memory model can be set to 128, and Dropout is set to 0.5. The maximum length is set to the largest value between the maximum length of the sentence and 512 (if the sentence length is greater than 512, the sentence will be directly truncated to the first 512 words). The number of epochs can be set to 10. The loss function A or B can select a cross entropy loss function, an exponential loss function, a square loss function, etc., which is not limited in the present disclosure.
[0095] Referring to operation S410 to operation S430, the first pre-trained model can be used as a basis to extract a word vector set of the second training sample. Then, the first bidirectional long short-term memory model and the first conditional random field model are trained, and the parameters of the network model are fitted by using the difference between the predicted risk category and the real risk category label of the second training sample, and the word vector is iterated to make the network converge.
[0096] In the process of training the risk classification model, the output of the first conditional random field model can be one or more second risk prediction categories, such as Figure 5 In addition to outputting losses, it is also possible to output losses and major leadership changes. For the case where the subject at the same position in the same news article involves multiple risk events, such as losses and leadership changes at the same time, multiple second risk prediction categories can be output to achieve the effect of identifying that the subject at the same position in the same news article involves multiple risk events.
[0097] Figure 6 A flowchart of training a subject recognition model according to an embodiment of the present disclosure is schematically shown. Figure 7 A schematic diagram of data processing for training a subject recognition model according to an embodiment of the present disclosure is shown schematically.
[0098] like Figure 6 As shown, the training of the subject recognition model in operation S240 includes operations S610 to S630. The subject recognition model includes a second pre-training model and a second bidirectional long short-term memory model.
[0099] In operation S610, a first character set is input into a second pre-trained model so that the second pre-trained model outputs a character vector set.
[0100] The second pre-trained model may include a BERT model, a Roberta-wwm-ext-large model, an ERNIE model, a NEZHA model, or an XLNet model, etc.
[0101] The first text set can be [A, B, shares, first, three, quarters, loss, 2963, ten thousand], refer to Figure 7 Taking the second pre-trained model as the second BERT model as an example, the second BERT model can extract the connection between characters based on the first character set and obtain a character vector set containing rich semantic features.
[0102] In operation S620, the word vector set is input into a second bidirectional long short-term memory model, so that the second bidirectional long short-term memory model outputs at least one first prediction subject result.
[0103] In operation S630, training is performed based on a difference between at least one first predicted subject result and a subject category label corresponding to each character in the second training sample, wherein each first predicted subject result corresponds to a predicted subject category of each character in the second training sample.
[0104] In some embodiments, the second bidirectional long short-term memory model can output a prediction matrix. Several elements in each column of the prediction matrix are used to characterize the scores of each subject category label corresponding to each word. Each first predicted subject result can be an element of each column in the prediction matrix, and the predicted subject category of each word can be the subject category label with the highest score in each column. The loss function C is constructed in combination with the subject category label pre-marked for each word, and the degree of difference is obtained through the loss function C, and the second bidirectional long short-term memory model is trained until the loss function C meets the convergence condition.
[0105] In some other embodiments, the subject recognition model further includes a second conditional random field model. Rather than taking the subject category label with the highest score in each column as the final predicted subject category, the second conditional random field model is used to obtain the final predicted subject category of each word.
[0106] First, at least one first prediction subject result is input into the second conditional random field model so that the second conditional random field model outputs a second prediction subject result.
[0107] Secondly, training is performed based on the difference between the second predicted subject result and the subject category label corresponding to each character in the second training sample, wherein the second predicted subject result includes the predicted subject category of each character in the second training sample.
[0108] There is a certain connection between each word of the main body, and this connection can also be reflected in the main body category labels of each word. Referring to Table 1, the label corresponding to the word "share" is I-org, so the label of the adjacent word before or after the word "share" will not be "0". The label corresponding to the word "portion" is E-org, so the label of the adjacent word after the word "portion" should be "0".
[0109] According to an embodiment of the present disclosure, each of the first predicted main body results can be the elements of each column in the above prediction matrix. By using the second conditional random field model, at least one label sequence can be obtained by constraining the dependence relationship between the labels corresponding to adjacent words, and the globally optimal label sequence with the maximum probability value can be determined, and this label sequence is the second predicted main body result.
[0110] The second conditional random field model can calculate the conditional probability of a certain label sequence Y given the second training sample X. The label sequence Y includes the predicted main body categories corresponding to each word in the second training sample X one by one. After determining the second predicted main body result based on the maximum conditional probability, a loss function D can be constructed based on the predicted main body categories of each word in the second predicted main body result and the marked labels of each word to calculate the difference degree between the two to train the second long short-term memory model and the second conditional random field model until the convergence condition of the loss function D is reached.
[0111] According to an embodiment of the present disclosure, during the process of training the main body recognition model, the number of layers of the second BERT model can be set to 12, and the number of layers of the second bidirectional long short-term memory model can be set to 256. And set Dropout to 0.5. The maximum length is set to the larger value between the maximum length of the sentence and 512 (if the sentence length is greater than 512, the sentence will be directly truncated to take the first 512 words). The number of epochs can be set to 6. The loss function C or D can be selected from functions such as cross-entropy loss function, exponential loss function, square loss function, etc., and the present disclosure does not limit it.
[0112] It can be seen that even though both the risk classification model and the main body recognition model adopt the combination of BERT+BiLSTM+CRF, the specific set parameters are different, and the final model parameters obtained after the corresponding training are also different. This is determined by the functions of the two models. The function of the risk classification model is to perform risk classification on the meaning of the statement itself. Its input data is a set of words, and the output result is the predicted risk category of the statement. The function of the main body recognition model is to determine the words included in the main body in the statement. Its input data is a set of words, and the smallest unit is a single word. The output result is the predicted main body category of each word.
[0113] Referring to operation S510 to operation S540, the second pre-training model can be used as a basis to extract a word vector set of the second training sample. Then, the second bidirectional long short-term memory model and the second conditional random field model are trained to fit the parameters of the network model by using the difference between the predicted subject category and the true subject category label of each word in the second training sample, so that the network converges.
[0114] Figure 8 A flowchart of a method for training a risk identification model according to another embodiment of the present disclosure is schematically shown.
[0115] like Figure 8 As shown, the risk identification model training method of this embodiment includes operations S810 to S860.
[0116] In operation S810, original text news data is obtained as a data source for a training set. For example, when monitoring public opinion on financial news, relevant financial news is collected.
[0117] In operation S820, the original text news data is preprocessed to obtain training samples in a training set, and also to obtain test samples in a test set.
[0118] For training and testing data, first divide the news paragraphs into independent sentences according to pause symbols and store them in the sentence list one by one. At the same time, according to whether the main words involving risks in the original labels exist in the sentence, assign corresponding risk categories to all sentences in the set, correspond the label categories to the number of sentences, and then replace the label categories with identifiers that are more convenient for model training (such as the number 0 means no risk events are involved, and other risk categories are assigned different numbers). After that, the EDA data enhancement model is introduced, and the risky sentences are enhanced using the above-mentioned main word and synonym replacement methods to balance the amount of data in each category. Next, use tools such as jieba to divide the sentences into word sets, and remove dirty data such as stop words and special symbols through methods such as thesaurus and regular expressions.
[0119] In operation S830, the pre-trained first BERT model is introduced, and the pre-processed word sequence is input into the model to obtain a word vector set with features, wherein each word in each sentence will be represented by a 128-dimensional vector. The first BiLSTM model and the first CRF model are introduced, and the word vector set encoded by the first BERT model is fed into the first BiLSTM model. After multi-layer neural network learning and calculation, a prediction result sequence is obtained, and then the sequence is fed into the first CRF model to obtain the final category prediction result sequence, whose length is equal to the length of the test data.
[0120] In operation S840, the sentences in the training data are labeled as Org in units of characters according to the position information of the subject word, and put into the second BERT+second BiLSTM+second CRF model for learning. For data whose risk category is not 0 in the prediction result, the subject word and its position information are obtained from the predicted subject category.
[0121] In operation S850, the prediction results can be stored in the spans object in the form of an array. If there is no risk involved, the spans object is an empty array. If there is a risk, each risk object will contain four elements: the subject word, the risk category, the starting position of the subject word, and the ending position of the subject word.
[0122] In operation S860, auxiliary rules are written based on expert experience. It can be executed simultaneously with one or more of operations S830, S840 and S850. For example, in operation S830, messages with the names of mainstream media in the news may have higher credibility, so they can be given higher weights during model training. In operation S840, some knowledge base experiences can be appropriately cited, such as whether the standardized "limited liability company" should be included in the subject terms. In operation S850, the HanLP institution identification API can be introduced for the identified subject words to confirm the validity again. In addition, due to the particularity of the news text and the limitations of paragraph length, the subject names and words appearing in the financial news data may differ from the API library or daily language. Therefore, in the result output stage, some existing word libraries can be introduced to assist in judgment, thereby improving the accuracy of the overall prediction.
[0123] According to the embodiments of the present disclosure, the risk identification model can be trained and used based on the Pipeline pipeline process of the deep learning framework, thereby realizing the public opinion warning category and financial entity identification of financial news. Based on the Pipeline pipeline process method, the entire training process is divided into a data preprocessing pipeline (refer to operation S820), a risk classification pipeline (refer to operation S830) and a subject identification pipeline (refer to operation S840). After the original data is preprocessed, the risk is first classified, and then the subject is identified for the risk-related part of the classified result data. An empirical rule knowledge base is also added as an auxiliary calibration before the result is output. The Pipeline pipeline process method has strong interpretability. By splitting it into various steps, it is also easier to write auxiliary rules in combination with expert experience to improve the accuracy of risk identification.
[0124] Fig. 9 The flowchart schematically shows a method for using the risk identification model according to an embodiment of the present disclosure.
[0125] like Fig. 9As shown, the method for using the risk identification model of this embodiment includes operations S910 to S940.
[0126] In operation S910, a first news sentence to be detected is obtained, wherein the first news sentence is any one of S news sentences to be detected, and S is an integer greater than or equal to 1.
[0127] From one or more news articles, the sentences in each paragraph can be decomposed to obtain S news sentences.
[0128] In operation S920, a second word set is input into the risk classification model so that the risk classification model outputs at least one third predicted risk category of the first news sentence, wherein the second word set is obtained by decomposing the first news sentence.
[0129] Each of the S news sentences is split to obtain a corresponding second word set, and a predicted risk category of the corresponding sentence is output through a risk classification model.
[0130] In operation S930, when there is a specific risk category in at least one third predicted risk category, a second text set is input into a subject identification model so that the subject identification model outputs a risk subject in the first news sentence, wherein the second text set is obtained by decomposing the first news sentence.
[0131] The smallest unit of the subject identification model is a single word in a sentence, not a word. The specific risk category is, for example, all risk categories except the "no risk" category. Only when the content of the first news sentence is risky, the second word set is input into the subject identification model, reducing unnecessary data processing and saving computing resources.
[0132] In operation S940 , at least one of at least one third predicted risk category, the risk subject, and location information of the risk subject is output.
[0133] The one or more third predicted risk categories, risk subjects, and the position of each word of the risk subject in the paragraph can be output in units of paragraphs. The position information can facilitate reading and solve the situation where the news contains multiple risk event subjects, but the subjects are located in different positions and correspond to multiple risk categories.
[0134] Since data enhancement processing was introduced during the training process to improve the situation of insufficient training samples and uneven distribution of samples in each category, and the BERT, BiLSTM and CRF models were used, the context can be better connected, the meaning of words can be recognized, and the correlation between the text can be learned, thereby improving the recognition success rate of the risk identification model when it is used.
[0135] Based on the above embodiments, the present disclosure also provides a training device and a use device for a risk identification model. Fig.10 and Fig.11 The device is described in detail.
[0136] Fig.10 The structural block diagram of the risk identification model training device according to the embodiment of the present disclosure is schematically shown.
[0137] like Fig.10 As shown, the risk identification model training device 1000 of this embodiment includes a first acquisition module 1010 , an enhancement processing module 1020 , a first training module 1030 and a second training module 1040 .
[0138] The first acquisition module 1010 may perform operation S210 to acquire a first training sample, wherein the first training sample is any one of N news sentences in a training set, where N is an integer greater than or equal to 1.
[0139] The enhancement processing module 1020 may execute operation S220 to perform data enhancement processing on the first training sample to obtain M second training samples, wherein the data enhancement processing includes replacing at least one word in the first training sample, and M is an integer greater than or equal to 1.
[0140] The first training module 1030 may perform operation S230 to train a risk classification model based on a word vector set obtained from each second training sample, wherein the word vector set is obtained by decomposing each second training sample to obtain a first word set.
[0141] The first training module 1030 may further perform operations S410 to S440, which will not be described in detail herein.
[0142] The second training module 1040 may perform operation S240 for training the subject recognition model based on a character vector set obtained from each second training sample, wherein the character vector set is obtained by decomposing each second training sample to obtain a first character set.
[0143] The second training module 1040 may also perform operations S610 to S630, which will not be described in detail herein.
[0144] Fig.11 The structure block diagram of a device for using a risk identification model according to an embodiment of the present disclosure is schematically shown.
[0145] like Fig.11As shown, the device 1100 for using the risk identification model of this embodiment includes a second acquisition module 1110 , a first input module 1120 , a second input module 1130 and a result output module 1140 .
[0146] The second acquisition module 1110 may perform operation S910 to acquire a first news sentence to be detected, wherein the first news sentence is any one of the S news sentences to be detected, and S is an integer greater than or equal to 1.
[0147] The first input module 1120 may perform operation S920 for inputting a second word set into a risk classification model so that the risk classification model outputs at least one third predicted risk category of the first news sentence, wherein the second word set is obtained by decomposing the first news sentence.
[0148] The second input module 1130 can perform operation S930, which is used to input a second text set into a subject identification model when there is a specific risk category in at least one third predicted risk category, so that the subject identification model outputs the risk subject in the first news sentence, wherein the second text set is obtained by decomposing the first news sentence.
[0149] The result output module 1140 may perform operation S940 for outputting at least one of at least one third predicted risk category, the risk subject, and location information of the risk subject.
[0150] According to an embodiment of the present disclosure, any multiple modules in a training device or a use device of a risk identification model can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module.
[0151] According to an embodiment of the present disclosure, at least one module in a training device or a use device of a risk identification model may be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or may be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in an appropriate combination of any of them. Alternatively, at least one module in a training device or a use device of a risk identification model may be at least partially implemented as a computer program module, which may perform corresponding functions when the computer program module is run.
[0152] Fig.12A block diagram of an electronic device suitable for implementing a training method and a use method of a risk identification model according to an embodiment of the present disclosure is schematically shown.
[0153] like Fig.12 As shown, the electronic device 1200 according to an embodiment of the present disclosure includes a processor 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage part 1208 to a random access memory (RAM) 1203. The processor 1201 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1201 may also include an onboard memory for caching purposes. The processor 1201 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0154] In RAM 1203, various programs and data required for the operation of electronic device 1200 are stored. Processor 1201, ROM 1202 and RAM 1203 are connected to each other via bus 1204. Processor 1201 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 1202 and / or RAM 1203. It should be noted that the program can also be stored in one or more memories other than ROM 1202 and RAM 1203. Processor 1201 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in one or more memories.
[0155] According to an embodiment of the present disclosure, the electronic device 1200 may further include an input / output (I / O) interface 1205, which is also connected to the bus 1204. The electronic device 1200 may further include one or more of the following components connected to the I / O interface 1205: an input portion 1206 including a keyboard, a mouse, etc. An output portion 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc. A storage portion 1208 including a hard disk, etc. And a communication portion 1209 including a network interface card such as a LAN card, a modem, etc. The communication portion 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed, so that the computer program read therefrom is installed into the storage portion 1208 as needed.
[0156] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments. It may also exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0157] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus, or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 1202 and / or RAM 1203 described above and / or one or more memories other than ROM 1202 and RAM 1203.
[0158] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.
[0159] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 1201. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0160] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 1209, and / or installed from the removable medium 1211. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0161] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1209, and / or installed from the removable medium 1211. When the computer program is executed by the processor 1201, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0162] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0163] The flow charts 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 flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a 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 or flow chart, and the combination of the boxes in the block diagram or flow chart 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.
[0164] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0165] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for training a risk identification model, wherein: The risk identification model includes a risk classification model and a subject identification model, specifically including: Obtain a first training sample, wherein the first training sample is any one of N news sentences in a training set, where N is an integer greater than or equal to 1; Performing data enhancement processing on the first training sample to obtain M second training samples, wherein the data enhancement processing includes replacing at least one word in the first training sample, and M is an integer greater than or equal to 1; Training the risk classification model based on a word vector set obtained from each second training sample, wherein the word vector set is obtained by decomposing each second training sample to obtain a first word set; Based on the word vector set obtained from each second training sample, training the subject recognition model, wherein the word vector set is obtained by decomposing each second training sample to obtain a first character set; After obtaining the first training sample, the method further includes: Marking at least one risk category label for each of the first training samples; and / or, marking a subject category label for each word in each of the first training samples; The risk classification model includes a first pre-training model and a first bidirectional long short-term memory model, and the word vector set obtained based on each second training sample, training the risk classification model includes: Inputting the first word set into the first pre-trained model so that the first pre-trained model outputs the word vector set; Inputting the word vector set into the first bidirectional long short-term memory model so that the first bidirectional long short-term memory model outputs at least one first predicted risk category; Performing training based on the degree of difference between the at least one first predicted risk category and at least one risk category label corresponding to the second training sample; The subject recognition model includes a second pre-training model and a second bidirectional long short-term memory model, and the word vector set obtained based on each second training sample, training the subject recognition model includes: Inputting the first character set into the second pre-trained model so that the second pre-trained model outputs the character vector set; Inputting the word vector set into the second bidirectional long short-term memory model so that the second bidirectional long short-term memory model outputs at least one first prediction subject result; Training is performed based on the degree of difference between at least one of the first predicted subject results and a subject category label corresponding to each character in the second training sample, wherein each of the first predicted subject results corresponds to a predicted subject category for each character in the second training sample.
2. The training method according to claim 1, wherein: The first training sample includes subject-type words and non-subject-type words, and the replacing at least one word in the first training sample includes: Replace at least one of the subject-type words and the non-subject-type words; Among them, when the subject-type words are replaced, the subject-type words are replaced with different subjects, and when the non-subject-type words are replaced, the non-subject-type words are replaced with synonyms or near-synonyms.
3. The training method according to claim 1, wherein: The replacing at least one word in the first training sample comprises: At least one word in the first training sample is replaced based on a preset replacement ratio, wherein the preset replacement ratio includes a ratio of the number of replaced words to the number of all words in the first training sample.
4. The training method according to claim 1, wherein: The risk classification model further includes a first conditional random field model, and the training based on the degree of difference between the at least one first predicted risk category and at least one risk category label corresponding to the second training sample includes: inputting the at least one predicted risk category into the first conditional random field model so that the first conditional random field model outputs at least one second predicted risk category; Training is performed based on a degree of difference between the at least one second predicted risk category and at least one risk category label corresponding to the second training sample.
5. The training method according to claim 1, wherein: The subject recognition model further includes a second conditional random field model, and the training based on the difference between at least one of the first predicted subject results and the subject category label corresponding to each word in the second training sample includes: Inputting at least one of the first prediction subject results into the second conditional random field model so that the second conditional random field model outputs a second prediction subject result; Training is performed based on the degree of difference between the second predicted subject result and the subject category label corresponding to each character in the second training sample, wherein the second predicted subject result includes the predicted subject category of each character in the second training sample.
6. A method for using a risk identification model, wherein: The risk identification model is obtained according to the training method described in any one of claims 1 to 5, and specifically includes: Obtaining a first news sentence to be detected, wherein the first news sentence is any one of the S news sentences to be detected, and S is an integer greater than or equal to 1; inputting a second set of words into a risk classification model so that the risk classification model outputs at least one third predicted risk category of the first news sentence, wherein the second set of words is obtained by decomposing the first news sentence; In the case where the at least one third predicted risk category has a specific risk category, inputting a second text set into a subject identification model so that the subject identification model outputs a risk subject in the first news sentence, wherein the second text set is obtained by decomposing the first news sentence; At least one of the at least one third predicted risk category, the risk subject, and the location information of the risk subject is output.
7. A training device for a risk identification model, wherein: The risk identification model includes a risk classification model and a subject identification model, specifically including: A first acquisition module is used to acquire a first training sample, wherein the first training sample is any one of N news sentences in a training set, where N is an integer greater than or equal to 1; an enhancement processing module, configured to perform data enhancement processing on the first training sample to obtain M second training samples, wherein the data enhancement processing includes replacing at least one word in the first training sample, and M is an integer greater than or equal to 1; A first training module, configured to train the risk classification model based on a word vector set obtained from each of the second training samples, wherein the word vector set is obtained by decomposing each of the second training samples to obtain a first word set; A second training module, configured to train the subject recognition model based on a word vector set obtained from each of the second training samples, wherein the word vector set is obtained by decomposing each of the second training samples to obtain a first word set; After obtaining the first training sample, the method further includes: Marking at least one risk category label for each of the first training samples; and / or marking a subject category label for each word in each of the first training samples; The risk classification model includes a first pre-training model and a first bidirectional long short-term memory model, and the word vector set obtained based on each second training sample, training the risk classification model includes: Inputting the first word set into the first pre-trained model so that the first pre-trained model outputs the word vector set; Inputting the word vector set into the first bidirectional long short-term memory model so that the first bidirectional long short-term memory model outputs at least one first predicted risk category; Performing training based on the degree of difference between the at least one first predicted risk category and at least one risk category label corresponding to the second training sample; The subject recognition model includes a second pre-training model and a second bidirectional long short-term memory model, and the word vector set obtained based on each second training sample, training the subject recognition model includes: Inputting the first character set into the second pre-trained model so that the second pre-trained model outputs the character vector set; Inputting the word vector set into the second bidirectional long short-term memory model so that the second bidirectional long short-term memory model outputs at least one first prediction subject result; Training is performed based on the degree of difference between at least one of the first predicted subject results and a subject category label corresponding to each character in the second training sample, wherein each of the first predicted subject results corresponds to a predicted subject category for each character in the second training sample.
8. A device for using a risk identification model, wherein: The risk identification model is obtained by the training device according to claim 7, and specifically includes: A second acquisition module is used to acquire a first news sentence to be detected, wherein the first news sentence is any one of the S news sentences to be detected, and S is an integer greater than or equal to 1; a first input module, configured to input a second word set into a risk classification model so that the risk classification model outputs at least one third predicted risk category of the first news sentence, wherein the second word set is obtained by decomposing the first news sentence; a second input module, configured to input a second text set into a subject identification model when a specific risk category is included in the at least one third predicted risk category, so that the subject identification model outputs a risk subject in the first news sentence, wherein the second text set is obtained by decomposing the first news sentence; A result output module is used to output at least one of the at least one third predicted risk category, the risk subject and the location information of the risk subject.
9. An electronic device, comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the method according to any one of claims 1 to 6.
11. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Adaptive system for dynamic security exposure assessment
US12732527B2
Adaptive system for dynamic security exposure assessment
US20260019441A1
