CN116245154A - Training method of neural network, public opinion crisis recognition method and related device - Google Patents

Training method of neural network, public opinion crisis recognition method and related device Download PDF

Info

Publication number
CN116245154A
CN116245154A CN202211530216.XA CN202211530216A CN116245154A CN 116245154 A CN116245154 A CN 116245154A CN 202211530216 A CN202211530216 A CN 202211530216A CN 116245154 A CN116245154 A CN 116245154A
Authority
CN
China
Prior art keywords
crisis
category
evaluation
text
sample
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211530216.XA
Other languages
Chinese (zh)
Other versions
CN116245154B (en
Inventor
胡创奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211530216.XA priority Critical patent/CN116245154B/en
Publication of CN116245154A publication Critical patent/CN116245154A/en
Application granted granted Critical
Publication of CN116245154B publication Critical patent/CN116245154B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application relates to the field of machine learning, in particular to a training method of a neural network, a public opinion crisis recognition method and a related device, which can improve the accuracy of public opinion crisis recognition. The neural network is used for public opinion crisis identification, and the training method comprises the following steps: acquiring one or more crisis evaluation texts under each crisis category in the preset M crisis categories; for each of the M crisis categories, performing: generating one or more sets of crisis samples based on crisis assessment text under the first crisis category; and taking the crisis sample as a training sample, and training a preset neural network model, so that the trained neural network model has the capability of identifying the evaluation text and the crisis category aiming at the target object and outputting the probability that the crisis problem described by the evaluation text belongs to the corresponding crisis category.

Description

Training method of neural network, public opinion crisis recognition method and related device
Technical Field
The present disclosure relates to the field of machine learning, and in particular, to a training method for a neural network, a public opinion crisis recognition method and a related device.
Background
With the rapid development of the internet, the public may post on the network a language and a perspective about an enterprise, an enterprise-related business, and an enterprise-related product, which may be referred to as public opinion data. Public opinion data may relate to significant crisis events for enterprise products and services. In order to maintain the social image of an enterprise, the enterprise needs to pay attention to public opinion data at all times, and timely and accurately discover crisis categories possibly related to the public opinion data from massive internet public opinion data, and adopts a corresponding business intervention mechanism based on the crisis categories so as to avoid the credit and image damage of the enterprise.
In the related art, a deep learning model, such as a text multi-classification model, is used to classify public opinion data, and a crisis category corresponding to the public opinion data is identified, so as to facilitate the development of a subsequent intervention mechanism. Deep learning models usually need to be trained based on a large amount of public opinion data before achieving a good category recognition effect. However, the amount of public opinion data for an enterprise is often relatively small, resulting in a small amount of available training samples for the model. Based on a deep learning model obtained by training with less training sample size, in the actual public opinion crisis recognition process, the problem of low public opinion crisis recognition accuracy is solved, and further the implementation efficiency of business intervention is affected, for example, the business intervention mechanism is started and delayed, so that enterprise reputation and image are damaged, and the problems of enterprise customer loss, product sales quantity downslide and the like are caused.
Disclosure of Invention
In view of the above, the present application provides a training method of a neural network, a public opinion crisis recognition method and related devices, so as to improve the recognition accuracy of the public opinion crisis.
In order to achieve the above purpose, the embodiments of the present application adopt the following technical solutions:
in a first aspect, the present application provides a training method of a neural network, where the neural network is used for public opinion crisis recognition, the training method includes: acquiring one or more crisis evaluation texts under each crisis category in the preset M crisis categories, wherein the crisis evaluation texts are texts of user evaluation target objects in one or more platforms, and the crisis evaluation texts are used for describing crisis problems of the target objects, and different crisis problems correspond to different crisis categories; for each of the M crisis categories, performing: generating one or more sets of crisis samples based on crisis assessment text under the first crisis category; wherein each set of crisis samples includes a positive sample and a plurality of negative samples; the positive sample comprises a first crisis evaluation text, first indication information and a first label, wherein the first indication information is used for indicating that a crisis problem described by the first crisis evaluation text belongs to a first crisis category; the negative sample comprises a first crisis evaluation text, second indication information and a second label, wherein the second indication information is used for indicating that a crisis problem described by the first crisis evaluation text belongs to a second crisis category, and the second crisis category is one crisis category of M crisis categories except the first crisis category; wherein the first tag and the second tag are different; training a preset neural network model by taking the crisis sample as a training sample, so that the trained neural network model has the capability of identifying an evaluation text and crisis category aiming at a target object and outputting probability that crisis problems described by the evaluation text belong to the corresponding crisis category; the first crisis evaluation text and the first indication information in the crisis sample are taken as input samples of positive samples, the first label is taken as output samples of the positive samples, the first crisis evaluation text and the second indication information in the crisis sample are taken as input samples of negative samples, and the second label is taken as output samples of the negative samples.
In this application, crisis sample expansion is performed before model training. Specifically, multiple sets of crisis samples may be generated for crisis assessment text for each crisis category (e.g., the first crisis category). Each set of crisis samples (i.e., crisis samples corresponding to the first crisis assessment text) may include one positive sample and a plurality of negative samples. The positive sample corresponds to a sample of the first crisis assessment text, and may include the first crisis assessment text, first indication information, and a first label. The first indication information indicates that the crisis problem described in the first crisis rating text belongs to the first crisis category, and the first label is used for indicating that the sample is a positive sample (i.e. the information indicated by the first indication information is correct). The plurality of negative examples are expanded examples and may include a first crisis assessment text, a second indication, and a second label. The second indication information is used for indicating that the crisis problem described by the first crisis evaluation text belongs to a second crisis category, wherein the second crisis category is one of other crisis categories except the first crisis category in the preset M crisis categories. The first label is used to indicate that the sample is a negative sample (i.e., the information indicated by the second indication information is erroneous). And then, the crisis sample can be used as a training sample, and a preset neural network model is trained, so that the trained neural network model has the capability of identifying the evaluation text and the crisis category aiming at the target object, and outputting the probability that the crisis problem described by the evaluation text belongs to the corresponding crisis category. From the above description, it can be seen that by this method, sample expansion can be performed on existing crisis samples, and the number of crisis samples can be increased. Therefore, a large number of crisis samples are adopted to carry out model training on the neural network model, the accuracy rate of the crisis identification of the trained model can be improved, and the crisis identification efficiency is improved. And, positive and negative samples of the same crisis assessment text (e.g., a first crisis assessment text) correspond to different crisis types, respectively. Therefore, the degree of distinguishing different crisis categories can be increased, the neural network model can obtain better capability of distinguishing different crisis categories when being trained, the accuracy of crisis identification of the model after training is further improved, and the crisis identification efficiency is improved.
In a possible implementation manner of the first aspect, the preset neural network model is a twin network model in the present application.
The twin network model may respectively use the first crisis evaluation text and the first indication information or the second indication information in the crisis sample as input data of the model, and output a probability that the first crisis evaluation text belongs to a corresponding crisis category based on a relationship between the first crisis evaluation text and the first indication information or the second indication information.
In a possible implementation manner of the first aspect, the present application adopts an N-way-K-shot method, and uses a crisis sample as a training sample to train a preset neural network model. The implementation mode provides a feasible implementation method for presetting the neural network model.
In one possible implementation manner of the first aspect, generating one or more sets of crisis samples based on crisis assessment text under a first crisis category of the M crisis categories includes: firstly, obtaining the similarity of a first crisis category and each other crisis category in M crisis categories, and the quantity of crisis evaluation texts under each crisis category in M crisis categories; then, calculating the number of negative samples of each other crisis category to be expanded for the crisis evaluation text under the first crisis category based on the acquired similarity and the number of crisis evaluation texts; the method comprises the steps of aiming at one other crisis category, wherein the higher the similarity between a first crisis category and the other crisis category is, the smaller the number of crisis evaluation texts under the other crisis category is, and the larger the number of negative samples of the other crisis category to be expanded is aiming at the crisis evaluation texts under the first crisis category; finally, generating one or more groups of crisis samples according to crisis evaluation texts under the first crisis category based on the number of negative samples of each other crisis category to be expanded; wherein the total number of negative samples of the same other crisis class in the one or more crisis samples is equal to the number of negative samples to be expanded corresponding to the other crisis class.
In this implementation manner, multiple sets of crisis samples may be generated based on the number of crisis evaluation texts under the first crisis category according to the similarity between the first crisis category and other crisis categories except for the first crisis category among the preset M crisis categories. The method comprises the steps of regarding one other crisis category, enabling the similarity of a first crisis category and other crisis categories to be higher, enabling the number of crisis evaluation texts under the other crisis categories to be smaller, and regarding the crisis evaluation texts under the first crisis category, enabling the number of negative samples of the other crisis category to be larger. The method is beneficial to expanding the number of negative samples of other crisis categories with fewer crisis evaluation texts and higher similarity, training the neural network model based on the expanded crisis samples and accelerating the convergence rate of the model.
In a possible implementation manner of the first aspect, calculating, based on the obtained similarity and the number of crisis evaluation texts, the number of negative samples of each other crisis category to be expanded for the crisis evaluation text under the first crisis category includes: for each of the other crisis categories of the M crisis categories other than the first crisis category: calculating a sample duty ratio of the second crisis category based on the similarity of the first crisis category and the second crisis category and the number of crisis evaluation texts under each other crisis category in the M crisis categories; and calculating the product of the number of the crisis evaluation texts under the first crisis category and the sample ratio of the second crisis category to obtain the number of the negative samples of the second crisis category to be expanded aiming at the crisis evaluation texts under the first crisis category. This implementation provides a viable calculation method to calculate the number of negative samples for the second crisis category that is to be expanded for the crisis assessment text under the first crisis category.
In a possible implementation manner of the first aspect, the present application calculates the sample duty ratio P of the second crisis class using the following formula ki
Figure BDA0003974033560000031
Wherein S is ki Representing the similarity of the first crisis category k and the second crisis category i, N i The number of crisis assessment text under the second crisis category i is represented. This implementation provides a viable calculation method for calculating the sample duty cycle of the second crisis category of the other crisis categories.
In one possible implementation manner of the first aspect, the generating one or more sets of crisis samples according to crisis evaluation text under the first crisis category based on the number of negative samples of each other crisis category to be expanded includes: for each of the other crisis categories of the M crisis categories other than the first crisis category: n from the first crisis category k Risk of individualsSelecting X in machine evaluation text i A crisis evaluation text; wherein X is i The number of negative samples of the second crisis class to be expanded; based on X i Each crisis assessment text of the individual crisis assessment texts performs: a positive sample and a negative sample of the second crisis class are generated. The implementation provides a feasible implementation method for generating one or more sets of crisis samples based on crisis assessment text under a first crisis category.
In a possible implementation manner of the first aspect, the first tag is 1, and the second tag is 0. The implementation provides one possible implementation of the first tag and the second tag.
In a second aspect, the present application provides a public opinion crisis recognition method, using a neural network model trained by the method according to any one of the first aspects to perform public opinion crisis recognition, where the method includes: acquiring a first evaluation text of a target object; the first evaluation text comprises evaluation of a target object by a user in one or more platforms; generating M crisis data corresponding to the first evaluation text; each crisis data comprises a first evaluation text and indication information, wherein the indication information is used for indicating that a crisis problem described by the first evaluation text belongs to one crisis category of M preset crisis categories, and crisis categories indicated by the indication information included in different crisis data are different; respectively taking M crisis data as input, and operating a neural network model to obtain probabilities that crisis problems described by a first evaluation text belong to M crisis categories respectively; and determining the crisis category to which the crisis problem described by the first evaluation text belongs according to the probability output by the neural network model.
According to the method, the public opinion crisis identification is carried out by adopting the neural network model trained based on the method provided by the first aspect and any one possible implementation mode thereof, and before the public opinion crisis identification is carried out, the crisis evaluation sample is combined with the preset M crisis categories at first, M crisis data are generated, the M crisis data are used as the input of the neural network model, so that the crisis category of the crisis problem in the crisis evaluation text is predicted, the crisis identification accuracy rate can be improved, and the crisis identification efficiency is improved.
In a possible implementation manner of the second aspect, the determining, according to the probability output by the neural network model, a crisis category to which the crisis problem described by the first evaluation text belongs includes: and respectively taking the crisis category corresponding to the maximum probability of the probabilities that the crisis problems described by the first evaluation text belong to M crisis categories as the crisis category to which the crisis problems described by the first evaluation text belong. The implementation provides a method for determining a crisis category to which the crisis problem described by the first evaluation text belongs according to the output probability of the neural network model.
In a third aspect, the present application provides an electronic device (referred to as a first electronic device), where the first electronic device includes M preset crisis categories. The electronic device includes: a memory and one or more processors. The memory is coupled to the processor. Wherein the memory is for storing computer program code comprising computer instructions. The computer instructions, when executed by the processor, cause the first electronic device to perform the steps of: acquiring one or more crisis evaluation texts under each crisis category in the preset M crisis categories; the crisis evaluation text is text of user evaluation target objects in one or more platforms, and is used for describing crisis problems of the target objects, and different crisis problems correspond to different crisis categories; for each of the M crisis categories, performing: generating one or more sets of crisis samples based on crisis assessment text under the first crisis category; wherein each set of crisis samples includes a positive sample and a plurality of negative samples; the positive sample comprises a first crisis evaluation text, first indication information and a first label, wherein the first indication information is used for indicating that a crisis problem described by the first crisis evaluation text belongs to a first crisis category; the negative sample comprises a first crisis evaluation text, second indication information and a second label, wherein the second indication information is used for indicating that a crisis problem described by the first crisis evaluation text belongs to a second crisis category, and the second crisis category is one crisis category of M crisis categories except the first crisis category; wherein the first tag and the second tag are different; training a preset neural network model by taking the crisis sample as a training sample, so that the trained neural network model has the capability of identifying an evaluation text and crisis category aiming at a target object and outputting probability that crisis problems described by the evaluation text belong to the corresponding crisis category; the first crisis evaluation text and the first indication information in the crisis sample are taken as input samples of positive samples, the first label is taken as output samples of the positive samples, the first crisis evaluation text and the second indication information in the crisis sample are taken as input samples of negative samples, and the second label is taken as output samples of the negative samples.
With reference to the third aspect, in one possible design manner, the preset neural network model is a twin network model.
With reference to the third aspect, in another possible design manner, the computer instructions, when executed by the processor, cause the first electronic device to further perform the following steps: and (3) training a preset neural network model by using the N-way-K-shot method and taking the crisis sample as a training sample.
With reference to the third aspect, in another possible design manner, the computer instructions, when executed by the processor, cause the first electronic device to further perform the following steps: obtaining similarity between the first crisis category and each other crisis category in M crisis categories, and the number of crisis evaluation texts under each crisis category in M crisis categories; calculating the number of negative samples of each other crisis category to be expanded for the crisis evaluation text under the first crisis category based on the acquired similarity and the number of crisis evaluation texts; the method comprises the steps of aiming at one other crisis category, wherein the higher the similarity between a first crisis category and the other crisis category is, the smaller the number of crisis evaluation texts under the other crisis category is, and the larger the number of negative samples of the other crisis category to be expanded is aiming at the crisis evaluation texts under the first crisis category; generating one or more groups of crisis samples according to crisis evaluation texts under the first crisis category based on the number of negative samples of each other crisis category to be expanded; wherein the total number of negative samples of the same other crisis class in the one or more crisis samples is equal to the number of negative samples to be expanded corresponding to the other crisis class.
With reference to the third aspect, in another possible design manner, the computer instructions, when executed by the processor, cause the first electronic device to further perform the following steps: for each of the other crisis categories of the M crisis categories other than the first crisis category: calculating a sample duty ratio of the second crisis category based on the similarity of the first crisis category and the second crisis category and the number of crisis evaluation texts under each other crisis category in the M crisis categories; and calculating the product of the number of the crisis evaluation texts under the first crisis category and the sample ratio of the second crisis category to obtain the number of the negative samples of the second crisis category to be expanded aiming at the crisis evaluation texts under the first crisis category.
With reference to the third aspect, in another possible design manner, the computer instructions, when executed by the processor, cause the first electronic device to further perform the following steps: the following formula is adopted:
Figure BDA0003974033560000041
calculating a sample duty cycle P of the second crisis class ki The method comprises the steps of carrying out a first treatment on the surface of the Wherein S is ki Representing the similarity of the first crisis category k and the second crisis category i, N i The number of crisis assessment text under the second crisis category i is represented.
With reference to the third aspect, in another possible design manner, the computer instructions, when executed by the processor, cause the first electronic device to further perform the following steps: for each of the other crisis categories of the M crisis categories other than the first crisis category: n from the first crisis category k Selecting X in individual crisis assessment text i A crisis evaluation text; wherein X is i The number of negative samples of the second crisis class to be expanded; based on X i Each crisis assessment text of the individual crisis assessment texts performs: a positive sample and a negative sample of the second crisis class are generated.
With reference to the third aspect, in another possible design manner, the computer instructions, when executed by the processor, cause the first electronic device to further perform the following steps: the first label is 1 and the second label is 0.
In a fourth aspect, the present application provides an electronic device (referred to as a second electronic device), where the second electronic device includes M preset crisis categories. The electronic device includes: a memory and one or more processors. The memory is coupled to the processor. Wherein the memory is for storing computer program code comprising computer instructions. The computer instructions, when executed by the processor, cause the first electronic device to perform the steps of: acquiring a first evaluation text of a target object; the first evaluation text comprises evaluation of a target object by a user in one or more platforms; generating M crisis data corresponding to the first evaluation text; each crisis data comprises a first evaluation text and indication information, wherein the indication information is used for indicating that a crisis problem described by the first evaluation text belongs to one crisis category of M preset crisis categories, and crisis categories indicated by the indication information included in different crisis data are different; respectively taking M crisis data as input, and operating a neural network model to obtain probabilities that crisis problems described by a first evaluation text belong to M crisis categories respectively; and determining the crisis category to which the crisis problem described by the first evaluation text belongs according to the probability output by the neural network model.
With reference to the fourth aspect, in one possible design manner, the computer instructions, when executed by the processor, cause the first electronic device to further perform the following steps: and respectively taking the crisis category corresponding to the maximum probability of the probabilities that the crisis problems described by the first evaluation text belong to M crisis categories as the crisis category to which the crisis problems described by the first evaluation text belong.
It should be noted that, the first electronic device is a device for training a preset neural network model. The second electronic device is a device for running the trained neural network model and identifying public opinion crisis. The second electronic device may be the same device as the first electronic device or may be a different device.
In a fifth aspect, the present application provides a chip system that may be applied to an electronic device including a memory. The system-on-chip includes one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected by a wire. The interface circuit is configured to receive signals from the memory and to send the signals to the processor, the signals including computer instructions stored in the memory. When the processor executes the computer instructions, the electronic device performs the method as described in the first aspect, the second aspect and any one of its possible designs.
In a sixth aspect, the present application provides a computer-readable storage medium comprising computer instructions. When executed on an electronic device, the computer instructions cause the electronic device to perform the method as described in the first aspect, the second aspect and any one of its possible designs.
In a seventh aspect, the present application provides a computer program product which, when run on a computer, causes the computer to perform the method according to the first aspect, the second aspect and any one of its possible designs.
It may be appreciated that the electronic device according to the third aspect, the fourth aspect and any possible design manner thereof, the chip system according to the fifth aspect, the computer readable storage medium according to the sixth aspect, and the computer program product according to the seventh aspect may refer to the advantages as in the first aspect and any possible design manner thereof, and are not described herein again.
Drawings
FIG. 1 is a flow chart of a public opinion crisis recognition method according to the prior art;
fig. 2 is a schematic structural diagram of a personal computer according to an embodiment of the present application;
Fig. 3 is a flow chart of a training method of a neural network according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a neural network according to an embodiment of the present application;
FIG. 5 is a flow chart of one possible implementation of the crisis sample generation method of S302 shown in FIG. 3;
FIG. 6 is a training flow chart of another neural network according to an embodiment of the present application;
fig. 7 is a training flowchart of a neural network according to an embodiment of the present application;
FIG. 8 is a flowchart of a public opinion crisis recognition method according to an embodiment of the present application;
fig. 9 is a flowchart of another public opinion crisis recognition method according to an embodiment of the present application.
Detailed Description
The user's rating text for the target object is included in a large amount of text data (also referred to as public opinion data) from, for example, search engines, news journals, questionnaires, social media software, e-commerce platforms, etc. For example, the target object may be an electronic product, a software version of an electronic product, a service, a brand (e.g., a cell phone brand); the target object may also be a software product, including various software products such as a software system, an application program, office software, and the like.
The user's evaluation of the target object may be, for example, a user's evaluation of a brand of an enterprise, may be, for example, a user's evaluation of an enterprise related service, for example, a user's evaluation of an enterprise pre-sale or after-sale service, may be, for example, a user's evaluation of an online or offline service provided by the enterprise, and may be, as an example, a user's evaluation of an "online old and new" service. User ratings for enterprise-related products, including user ratings for physical products and ratings for software products. As one example, a user may evaluate a physical product such as a cell phone, computer, notebook, smart wearable device, etc., developed, produced, or sold by an enterprise. As another example, a user may evaluate various types of software products, such as software systems, applications, office software, etc., developed or sold by an enterprise.
The user's evaluation text of the target object often includes crisis evaluation text of the target object. The crisis assessment text may be text describing that the target object has a crisis problem. The crisis problem may be a problem that the target object presents that is detrimental to enterprise image, reputation, product sales, etc. In other words, the crisis assessment text may be a description of a crisis problem that the user has with the target object, which may cause the enterprise's enterprise image, reputation, and sales of the product to be impaired. Taking a target object as a mobile phone as an example, the crisis evaluation text can be, for example, a description of an explosion problem generated in the use process of the mobile phone by a user. The crisis evaluation text may be, for example, "XX phone is charged with sudden explosion, too dangerous". Taking the target object as an enterprise brand as an example, the crisis assessment text may be, for example, a description of a false promotion by the user of the enterprise brand. The crisis assessment text may be, for example, "XX brand product is expensive and too expensive".
Crisis categories may be used to categorize crisis problems, and similar or identical crisis problems may be categorized into the same category of crisis categories. Illustratively, taking the example that the target object is a mobile phone, the common crisis categories may include: natural explosions, personal injuries, information security, etc. For example, "XX phone is suddenly exploded when charged, and is too afraid of" is a crisis evaluation text for a natural explosion class of XX phone (i.e., target object). The crisis evaluation text describes the crisis problem of explosion caused by XX mobile phone charging, and the crisis problem belongs to the natural explosion category in the crisis category.
Different crisis problems correspond to different crisis categories. As an example, crisis assessment text 1"xx phone is suddenly exploded when charged, too dangerous", crisis assessment text 2"xx tablet is suddenly exploded when charged, too dangerous", and crisis assessment text 3"xx phone is suddenly exploded when playing a game, too dangerous", the crisis problems described by these 3 crisis assessment texts are the same or similar crisis problems. Thus, these 3 crisis assessment texts describe crisis problems, which belong to the natural explosion-like crisis category.
As another example, crisis sample 1"xx phone is suddenly exploded while charging, too dangerous" product price with crisis assessment text 4"xx brand is heavy, too expensive" includes two different crisis problems. The crisis problems in the crisis evaluation text 1 are of the natural explosion type crisis category, and the crisis problems in the crisis evaluation text 4 are of the false propaganda type crisis category.
It will be appreciated that the crisis assessment text described above propagates fermentation on the platform, often with severe impact on the target object. The recognition of crisis evaluation text (i.e., recognition of crisis category corresponding to the evaluation text) from a large amount of text data of the search engine, news journal, questionnaire survey, social media software, e-commerce platform, etc. is an important means for grasping dynamic and analysis trend of the development of things and monitoring public opinion.
In the related art, a deep learning model, such as a text multi-classification model, is used to classify the public opinion data, and the crisis category corresponding to the public opinion data is identified, so as to facilitate the development of a subsequent intervention mechanism. However, the amount of public opinion data for an enterprise is often relatively small, resulting in a small amount of available training samples for the model. Based on the deep learning model obtained by training with less training sample size, the problem of low accuracy of public opinion crisis recognition exists in the process of the actual public opinion crisis recognition.
First, a public opinion crisis recognition method provided by the related art will be described with reference to fig. 1.
Fig. 1 illustrates public opinion crisis recognition using a deep learning model, and a predicted crisis category of crisis evaluation text is output using crisis evaluation text as input. As shown in fig. 1, a conventional neural network learner may be used to classify crisis assessment text. The conventional neural network learner may be, for example, a text multi-classification model. In fig. 1, the input of the conventional neural network learner may be, for example, crisis assessment text 1"xx suddenly explodes when the mobile phone is charged, is too dangerous", and the output of the model may be the output of the multi-classification SoftMax function. Based on the output of the multi-classification SoftMax function, it can be determined that the crisis assessment text 1 belongs to the natural explosion class. Specifically, the conventional neural network learner in fig. 1 may include a plurality of preset crisis categories, for example, may include 3 preset crisis categories, namely a natural explosion category, an information security category, and a personal injury category. The multi-classification SoftMax function may determine probability values for crisis assessment text 1 belonging to 3 preset crisis categories based on the output of the neural network. For example, multi-classification SoftMax may output a probability value (0.75,0.2,0.05), wherein the probability value indicates a probability that the crisis problem in crisis assessment text 1 belongs to a preset crisis category to which the probability value corresponds. For example, the probability value may indicate that the probability that the crisis problem in the crisis assessment text 1 belongs to the natural explosion class is 0.75, the probability that the crisis problem belongs to the information security class is 0.2, and the probability that the crisis problem belongs to the personal injury class is 0.05. Based on the multiple probability values, for example, a preset crisis category corresponding to the maximum probability value can be taken as a predicted crisis category of the crisis evaluation text 1, that is, it is determined that the crisis problem in the crisis evaluation text 1 belongs to a natural explosion category corresponding to the probability value of 0.75.
However, the deep learning model is trained based on a large number of data sets, and can achieve better classification effect when in use. But the crisis assessment text used to train the deep learning model is typically relatively small, which results in a small sample size for the training model. In particular, the crisis evaluation texts with fewer total numbers are refined to each preset crisis category, and the number of the crisis evaluation texts under each preset crisis category is smaller. Based on a deep learning model obtained by training a small sample, the problem of low accuracy rate and poor crisis recognition capability of public opinion crisis recognition exists in use. When public opinion crisis occurs in an enterprise, related intervention mechanisms are generally adopted to reduce the influence of the public opinion crisis on the enterprise. When the public opinion crisis identification accuracy is low, the efficiency of business intervention crisis is also affected, an intervention mechanism cannot be started in time, reputation and image of an enterprise can be damaged, and customer loss and product sales are easy to slide down.
Based on this, the embodiment of the application provides a training method of a neural network, which can be applied to a first electronic device, and the neural network is used for public opinion crisis identification. The number of crisis evaluation texts under each crisis category is limited; and, each crisis evaluation text corresponds to only one crisis category. By adopting the scheme, multiple groups of crisis samples can be generated aiming at the crisis evaluation files under each crisis category (such as the first crisis category). Each set of crisis samples (i.e., crisis samples corresponding to the first crisis assessment text) may include one positive sample and a plurality of negative samples. The positive sample corresponds to an original sample of the first crisis evaluation text, and may include the first crisis evaluation text, first indication information indicating that the crisis problem described by the first crisis evaluation text belongs to the first crisis category, and a first label. The first tag is used to indicate that the sample is a positive sample (i.e., the information indicated by the first indication information is correct). The plurality of negative examples are expanded examples and may include a first crisis assessment text, second indication information indicating that a crisis problem described by the first crisis assessment text belongs to a second crisis category, and a second label. The second tag is used to indicate that the sample is a negative sample (i.e., the information indicated by the second indication information is erroneous). And then, the crisis sample can be used as a training sample, and a preset neural network model is trained, so that the trained neural network model has the capability of identifying the evaluation text and the crisis category aiming at the target object, and outputting the probability that the crisis problem described by the evaluation text belongs to the corresponding crisis category.
From the above description, it can be seen that by this method, sample expansion can be performed on existing crisis samples, and the number of crisis samples can be increased. Therefore, a large number of crisis samples are adopted to carry out model training on the neural network model, the accuracy rate of the crisis identification of the trained model can be improved, and the crisis identification efficiency is improved.
And, positive and negative samples of the same crisis assessment text (e.g., a first crisis assessment text) correspond to different crisis types, respectively. Therefore, the degree of distinguishing different crisis categories can be increased, the neural network model can obtain better capability of distinguishing different crisis categories when being trained, the accuracy of crisis identification of the model after training is further improved, and the crisis identification efficiency is improved.
The embodiment of the application also provides a public opinion crisis identification method which can be applied to the second electronic equipment. The public opinion crisis recognition method can be used for carrying out public opinion crisis recognition by applying the neural network model obtained through training by the training method. By applying the neural network model to carry out public opinion crisis identification, the accuracy rate of crisis identification can be improved, and the crisis identification efficiency is improved.
By way of example, the first electronic device or the second electronic device may be a personal computer (personal computer, PC), a mobile phone, a tablet computer, a desktop, a laptop, a handheld computer, a notebook, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a desktop, an ultra book, a netbook, a cellular phone, a personal digital assistant (personal digital assistant, PDA), a wearable device, an augmented reality (augmented reality, AR), a Virtual Reality (VR) device, a media player, a television, a server, and the like, and the specific form of the device is not particularly limited in the embodiments of the present application.
It should be noted that, the first electronic device is a device for training a preset neural network model. The second electronic device is a device for running the trained neural network model and identifying public opinion crisis. The second electronic device may be the same device as the first electronic device or may be a different device. In the following embodiments, the method of the embodiments of the present application will be described by taking the case where the first electronic device and the second electronic device are both personal computers PCs.
Referring to fig. 2, a schematic structure of a personal computer 20 according to an embodiment of the present application is shown. As shown in fig. 2, the personal computer 20 may include: processor 21, memory 22, display screen 23, wi-Fi device 24, bluetooth device 25, audio circuit 26, microphone 26A, speaker 26B, power system 27, peripheral interface 28, sensor module 29, data conversion module 30, etc. The components may communicate via one or more communication buses or signal lines (not shown in fig. 2). Those skilled in the art will appreciate that the hardware architecture shown in fig. 2 is not limiting of the personal computer 20, and that the personal computer 20 may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
Among them, the processor 21 is a control center of the personal computer 20, connects various parts of the personal computer 20 using various interfaces and lines, and performs various functions and processes of the personal computer 20 by running or executing application programs stored in the memory 22, and calling data and instructions stored in the memory 22. In some embodiments, the processor 21 may include one or more processing units; the processor 21 may also integrate an application processor and a modem processor; the application processor mainly processes an operating system, a user interface, an application program and the like, and the modem processor mainly processes wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processor 21.
In other embodiments of the present application, the processor 21 may also include an AI chip. The learning and processing capabilities of the AI chip include image understanding capabilities, natural language understanding capabilities, voice recognition capabilities, and the like. The AI chip may enable better performance, longer endurance, and better security and privacy of the personal computer 20. For example, if the personal computer 20 processes data through the cloud, the result is returned after the data is uploaded, which is inefficient in the prior art. If the local side of the personal computer 20 has a strong AI learning capability, the personal computer 20 does not need to upload data to the cloud end and directly processes the data at the local side, so that the processing efficiency is improved and the safety and privacy of the data are improved.
For example, the processor 21 may be configured to train a preset neural network model provided in an embodiment of the present application; or, the method can also be used for running the preset neural network model provided by the embodiment of the application to identify public opinion crisis.
The memory 22 is used to store application programs and data, and the processor 21 performs various functions and data processing of the personal computer 20 by running the application programs and data stored in the memory 22. The memory 22 mainly includes a memory program area and a memory data area, wherein the memory program area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.); the storage data area may store data (such as audio data, video data, etc.) created according to the use of the personal computer 20. In addition, the memory 22 may include high-speed random access memory, and may also include nonvolatile memory, such as magnetic disk storage devices, flash memory devices, or other nonvolatile solid state memory devices, among others.
The memory 22 may be used to store model codes corresponding to the predetermined neural network model.
The memory 22 may store various operating systems. Illustratively, the memory 22 may also store dialing software and the like related to the embodiments of the present application, and the memory 22 may also store information, such as user account information, related to registration and login of the embodiments of the present application.
The display screen 23 is for displaying images, videos, and the like. The display screen may be a touch screen. In some embodiments, the personal computer 20 may include 1 or N displays 23, N being a positive integer greater than 1. The personal computer 20 realizes a display function by a GPU, a display screen 23, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen 23 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 21 may include one or more GPUs that execute program instructions to generate or change display information.
Wi-Fi means 24 for providing personal computer 20 with network access that complies with Wi-Fi related standard protocols. The personal computer 20 may access Wi-Fi access points via Wi-Fi device 24 to facilitate user email, web browsing, streaming media access, etc., which provides wireless broadband internet access to the user. The personal computer 20 may also establish a Wi-Fi connection through a Wi-Fi device and a Wi-Fi access point with a terminal device connected to the Wi-Fi access point for transmitting data to each other. In other embodiments, the Wi-Fi device 24 can also act as a Wi-Fi wireless access point, and can provide Wi-Fi network access to other computer devices.
Bluetooth means 25 for enabling data exchange between the personal computer 20 and other short-range electronic devices, such as terminals, smart watches, etc. The bluetooth device in the embodiment of the application may be an integrated circuit or a bluetooth chip, etc.
Audio circuitry 26, microphone 26A, speaker 26B may provide an audio interface between a user and personal computer 20. The audio circuit 26 may transmit the received electrical signal after audio data conversion to the speaker 26B, and the speaker 26B converts the electrical signal into a sound signal for output; on the other hand, the microphone 26A converts the collected sound signals into electrical signals, which are received by the audio circuit 26 and converted into audio data, which are transmitted to the terminal via the internet or Wi-Fi network or bluetooth, or which are output to the memory 22 for further processing.
The power supply system 27 is used to charge the various components of the personal computer 20. The power system 27 may include a battery and a power management module, where the battery may be logically connected to the processor 21 through a power management chip, so that functions of managing charging, discharging, and power consumption management may be implemented through the power system 27.
Peripheral interface 28 provides various interfaces for external input/output devices such as a keyboard, mouse, external display, external memory, user identification module card, etc. For example, the mouse is connected through a universal serial bus interface, so that the purpose of receiving relevant operations implemented by a user through the mouse is achieved. For another example, the expansion of the memory capability of the personal computer 20 is achieved by connecting an external memory interface to an external memory, such as a Micro SD card. Peripheral interface 28 may be used to couple the external input/output peripherals described above to processor 21 and memory 22.
The sensor module 29 may include at least one sensor. Such as light sensors, motion sensors, and other sensors. In particular, the light sensor may comprise an ambient light sensor. The ambient light sensor can adjust the brightness of the display screen 23 according to the brightness of the ambient light. As one type of motion sensor, an accelerometer sensor can detect the acceleration in all directions (typically three axes), and can detect the gravity and direction when stationary, and can be used for applications for recognizing the gesture of a personal computer (such as horizontal-vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer, knocking), and the like. Of course, the sensor module may also include any other feasible sensor, depending on the actual requirements.
The data conversion module 30 may include a digital-to-analog converter 30A and an analog-to-digital converter 30B. Among them, digital-to-analog converter (digital to analog converter, DAC), also called D/a converter. A digital-to-analog converter is a device that converts a digital signal into an analog signal. An analog-to-digital converter (analog to digitalconverter, ADC), also called a/D converter. An analog-to-digital converter is a device that converts an analog signal to a digital signal.
The training method and the public opinion crisis recognition method of the neural network in the following embodiments may be executed by the computer 20 having the above hardware configuration.
The embodiment of the application provides a training method of a neural network. The training method of the neural network can comprise a training sample generation process and a neural network training process, wherein the neural network is used for public opinion crisis identification. Fig. 3 is a flow chart of a training method of a neural network according to an embodiment of the present application. As shown in FIG. 3, the training sample generation process may include S301-S302, and the neural network training process may include S303.
S301, the PC acquires one or more crisis evaluation texts under each crisis category in the preset M crisis categories.
As mentioned previously, the rating text for the target object is included in a large amount of text data (also referred to as public opinion data) from, for example, search engines, news journals, questionnaires, social media software, e-commerce platforms, etc. For example, the evaluation text of the target object may be crawled from one or more platforms. The platform, which may be also referred to as an internet network platform, may be, for example
Figure BDA0003974033560000101
Various internet platforms such as video websites, bar posts, shopping websites and the like.
Based on the obtained evaluation text, classification screening can be performed to obtain crisis evaluation text under each crisis category in the preset M crisis categories. Wherein each crisis category may include one or more crisis assessment text.
As an example, the preset M crisis categories may be, for example, a natural explosion crisis, a personal injury crisis, an information security crisis, a false propaganda crisis category, i.e., m=4. And classifying and screening 500 evaluation texts crawled from the platform to obtain crisis evaluation texts under each crisis category in 4 preset crisis categories. For example, for 500 evaluation texts, 10 crisis evaluation texts can be included under the natural explosion crisis category; 6 crisis evaluation texts can be included under the category of personal injury crisis; 4 crisis evaluation texts can be included under the information security class crisis category; the false propaganda type crisis category can comprise 0 crisis evaluation texts, namely, the crisis problem described by none of the crisis evaluation texts belongs to the false propaganda type crisis category.
S302, the PC executes, for each of the M crisis categories: one or more sets of crisis samples are generated based on crisis assessment text under the first crisis category.
The first crisis category is one of M preset crisis categories. The PC may perform, for each of the preset M crisis categories: one or more sets of crisis samples are generated based on crisis assessment text in the corresponding crisis category. In the embodiment of the application, taking the crisis evaluation text based on the first crisis category as an example, a method for generating one or more sets of crisis samples by the PC based on the crisis evaluation text under each crisis category is introduced.
It should be appreciated that the first crisis category may include one crisis assessment text, or may include multiple crisis assessment texts. Regardless of the inclusion of several crisis assessment text under the first crisis category, one or more sets of crisis samples may be generated using the methods of embodiments of the present application. For example, if one crisis assessment text is included under a first crisis category, the PC may generate at most one set of crisis samples for one crisis assessment text included under the first crisis category. If the first crisis category includes P crisis evaluation texts, the PC may generate P sets of crisis samples for the P crisis evaluation texts included in the first crisis category, where P is greater than 1, P is less than or equal to P, and P are integers.
Of course, there may also be crisis assessment text for which part of the crisis categories do not correspond. For this case, the PC cannot generate a crisis sample for that crisis class. However, for other crisis categories for which there is a crisis evaluation text, a negative sample corresponding to the crisis category for which there is no crisis evaluation text may be generated.
Each set of crisis samples of the first crisis class may include a positive sample (positive samples) and a plurality of negative samples (negative samples).
Taking a set of crisis samples corresponding to the first crisis evaluation text in the first crisis category as an example. The positive sample of the set of crisis samples may include the first crisis assessment text, the first indication information, and the first label described above. Each negative sample may include a first crisis assessment text, second indication information, and a second label.
The first crisis evaluation text is one crisis evaluation text in the first crisis category. Taking the first crisis category as a natural explosion category as an example. For example, the first crisis assessment text may be crisis assessment text 1"XX Mobile is suddenly exploded and too dangerous when charging".
The first indication information may indicate that the crisis problem described in the first crisis assessment text belongs to the first crisis category. For example, the first indication information may be "this is a crisis about natural explosion", for indicating that the crisis problem described in this crisis evaluation text belongs to the natural explosion class. The first tag may be used to indicate that the information indicated by the first indication information is correct.
Note that the label of the positive sample is the first label. The first tag indicates that the information indicated by the first indication information is correct. That is, the crisis category to which the crisis problem described in the first crisis evaluation text belongs, as described in the first instruction information, is the first crisis category. Illustratively, the first tag may be 1. For example, still taking the first crisis category as natural explosion, the first crisis evaluation text (test) is "XX phone is suddenly exploded when charged, is too dangerous" as an example, the positive sample may be as shown in table 1:
TABLE 1
test test pair label
The XX mobile phone is suddenly exploded when being charged, which is too dangerous This is a crisis about natural explosions 1
As shown in table 1, test pair is first indication information "this is a crisis about natural explosion class", and label is first tag "1". The crisis category to which the crisis problem described in the first crisis evaluation text (test) belongs, and as described in the first instruction information (test pair), is a crisis of a natural explosion type.
A negative sample of the set of crisis samples includes a first crisis assessment text, second indication information, and a second label. That is, the first crisis assessment text is the same in the positive and negative samples in a set of crisis samples. In the crisis sample including the positive sample, the first crisis evaluation text of the negative sample is also "the XX phone is suddenly exploded when charged, and is too dangerous.
The second indication information may indicate that the crisis problem described in the above-described first crisis assessment text belongs to a second crisis category. The second crisis category is a crisis category other than the first crisis category among the preset M crisis categories. The second crisis category is different from the first crisis category. For example, the second crisis category may be a personal injury category, and the second indication may be, for example, "this is a crisis about the personal injury category," for indicating that the crisis question described in this crisis assessment text belongs to the personal injury category. The second tag is used for indicating that the information indicated by the second indication information is wrong.
Note that the label of the negative example is the second label. The second tag indicates that the information indicated by the second indication information is erroneous. That is, the crisis category to which the crisis problem described in the first crisis evaluation text belongs is not the second crisis category as described in the second instruction information. Illustratively, the second tag may be 0. For example, still taking the first crisis category as natural explosion, the first crisis evaluation text (test) is "XX phone is suddenly exploded when charged, is too dangerous" as an example, the negative samples of the above set of crisis samples may be as shown in table 2:
TABLE 2
Figure BDA0003974033560000111
Figure BDA0003974033560000121
As shown in table 2, test pair is second indication information "this is a crisis about personal injury class", and label is second label "0". The crisis category to which the crisis problem described in the first crisis evaluation text (test) belongs, and is not the crisis of personal injury category described in the second instruction information (test pair).
As shown in table 2, test pair is second indication information "this is a crisis about information security class", and label is second label "0". The crisis category to which the crisis problem described in the first crisis evaluation text (test) belongs is not the crisis of the information security class described in the second instruction information (test pair).
The first crisis category is taken as a natural explosion category to describe, and for each first crisis category of the preset M crisis categories, one or more sets of crisis samples including one positive sample and a plurality of negative samples can be generated based on crisis evaluation text in the first crisis category according to the method.
In some embodiments, the process of generating the crisis sample may be referred to as sample negative sampling. In the following embodiments, the preset M crisis categories include: crisis category 1, crisis category 2, crisis category 3, … … crisis category i, … …, crisis category M, crisis category i includes N i For example, a crisis evaluation text, a method for generating a crisis sample by a PC is described. Wherein i is sequentially valued in {1,2, … …, M }.
For each of the preset M crisis categories (e.g., crisis category i), the PC may select from N of crisis category i i Selecting n in a crisis assessment text i Generating n by using the crisis evaluation text i A crisis sample. Each crisis sample can comprise a positive sample and n j Negative samples, 1.ltoreq.n j And M-1 is not more than. The M-1 negative samples are in one-to-one correspondence with M-1 crisis categories except the crisis category i in the M crisis categories.
As mentioned before, among the preset M crisis categories, there may be a part of crisis category under which there is no crisis assessment text. One or more sets of crisis sample generation procedures may not be performed for crisis categories without crisis assessment text.
S303, the PC takes the crisis sample as a training sample to train a preset neural network model.
Taking a positive sample as an example, the positive sample may be input into the neural network model, and specifically, the first crisis evaluation text and the first indication information in the positive sample may be input into the neural network model. And taking the first label as an output sample of the positive sample, and training the neural network model based on the output sample, so that the neural network model can output the probability that the crisis problem described by the first crisis evaluation text belongs to the corresponding crisis category.
In other words, the first crisis evaluation text and the first indication information in the positive sample may be input into the neural network model, and the neural network model may output the probability that the crisis problem described by the first crisis evaluation text belongs to the corresponding crisis category. Based on the first label of the positive sample, iteratively optimizing the neural network model parameters so that based on the probability, whether the crisis problem belongs to the corresponding crisis category can be judged.
Taking the first label as 1 as an example, after the positive sample is input into the neural network model, a probability value of the crisis problem described by the crisis evaluation text in the positive sample, which belongs to the corresponding crisis category, for example, the probability value is 0.3, can be obtained. Based on the first tag 1, model parameters of the neural network model, for example, loss update model parameters based on loss gradient back propagation, are iteratively optimized such that the probability value approaches 1. In this way, the neural network model has the ability to output probabilities of crisis categories corresponding to crisis problems described in the crisis assessment text in the positive sample.
Taking the negative sample as an example, the negative sample may be input into the neural network model, and specifically, the first crisis evaluation text and the second instruction information in the negative sample may be input into the neural network model. And taking the second label as an output sample of the negative sample, and training the neural network model based on the output sample, so that the neural network model can output the probability that the crisis problem described by the first crisis evaluation text belongs to the corresponding crisis category.
Taking the second label as 0 as an example, after the negative sample is input into the neural network model, the crisis problem described by the crisis evaluation text in the negative sample can be obtained, and the probability value of the crisis evaluation text belongs to the corresponding crisis category, for example, the probability value is 0.3. Based on the second label 1, model parameters of the neural network model, for example, model parameters are updated based on the loss-gradient back propagation such that the probability value approaches 0. Thus, the neural network model has the ability to output the probability that the crisis problem described in the crisis assessment text in the negative sample belongs to the corresponding crisis category.
Taking table 1 and table 2 as examples, the neural network model may be trained using the positive and negative samples in the set of crisis samples shown in table 1 and table 2 as training samples.
The positive samples in table 1 ("XX phone is suddenly exploded when charged, is too dangerous", "this is a crisis about natural explosion", 1) "XX phone is suddenly exploded when charged, is too dangerous" this is a crisis about natural explosion ", and is input into the neural network. Training the neural network and continuously optimizing model parameters of the neural network to enable the neural network to output crisis problems in positive samples, and the probability value P1 of natural explosion is calculated.
And respectively inputting the first crisis evaluation text and the second indication information in 3 negative samples in table 2 into a neural network model to respectively obtain probability values P2, P3 and P4 of crisis of personal injury class, which are described by the first evaluation text in the 3 negative samples.
Training a neural network model based on the first tag 1 in the positive sample such that P1 approaches 1; based on the second label of the negative example, 0, the neural network model is trained such that P2, P3, P4 approaches 0.
For a set of crisis samples, all samples in the set of crisis samples can be input into the neural network model in parallel for model training, and can also be input in series. For multiple groups of crisis samples, a group of crisis samples can be input into a neural network model for model training, and crisis samples in multiple groups of crisis samples can be input into the model at random for model training.
Therefore, according to the training method of the neural network provided by the embodiment of the application, the neural network is used for public opinion crisis identification, and multiple groups of crisis samples can be generated according to crisis evaluation files under each crisis category (such as the first crisis category). Each set of crisis samples (i.e., crisis samples corresponding to the first crisis assessment text) may include one positive sample and a plurality of negative samples. The positive sample corresponds to an original sample of the first crisis evaluation text, and may include the first crisis evaluation text, first indication information indicating that the crisis problem described by the first crisis evaluation text belongs to the first crisis category, and a first label. The first tag is used to indicate that the sample is a positive sample (i.e., the information indicated by the first indication information is correct). The plurality of negative examples are expanded examples and may include a first crisis assessment text, second indication information indicating that a crisis problem described by the first crisis assessment text belongs to a second crisis category, and a second label. The second tag is used to indicate that the sample is a negative sample (i.e., the information indicated by the second indication information is erroneous). And then, the crisis sample can be used as a training sample, and a preset neural network model is trained, so that the trained neural network model has the capability of identifying the evaluation text and the crisis category aiming at the target object, and outputting the probability that the crisis problem described by the evaluation text belongs to the corresponding crisis category.
From the above description, it can be seen that by this method, sample expansion can be performed on existing crisis samples, and the number of crisis samples can be increased. Therefore, a large number of crisis samples are adopted to carry out model training on the neural network model, the accuracy rate of the crisis identification of the trained model can be improved, and the crisis identification efficiency is improved. And, positive and negative samples of the same crisis assessment text (e.g., a first crisis assessment text) correspond to different crisis types, respectively. Therefore, the degree of distinguishing different crisis categories can be increased, the neural network model can obtain better capability of distinguishing different crisis categories when being trained, the accuracy of crisis identification of the model after training is further improved, and the crisis identification efficiency is improved.
In some embodiments, the predetermined neural network model may be a twin network model. The following description is made of a twin network model with reference to fig. 4, and fig. 4 is a schematic structural diagram of a twin network model according to an embodiment of the present application.
As shown in fig. 4, the twin network model may include two identical neural network models f1 and f2, and f1 and f2 may be learning networks, and a pre-training bert model is adopted. The twin network model takes two samples x1 and x2 as inputs, respectively, into f1 and f2, respectively. f1 and f2 can output characterization vectors h1 and h2 of high latitude space of two samples, and perform geometrical operation of |h1-h2| on h1 and h2 to obtain a vector z. The twin network model also includes a full connectivity layer (fully connected layers) for text classification based on the vector z. Under the condition that the number of crisis evaluation texts is small in a public opinion crisis event, a small sample twin network model is built to serve as a learner for identifying the public opinion crisis, and accuracy rate of crisis identification can be improved.
Two types of samples may be used to train the twin network model. One is a sample pair (x 1, x2, 1) consisting of two samples x1 and x2 of the same class, where 1 denotes that x1 and x2 are samples of the same class, which is the positive sample in the foregoing. For example, in the foregoing, a positive sample ("XX phone is charged with sudden explosion, is too dangerous", "this is a crisis about natural explosion", 1). Another is a sample pair (x 1, x2, 0) consisting of two different classes of samples, where 0 indicates that x1 and x2 are not samples of the same class, i.e. negative samples as before. For example, in the foregoing, the negative sample ("XX phone is suddenly exploded while charging, is too dangerous", "this is a security class crisis" 0).
In other words, the twin network model for public opinion crisis recognition may input the first crisis evaluation text in the positive sample/negative sample and the first instruction information/second instruction information into f1 and f2 for model training during training. For the positive sample, taking the first crisis evaluation text in the positive sample as x1 input f1, taking the first indication information as x2 input f2, and outputting a probability value of the crisis problem described by the first crisis evaluation text to belong to the corresponding crisis category by the model. For the negative sample, taking the first crisis evaluation text in the negative sample as x1 input f1 and the second instruction information as x2 input f2, the model can output a probability value of the crisis problem described by the second crisis evaluation text belonging to the corresponding crisis category.
When the twin network model for identifying public opinion crisis is trained, the model can be trained by adopting an N-way-K-shot training method. According to the N-way-K-shot training method, M crisis categories are extracted from M total preset crisis categories each time, K crisis texts are extracted from each crisis category, and a classification training task based on a small sample neural network learner is constructed. The specific training procedure may be as follows.
Firstly, randomly extracting M crisis categories (ways) from preset M crisis categories, and randomly extracting K (shot) crisis samples from each crisis category.
And secondly, randomly extracting K-1 crisis samples from the K crisis samples in each crisis category from the m crisis categories as a training sample set (training set), and taking the remaining 1 samples in each crisis category as a test sample set (testing set).
Thirdly, randomly selecting one crisis sample from m crisis categories of the training sample set to form a group of training data, and inputting the training data into a model to perform model training.
And fourthly, randomly extracting a crisis sample from the test sample set, and judging which crisis category the crisis sample belongs to by using the model.
Repeating the steps for several rounds, and updating parameters by back propagation of the model loss gradient in the training process, thereby finally completing the model training task.
In some embodiments, the PC may refer to the similarity of the crisis category to other crisis categories, and the amount of crisis assessment text under each crisis category, when generating one or more sets of crisis samples for each of the M crisis categories. Specifically, as shown in fig. 5, S302 may include S501-S503. Fig. 5 is a flowchart of a method for generating a crisis sample according to an embodiment of the present application, and the method for generating a crisis sample shown in fig. 5 is a feasible implementation manner of S302.
S501, the PC acquires the similarity between the first crisis category and each other crisis category in the preset M crisis categories, and the number of crisis evaluation texts under each other crisis category.
The similarity is used for indicating the association degree between two crisis categories, and the higher the association degree between the crisis categories is, the higher the similarity is. As one example, the higher the degree of association of a natural explosion crisis category with a personal injury crisis category, the higher the similarity between the natural explosion crisis category and the personal injury crisis category, because natural explosions may cause personal injury. As another example, the degree of association between the natural explosion class crisis category and the information security class crisis category is small, and thus the degree of similarity between the natural explosion class crisis category and the information security class crisis category is small. The PC may store the similarity between two crisis categories among the M crisis categories in advance.
S502, the PC calculates the number of negative samples of other crisis categories to be expanded aiming at the crisis evaluation text under the first crisis category based on the acquired similarity and the number of crisis evaluation texts.
The method comprises the steps of regarding one other crisis category, enabling the similarity of a first crisis category and other crisis categories to be higher, enabling the number of crisis evaluation texts under the other crisis categories to be smaller, and regarding the crisis evaluation texts under the first crisis category, enabling the number of negative samples of the other crisis category to be larger.
For example, the PC may perform S502a-S502b for each of the other crisis categories of the M crisis categories other than the first crisis category to calculate the number of negative samples for each of the other crisis categories to be expanded for the crisis assessment text under the first crisis category.
S502a, the PC calculates the sample ratio of the second crisis category based on the similarity of the first crisis category and the second crisis category and the quantity of crisis evaluation texts under each other crisis category in the M crisis categories.
By way of example, the PC may employ the following formula:
Figure BDA0003974033560000151
calculating a sample duty cycle P of the second crisis class ki
Wherein S is ki Representing the similarity of the first crisis category k and the second crisis category i, N i Representing the number of crisis assessment text under the second crisis category i.
In the formula (i),
Figure BDA0003974033560000152
and the method is used for calculating the ratio of the similarity of the first crisis category k and the second crisis category i to the total category similarity. />
Figure BDA0003974033560000153
And calculating the ratio of the quantity of the crisis evaluation texts of the second crisis category i to the total quantity of the crisis evaluation texts of the total other crisis categories. The smaller the duty cycle, the +.>
Figure BDA0003974033560000154
The larger the duty cycle, the larger the +.>
Figure BDA0003974033560000155
The smaller.
Thus, the higher the similarity of the second crisis category to the first crisis category, the fewer the number of crisis assessment text under the second crisis category, and the higher the sample ratio thereof. I.e. the greater the number of negative examples that need to be expanded to the second crisis category for the first evaluation text in the first crisis category. Thus, when one or more groups of crisis samples are generated, the crisis samples can be combined with other crisis categories which are most similar to the crisis category with higher probability, so that the neural network learns the degree of distinction between the two crisis categories; the greater probability is combined with the crisis category with fewer crisis evaluation texts, so that the crisis sample number of the crisis category with fewer crisis evaluation texts is expanded, and the convergence speed of the neural network model is accelerated.
For example, take m=5 as an example. Assuming that 5 crisis categories are preset (a, b, c, d, e), crisis category a has 60 crisis assessment texts (i.e., N a There are 30 crisis assessment texts for crisis category b (i.e., N) b The crisis category c has 25 crisis assessment texts (i.e., N) c There are 15 crisis assessment texts for crisis category d (i.e., N) d The crisis category e has 10 crisis assessment texts (i.e., N e =10). The similarity between the 5 crisis categories is shown in table 3.
TABLE 3 Table 3
Similarity S Crisis category a Crisis class b Crisis class c Crisis class d Crisis class e
Crisis category a NULL 80% 60% 25% 10%
Crisis class b 80% NULL 40% 35% 15%
Crisis class c 60% 40% NULL 18% 52%
Crisis class d 25% 35% 18% NULL 9%
Crisis class e 10% 15% 52% 9% NULL
As shown in table 3, the similarity S between the crisis class a and the crisis class b ab =S ba Similarity S between crisis class a and crisis class c =80% ac =S ca Similarity S between crisis class a and crisis class d =60% ad =S da Similarity S between crisis class a and crisis class e =25% ae =S ea Similarity S between crisis class b and crisis class c =10% bc =S cb Similarity S between crisis class b and crisis class d =40% bd =S db Similarity S between crisis class b and crisis class e =35% be =S ed Similarity S between crisis class c and crisis class d =15% cd =S dc Similarity S between crisis class c and crisis class e =18% ce =S ec Similarity S between crisis class d and crisis class e =52% de =S ed =9%。
For crisis class a (i.e., the first crisis class), the PC executes S502a, which may be calculated as:
Sample duty cycle of crisis class b (i.e., second crisis class)
Figure BDA0003974033560000161
Figure BDA0003974033560000162
Sample duty cycle of crisis class c (i.e., second crisis class)
Figure BDA0003974033560000163
Figure BDA0003974033560000164
Sample duty cycle of crisis class d (i.e., second crisis class)
Figure BDA0003974033560000165
Figure BDA0003974033560000166
Sample duty cycle of crisis class e (i.e., second crisis class)
Figure BDA0003974033560000167
Figure BDA0003974033560000168
For crisis category b (i.e., first crisis category), the PC performs S502a Can be calculated as follows:
sample duty cycle of crisis class a (i.e., second crisis class)
Figure BDA0003974033560000169
Figure BDA00039740335600001610
Sample duty cycle of crisis class c (i.e., second crisis class)
Figure BDA00039740335600001611
Figure BDA00039740335600001612
Sample duty cycle of crisis class d (i.e., second crisis class)
Figure BDA00039740335600001613
Figure BDA00039740335600001614
Sample duty cycle of crisis class e (i.e., second crisis class)
Figure BDA00039740335600001615
Figure BDA00039740335600001616
The crisis class c, the crisis class d, and the crisis class e are respectively used as the first crisis class, and the method for calculating the sample duty ratio of the second crisis class may refer to the crisis class a or the crisis class b as the first crisis class in the above example, and the method for calculating the sample duty ratio of the second crisis class is not repeated here in the embodiments of the present application.
In some embodiments, the above formula may be referred to as a weighted random negative sampling formula, P ki May be referred to as sampling weights. And performing weighted random negative sampling based on the sampling weight when one or more groups of crisis samples are generated aiming at the first crisis evaluation text under the first crisis category. Combining the first crisis evaluation text with other preset crisis categories to generate a crisis sample, and redefining a category label as 0 or 1. Thus, for one crisis evaluation text, the two categories of 0 and 1 can be converted, namely, for one crisis evaluation text, a positive sample and a negative sample can be generated.
S502b, the PC calculates the product of the number of the crisis evaluation texts under the first crisis category and the sample ratio of the second crisis category to obtain the number of the negative samples of the second crisis category to be expanded aiming at the crisis evaluation texts under the first crisis category.
In some embodiments, S ki The similarity between the first crisis class k and crisis class i, where i is one of the M-1 crisis classes other than the first crisis. The similarity between the first crisis category k and each other crisis category i and the number N of crisis evaluation texts under each other crisis category i can be respectively obtained based on M-1 preset crisis categories i
As an example, the similarity S obtained in the previous step is used ki Number of crisis evaluation texts N i The number of negative samples that need to be expanded to M-1 crisis categories for the crisis assessment text under the first crisis category is calculated. That is, for any one of the M-1 crisis categories other than the first crisis category, a number of crisis assessment text under the first crisis category may be combined with any one of the other crisis categories to expand a number of the first crisis assessment text into a negative sample under the other crisis category.
In other words, when one or more sets of crisis samples are generated based on the first crisis evaluation text in the first crisis category, the number of negative samples, which need to be generated by combining with the M-1 preset crisis categories in the first crisis category, may be calculated based on the similarity between the first crisis category and the M-1 preset crisis categories, and the number of crisis evaluation texts under each of the M-1 preset crisis categories.
And S503, the PC generates one or more groups of crisis samples according to the crisis evaluation text under the first crisis category based on the number of negative samples of each other crisis category to be expanded.
As described above, the set of crisis samples includes positive and negative samples with the same first crisis assessment text. The negative sample may be derived from the first crisis assessment text in combination with other crisis categories. Because ofThe number X of negative samples of the second crisis category to be expanded into other crisis categories is calculated i Thereafter, one can select from the first crisis class N k Obtaining X from crisis evaluation text i Crisis assessment text. Based on X i And generating positive samples and negative samples by using each crisis evaluation text.
Illustratively, the preset 5 crisis categories (a, b, c, d, e) are still described above as examples. Crisis category a has 60 crisis assessment texts (i.e., N a =60)。
The crisis category a is taken as a first crisis category, and the number of negative samples of the crisis category b (namely a second crisis category) to be expanded is as follows for 60 crisis evaluation texts under the crisis category a: number of crisis assessment texts under crisis category a N a Sample ratio P to crisis class b (i.e., second crisis class) ab Product of (i.e. N) a ×P ab =60×28.57% =17. The PC can randomly select 17 crisis evaluation texts from 60 crisis evaluation texts under the crisis category a to generate a negative sample corresponding to the crisis category b.
The crisis category a is taken as a first crisis category, and the number of negative samples of the crisis category c (namely a second crisis category) to be expanded is as follows for 60 crisis evaluation texts under the crisis category a: number of crisis assessment texts under crisis category a N a Sample ratio P to crisis class c (i.e., second crisis class) ac Product of (i.e. N) a ×P ac =60×23.57% =14. The PC can randomly select 14 crisis evaluation texts from 60 crisis evaluation texts under the crisis category a to generate a negative sample corresponding to the crisis category c.
The crisis category a is taken as a first crisis category, and the number of negative samples of the crisis category d (namely, a second crisis category) to be expanded is as follows for 60 crisis evaluation texts under the crisis category a: number of crisis assessment texts under crisis category a N a Sample ratio P to crisis class d (i.e., second crisis class) ad Product of (i.e. N) a ×P ad =60×11.61% =7. The PC can randomly select 7 crisis from 60 crisis evaluation texts under the crisis category aAnd evaluating the text to generate a negative sample corresponding to the crisis class d.
The crisis category a is taken as a first crisis category, and the number of negative samples of the crisis category e (namely a second crisis category) to be expanded is as follows for 60 crisis evaluation texts under the crisis category a: number of crisis assessment texts under crisis category a N a Sample ratio P to crisis class e (i.e., second crisis class) ae Product of (i.e. N) a ×P ae =60×5% =3. The PC can randomly select 3 crisis evaluation texts from 60 crisis evaluation texts under the crisis category a, and a negative sample corresponding to the crisis category e is generated.
The crisis category b, crisis category c, crisis category d and crisis category e are used as the first crisis category, the number of negative samples of other crisis categories to be expanded is calculated, and the negative samples are expanded according to the number; a method of calculating the number of negative samples of each of the other crisis categories to be expanded, and a method of expanding the negative samples according to the number may be referred to as a crisis category a as a first crisis category. The embodiments of the present application are not described herein in detail.
As an example, take m=5 as an example. For a preset 5 crisis categories (a, b, c, d, e), assume that there are 100 first crisis assessment texts for the first crisis category a. Based on the crisis evaluation text, the number of negative samples to be expanded into the crisis category b is calculated to be 20, the number of negative samples to be expanded into the crisis category c is calculated to be 10, the number of negative samples to be expanded into the crisis category d is calculated to be 5, and the number of negative samples to be expanded into the crisis category e is calculated to be 10.
And based on the calculated number of the other crisis categories to be expanded, taking the first crisis evaluation texts meeting the number requirement from the 100 first crisis evaluation texts to generate crisis samples.
Specifically, t1-t20 and 20 first crisis evaluation texts can be taken from crisis evaluation texts under the first crisis category. Wherein t is the number of the first crisis evaluation text, t1 represents the 1 st first crisis evaluation text, t20 represents the 20 th crisis evaluation text, and t1-t20 represent the 1 st first crisis evaluation text to the 20 th first crisis evaluation text. For each of the 20 first crisis assessment texts, crisis samples may be generated that include a positive sample, and a negative sample of crisis class b, so 20 crisis samples may be generated. For t21-t30, each of the 10 first crisis assessment texts may be taken, generating 10 sets of crisis samples, each set of crisis samples including a positive sample and a negative sample of crisis class c. Taking t31-t35,5 first crisis evaluation texts, and generating 5 groups of crisis samples, wherein each group of crisis samples comprises a positive sample and a negative sample of crisis category c. Taking t36-t45 and the crisis category c, and generating 10 groups of crisis samples by 10 first crisis evaluation texts, wherein each group of crisis samples comprises a positive sample and a negative sample of the crisis category c.
The generation mode of the crisis sample is not repeatedly extracted when a certain amount of crisis assessment texts are taken. In some embodiments, the sampling may also be repeated. As an example, in the crisis evaluation text, t1-t20 and crisis category b may be taken and combined to generate 20 negative samples, t1-t10 and crisis category c may be repeatedly taken and combined to generate 10 negative samples, t1-t5 and crisis category d may be repeatedly taken and combined to generate 5 negative samples.
Thus, each of t1-t5 of the first crisis assessment text may generate 5 sets of crisis samples, where each set of crisis samples includes a positive sample, a negative sample of crisis class b, a negative sample of crisis class c, and a negative sample of crisis class d. Each of t6-t10 of the first crisis assessment text may generate 5 sets of crisis samples, wherein each set of crisis samples includes a positive sample, a negative sample of crisis class b, and a negative sample of crisis class c. Each of the crisis assessment texts of t11-t20 may generate 10 sets of crisis samples, wherein each set of crisis samples includes a positive sample and a negative sample of crisis class c.
Thus, for multiple sets of crisis samples, the total number of negative samples in the same crisis class is consistent with the number of negative samples that the crisis class needs to expand. Taking the example of non-oversampling, the total number of 20 negative samples under crisis class b for the 20 crisis samples generated by each first crisis assessment text in t1-t20, which is consistent with the number of negative samples calculated previously that need to be expanded to crisis b for the crisis assessment text. Taking the repeated sampling as a column, the number of crisis category b is 5, 5 and 10 respectively in the crisis samples of 5 groups consisting of each first crisis evaluation text in t1-t5, the crisis samples of 5 groups consisting of each first crisis evaluation text in t6-t10 and the crisis samples of 10 groups consisting of each first crisis evaluation text in t11-t20, and the total number of the crisis category b is 20. This is consistent with the number of negative examples calculated in the foregoing that need to be expanded into crisis category b for crisis assessment text.
The embodiment of the application provides a training scheme of a neural network, which is used for public opinion crisis recognition, and the training process mainly comprises sample negative sampling, training of a small sample neural network learner and classification task conversion, as shown in fig. 6. The sample negative sampling is used for carrying out sample negative sampling according to the sample duty ratio formula, so that crisis categories with fewer crisis evaluation texts can be expanded, and the distinction degree of similar crisis categories can be expanded. The small sample neural network learner can learn the semantic information of deep layers in the text and the distinction between positive and negative samples. The classification task transformation may transform the multi-classification task into a plurality of 2-classification tasks, i.e., transform the multi-classification task into a classification task that crisis-evaluating whether the crisis problem in the text belongs to the corresponding crisis category.
Fig. 7 is a training flowchart of a neural network according to an embodiment of the present application, where the neural network is used for public opinion crisis recognition. As shown in fig. 7, for a crisis evaluation text "XX suddenly exploded while charging, too dangerous", weighted random negative sampling is performed first. Combining the crisis evaluation text with preset M categories to generate M crisis samples. Through negative sampling of the samples, crisis samples of different crisis categories can be constructed for a single crisis assessment text. The crisis samples are input into the small sample neural network learner, and the crisis samples are fewer in number, so that a twin network can be constructed to serve as the small sample neural network learner. The output of the neural network outputs a plurality of probability values through a plurality of 2-class SoftMax functions. Wherein each probability value indicates a probability that a crisis problem in a crisis evaluation text in the crisis data belongs to a corresponding crisis category. Thus, for a single sample, a classification result of 2 on each crisis class can be obtained. Finally, based on a plurality of probability values, the crisis problem described in the crisis evaluation text is obtained and belongs to the natural explosion class. In this way, the multi-classification task is converted into the 2-classification task, and each crisis sample is combined with other crisis categories to form a plurality of negative samples by negative sampling, so that a batch of positive and negative samples generated for the crisis sample only needs to be subjected to 2-classification identification of whether the crisis category or not.
The foregoing mainly describes a training method of the neural network for public opinion crisis recognition, and the following describes an application method of the model in connection with fig. 8. The method shown in fig. 8 is used for public opinion crisis recognition by using the neural network trained by the method as described above.
S801, the PC acquires a first evaluation text of the target object.
The first rating text may be a rating of the target object by a user in one or more platforms. As an example, the first evaluation text may be "XX phone is charged with sudden explosion, too dangerous".
At S802, the PC generates M crisis data corresponding to the first evaluation text.
The crisis data includes a first evaluation text and an indication. The indication information is used for indicating the crisis problem described in the first evaluation text, belongs to one crisis category of the preset M crisis categories, and crisis categories indicated by different indication information are different. The indication information may be, for example, "this is a crisis about natural explosions".
Taking 4 preset crisis categories as natural explosion crisis, personal injury crisis and information security crisis as an example. For the first evaluation text, "XX phone is suddenly exploded when charged, is too dangerous", 4 crisis data can be generated. The 4 crisis data may be, for example ("XX phone charging suddenly explodes, is too dangerous", "is a crisis related to natural explosion"), ("XX phone charging suddenly explodes, is too dangerous", "is a crisis related to personal injury"), ("XX phone charging suddenly explodes, is too dangerous", "is a crisis related to information security"), ("XX phone charging suddenly explodes, is too dangerous", "is a crisis related to x").
S803, the PC takes M crisis data as input respectively, and operates the neural network model to obtain probabilities that crisis problems described by the first evaluation text belong to M crisis categories respectively.
And inputting the obtained M crisis data into a trained neural network to obtain the probability that the crisis problem described by the first evaluation text belongs to M crisis categories.
As an example, the 4 crisis data are input into the trained neural network, and a probability value that the crisis problem described by the first evaluation text belongs to the crisis category indicated by the indication information in the crisis data is obtained. Specifically, when the XX mobile phone is charged, the mobile phone suddenly explodes and is dangerous, and the XX mobile phone is a crisis related to natural explosion, the crisis is input into the neural network model, and the probability that the crisis problem belongs to the natural explosion can be obtained. The probability that the crisis problem belongs to personal injury class can be obtained by inputting the XX mobile phone which is suddenly exploded and dangerous during charging into a neural network model. The probability that the crisis problem belongs to the information security class can be obtained by inputting the ("XX mobile phone is suddenly exploded and is dangerous when being charged", "the crisis related to the information security class") into the neural network model. The probability that the crisis problem belongs to the category can be obtained by inputting a "XX mobile phone is suddenly exploded and dangerous when being charged", "the crisis is related to the category") into a neural network model.
S804, the PC determines the crisis category to which the crisis problem described by the first evaluation text belongs according to the probability output by the neural network model.
Based on the probability output by the neural network model, the category to which the crisis problem described by the first evaluation text belongs can be obtained.
As an example, among the probabilities that the crisis problems described in the first evaluation text belong to M crisis categories, the crisis category to which the crisis problem described in the first evaluation text belongs is the crisis category to which the highest probability corresponds.
Therefore, the neural network model trained based on any one of the above methods is adopted to perform public opinion crisis recognition, before public opinion crisis recognition is performed, the evaluation sample is combined with the preset M crisis categories to generate M crisis data, and the M crisis data are used as input of the neural network model to predict crisis categories of crisis problems in the first evaluation text. By applying the neural network model to carry out public opinion crisis identification, the accuracy rate of crisis identification can be improved, and the crisis identification efficiency is improved.
The following description is made with reference to fig. 9. The neural network for public opinion crisis identification in fig. 9 may be a small sample neural network classifier.
As shown in fig. 9, for a single evaluation text, 4 crisis data, which may also be referred to as an input sample, as shown in fig. 9 may be obtained after negative sampling. 4 crisis data are input into a small sample neural network learner, softMax is carried out on each crisis data, and a probability value with a predictive label of 1 is taken. That is, the small sample neural network learner that inputs each piece of crisis data into the graph, and SoftMax is performed on each piece of crisis data, so that the probability that the crisis problem described by the first evaluation text is predicted as the crisis category described by the crisis data can be obtained.
The SoftMax function may convert the multi-classified output values into probability distributions ranging from (0, 1) to 1, with the following calculation formula:
Figure BDA0003974033560000201
where c represents the number of crisis categories, i.e., c=2, and represents two category labels of 0 and 1. The SoftMax function input is a vector representation of the small sample neural network learner output. The labels of the neural network classifier are redefined to be 0 and 1 after negative sampling. Wherein, the label 1 indicates that the crisis question in the first evaluation text belongs to the crisis category indicated in the first evaluation text, and the label 0 indicates that the crisis question in the first evaluation text does not belong to the crisis category indicated in the first evaluation text. Thus, the multi-classification task is converted into a 2-classification task output.
As shown in fig. 9, after SoftMax, for the first crisis data, the first crisis problem described in the first crisis data can be obtained, and the probability of belonging to the natural-year explosion class is 0.957, and the probability of not belonging to the natural-year explosion class is 0.043. Aiming at the second crisis data, the crisis problem described by the first text in the second crisis data can be obtained, the probability of personal injury is 0.533, and the probability of natural explosion is 0.467. For the third crisis data, the first crisis problem described in the third crisis data can be obtained, the probability of belonging to the information security class is 0.177, and the probability of not belonging to the information security class is 0.823. For the fourth crisis data, the first crisis problem described in the fourth crisis data may be obtained, where the probability of belonging to the category is 0.873, and the probability of not belonging to the category is 0.126.
After obtaining the probability value, the probability value (i.e. the value corresponding to prosb1 in fig. 9) belonging to the crisis category is taken, and ArgMax calculation is performed, so as to obtain the crisis category of the crisis problem described by the first evaluation text. The ArgMax function is used to return an index and a tag of the probability maximum. As shown in FIG. 9, argMax calculation was performed on [0.957,0.533,0.177,0.873] to obtain an index of 0.957 and a corresponding crisis class natural explosion class. And taking the natural explosion class as a crisis class to which the crisis problem described in the first evaluation text belongs.
Therefore, according to the public opinion identification method provided by the embodiment of the application, a single evaluation text, namely a single crisis source sound, is subjected to negative sampling to construct a new sample, then the new sample is converted into a two-classification task, and then the public opinion crisis event identification is realized by combining a small sample algorithm.
Embodiments of the present application also provide a computer storage medium including computer instructions that, when executed on an electronic device (e.g., electronic device 200 shown in fig. 2), cause the electronic device to perform the functions or steps of the method embodiments described above.
Embodiments of the present application also provide a computer program product which, when run on a computer, causes the computer to perform the functions or steps of the method embodiments described above.
It will be apparent to those skilled in the art from this description that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and the parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a readable storage medium. Based on such understanding, the technical solution of the embodiments of the present application may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a device (may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read Only Memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a specific embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (12)

1. A method of training a neural network for public opinion crisis identification, the method comprising:
acquiring one or more crisis evaluation texts under each crisis category in the preset M crisis categories; the crisis evaluation text is text of user evaluation target objects in one or more platforms, and is used for describing crisis problems of the target objects, and different crisis problems correspond to different crisis categories;
for each of the M crisis categories, performing: generating one or more sets of crisis samples based on crisis assessment text under the first crisis category; wherein each set of crisis samples includes a positive sample and a plurality of negative samples; the positive sample comprises a first crisis evaluation text, first indication information and a first label, wherein the first indication information is used for indicating that a crisis problem described by the first crisis evaluation text belongs to the first crisis category; the negative sample comprises the first crisis evaluation text, second indication information and a second label, wherein the second indication information is used for indicating that the crisis problem described by the first crisis evaluation text belongs to a second crisis category, and the second crisis category is one crisis category of the M crisis categories except the first crisis category; wherein the first tag and the second tag are different;
Taking the crisis sample as a training sample, training a preset neural network model, so that the trained neural network model has the capability of identifying an evaluation text and crisis category aiming at the target object, and outputting probability that the crisis problem described by the evaluation text belongs to the corresponding crisis category; the first crisis evaluation text and the first indication information in the crisis sample are used as input samples of the positive sample, the first label is used as output samples of the positive sample, the first crisis evaluation text and the second indication information in the crisis sample are used as input samples of the negative sample, and the second label is used as output samples of the negative sample.
2. The method of claim 1, wherein the predetermined neural network model is a twin network model.
3. The method of claim 2, wherein training a pre-set neural network model using the crisis sample as a training sample comprises:
and training the preset neural network model by using the crisis sample as a training sample by adopting an N-way-K-shot method.
4. The method of any of claims 1-3, wherein the generating one or more sets of crisis samples based on crisis assessment text under a first crisis category of the M crisis categories, comprising:
Obtaining the similarity of the first crisis category and each other crisis category in the M crisis categories, and the number of crisis evaluation texts under each crisis category in the M crisis categories;
calculating the number of negative samples of each other crisis category to be expanded for the crisis evaluation text under the first crisis category based on the acquired similarity and the number of crisis evaluation texts; the method comprises the steps of determining the similarity between a first crisis category and other crisis categories according to the similarity, wherein the similarity between the first crisis category and the other crisis categories is higher, the number of crisis evaluation texts under the other crisis categories is smaller, and the number of negative samples of the other crisis categories to be expanded is larger according to the crisis evaluation texts under the first crisis category;
generating one or more groups of crisis samples according to crisis evaluation texts under the first crisis category based on the number of negative samples of each other crisis category to be expanded; the total number of negative samples of the same other crisis category in the one or more crisis samples is equal to the number of negative samples which are required to be expanded and correspond to the other crisis category.
5. The method of claim 4, wherein calculating the number of negative examples for each other crisis category to be expanded for the crisis assessment text under the first crisis category based on the acquired similarity and the number of crisis assessment texts, comprising:
Executing, for each other crisis category of the M crisis categories other than the first crisis category:
calculating a sample duty ratio of the second crisis category based on the similarity of the first crisis category and the second crisis category and the number of crisis evaluation texts under each other crisis category in the M crisis categories;
and calculating the product of the number of the crisis evaluation texts under the first crisis category and the sample ratio of the second crisis category to obtain the number of the negative samples of the second crisis category to be expanded aiming at the crisis evaluation texts under the first crisis category.
6. The method of claim 5, wherein the calculating the sample duty cycle of the second crisis category based on the similarity of the first crisis category to the second crisis category and the number of crisis assessment text under each other crisis category of the M crisis categories, comprises:
the following formula is adopted:
Figure FDA0003974033550000021
calculating a sample duty cycle P of the second crisis class Ki
Wherein S is Ki Representing the similarity of the first crisis category k and the second crisis category i, N i Representing the number of crisis assessment text under the second crisis category i.
7. The method of claim 5 or 6, wherein the generating the one or more sets of crisis samples from crisis assessment text under the first crisis category based on the number of negative samples of each other crisis category to be augmented, comprising:
executing, for each other crisis category of the M crisis categories other than the first crisis category:
from N under the first crisis category k Selecting X in individual crisis assessment text i A crisis evaluation text; wherein X is i The number of negative samples of the second crisis class to be expanded;
based on the X i Each crisis assessment text of the individual crisis assessment texts performs: a positive sample and a negative sample of the second crisis class are generated.
8. The method of any one of claims 1-7, wherein the first tag is 1 and the second tag is 0.
9. A public opinion crisis identification method, for public opinion crisis identification using a neural network model trained by the method according to any one of claims 1-8, the method comprising:
acquiring a first evaluation text of a target object; the first evaluation text comprises evaluation of the target object by a user in one or more platforms;
Generating M crisis data corresponding to the first evaluation text; each crisis data comprises the first evaluation text and indication information, the indication information is used for indicating that the crisis problem described by the first evaluation text belongs to one crisis category of M preset crisis categories, and crisis categories indicated by the indication information included in different crisis data are different;
respectively taking the M crisis data as input, and operating the neural network model to obtain probabilities that crisis problems described by the first evaluation text belong to the M crisis categories respectively;
and determining the crisis category to which the crisis problem described by the first evaluation text belongs according to the probability output by the neural network model.
10. The method of claim 9, wherein determining the crisis category to which the crisis issue described by the first evaluation text belongs based on the probability output by the neural network model, comprising:
and respectively taking the crisis category corresponding to the maximum probability in the probabilities that the crisis problems described by the first evaluation text belong to the M crisis categories as the crisis category to which the crisis problems described by the first evaluation text belong.
11. An electronic device is characterized by comprising M preset crisis categories; the electronic device includes: a memory and one or more processors; the memory is coupled with the processor; wherein the memory is for storing computer program code, the computer program code comprising computer instructions; the computer instructions, when executed by the processor, cause the electronic device to perform the method of any of claims 1-10.
12. A computer readable storage medium comprising computer instructions which, when run on an electronic device, cause the electronic device to perform the method of any of claims 1-10.
CN202211530216.XA 2022-11-30 2022-11-30 Training method of neural network, public opinion crisis recognition method and related device Active CN116245154B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211530216.XA CN116245154B (en) 2022-11-30 2022-11-30 Training method of neural network, public opinion crisis recognition method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211530216.XA CN116245154B (en) 2022-11-30 2022-11-30 Training method of neural network, public opinion crisis recognition method and related device

Publications (2)

Publication Number Publication Date
CN116245154A true CN116245154A (en) 2023-06-09
CN116245154B CN116245154B (en) 2024-06-11

Family

ID=86633793

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211530216.XA Active CN116245154B (en) 2022-11-30 2022-11-30 Training method of neural network, public opinion crisis recognition method and related device

Country Status (1)

Country Link
CN (1) CN116245154B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110472665A (en) * 2019-07-17 2019-11-19 新华三大数据技术有限公司 Model training method, file classification method and relevant apparatus
CN110837572A (en) * 2019-11-15 2020-02-25 北京推想科技有限公司 Image retrieval method and device, readable storage medium and electronic equipment
CN112784130A (en) * 2021-01-27 2021-05-11 杭州网易云音乐科技有限公司 Twin network model training and measuring method, device, medium and equipment
WO2021114840A1 (en) * 2020-05-28 2021-06-17 平安科技(深圳)有限公司 Scoring method and apparatus based on semantic analysis, terminal device, and storage medium
CN115310443A (en) * 2022-09-06 2022-11-08 上海浦东发展银行股份有限公司 Model training method, information classification method, device, equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10657424B2 (en) * 2016-12-07 2020-05-19 Samsung Electronics Co., Ltd. Target detection method and apparatus
CN111523596B (en) * 2020-04-23 2023-07-04 北京百度网讯科技有限公司 Target recognition model training method, device, equipment and storage medium
CN112991017A (en) * 2021-03-26 2021-06-18 刘秀萍 Accurate recommendation method for label system based on user comment analysis
CN113268579B (en) * 2021-06-24 2023-12-08 中国平安人寿保险股份有限公司 Dialogue content category identification method, device, computer equipment and storage medium
CN115221274A (en) * 2022-06-22 2022-10-21 平安科技(深圳)有限公司 Text emotion classification method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110472665A (en) * 2019-07-17 2019-11-19 新华三大数据技术有限公司 Model training method, file classification method and relevant apparatus
CN110837572A (en) * 2019-11-15 2020-02-25 北京推想科技有限公司 Image retrieval method and device, readable storage medium and electronic equipment
WO2021114840A1 (en) * 2020-05-28 2021-06-17 平安科技(深圳)有限公司 Scoring method and apparatus based on semantic analysis, terminal device, and storage medium
CN112784130A (en) * 2021-01-27 2021-05-11 杭州网易云音乐科技有限公司 Twin network model training and measuring method, device, medium and equipment
CN115310443A (en) * 2022-09-06 2022-11-08 上海浦东发展银行股份有限公司 Model training method, information classification method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN116245154B (en) 2024-06-11

Similar Documents

Publication Publication Date Title
Shen et al. BBAS: Towards large scale effective ensemble adversarial attacks against deep neural network learning
CN109446430B (en) Product recommendation method and device, computer equipment and readable storage medium
WO2020125445A1 (en) Classification model training method, classification method, device and medium
US20220284327A1 (en) Resource pushing method and apparatus, device, and storage medium
CN111401445B (en) Training method of image recognition model, and image recognition method and device
CN109471978B (en) Electronic resource recommendation method and device
CN103810230A (en) Information processing device, information processing method, and program
CN113515942A (en) Text processing method and device, computer equipment and storage medium
CN114419509B (en) Multi-mode emotion analysis method and device and electronic equipment
CN112668482B (en) Face recognition training method, device, computer equipment and storage medium
CN109214333A (en) Convolutional neural networks structure, face character recognition methods, device and terminal device
WO2023134069A1 (en) Entity relationship identification method, device, and readable storage medium
CN114662484A (en) Semantic recognition method and device, electronic equipment and readable storage medium
US10229212B2 (en) Identifying Abandonment Using Gesture Movement
US20230334318A1 (en) Method and apparatus for data efficient semantic segmentation
CN112967100A (en) Similar population expansion method, device, computing equipment and medium
CN116245154B (en) Training method of neural network, public opinion crisis recognition method and related device
CN116204624A (en) Response method, response device, electronic equipment and storage medium
CN116383478A (en) Transaction recommendation method, device, equipment and storage medium
CN115708085B (en) Service processing and neural network model training method, device, equipment and medium
CN113409096B (en) Target object identification method and device, computer equipment and storage medium
CN113780318B (en) Method, device, server and medium for generating prompt information
CN114238968A (en) Application program detection method and device, storage medium and electronic equipment
CN113010728A (en) Song recommendation method, system, intelligent device and storage medium
CN115496039B (en) Word extraction method and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant