CN113221544B - Deep neural network resistance text generation method and system based on improved GA - Google Patents

Deep neural network resistance text generation method and system based on improved GA Download PDF

Info

Publication number
CN113221544B
CN113221544B CN202110511391.3A CN202110511391A CN113221544B CN 113221544 B CN113221544 B CN 113221544B CN 202110511391 A CN202110511391 A CN 202110511391A CN 113221544 B CN113221544 B CN 113221544B
Authority
CN
China
Prior art keywords
text
word
population
individuals
neural network
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.)
Active
Application number
CN202110511391.3A
Other languages
Chinese (zh)
Other versions
CN113221544A (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.)
Hohai University HHU
Original Assignee
Hohai University HHU
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 Hohai University HHU filed Critical Hohai University HHU
Priority to CN202110511391.3A priority Critical patent/CN113221544B/en
Publication of CN113221544A publication Critical patent/CN113221544A/en
Application granted granted Critical
Publication of CN113221544B publication Critical patent/CN113221544B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/247Thesauruses; Synonyms
    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/242Dictionaries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models
    • G06N3/126Evolutionary algorithms, e.g. genetic algorithms or genetic programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Biophysics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Physiology (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Genetics & Genomics (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

The application provides a deep neural network antagonistic text generation method and a system based on an improved Genetic Algorithm (GA). And then generating an optimal initial population according to the text input by the word stock library, judging the termination condition of the population, and iteratively performing heuristic multi-point crossing and mutation operation and cross-generation elite selection operation based on the fitness function on the premise that the termination condition is not met to obtain the next-generation population. The application can pertinently generate the initial population, reduce the iteration time, add part-of-speech constraint in the mutation operation and semantic consistency constraint in the offspring selection, improve the semantic consistency of the generated text, and use the cross-generation elite selection operation and heuristic multi-point crossing based on the fitness function, thereby being beneficial to improving the success rate of generating the antagonistic text.

Description

Deep neural network resistance text generation method and system based on improved GA
Technical Field
The application relates to a method and a system for generating an antagonistic text aiming at a deep neural network model based on an improved genetic algorithm (Genetic Algorithm, GA), belonging to the field of artificial intelligence testing.
Background
Testing deep neural networks using resistant text is a common testing method in the field of natural language processing. The existing method for generating the resistance text can be divided into three levels: sentence level, word level, and character level, wherein word level studies dominate. Word-level resistive text refers to the disturbance of words in the text to generate resistive text, and the current method mainly comprises the steps of inserting words in the text, deleting the words in the text, and moving the words in the text to change positions. Alzantot et al and Wang et al first used genetic algorithms to generate resistant text, they used synonym substitution to reduce the magnitude of the alteration to the original sample, and the results indicated that both the success rate of attack on the resistant text they generated and the number of words replaced had good effects. Their approach still suffers from some drawbacks: they typically need to make a very large number of iterations to find the appropriate perturbation to generate the resistive text, which makes their method expensive in time; they do not have part of speech and semantic constraints when doing synonym replacement, and there is no guarantee of the semantics of the generated challenge text.
Disclosure of Invention
The application aims to: considering the importance of the natural language processing field to test the deep neural network, the existing natural language processing field test method cannot guarantee the semantic consistency and time of generating the antagonistic text. The application provides a deep neural network resistance text generation method and a system based on an improved genetic algorithm, which aim at a given target network, and improve the genetic algorithm based on an original data set and a label thereof so as to improve the success rate of generating the resistance text, reduce the generation time and ensure the semantic consistency of the generated resistance text.
The technical scheme is as follows: in order to achieve the above object, the method for generating the resistive text of the deep neural network based on the improved genetic algorithm of the present application comprises the following steps:
step 1: acquiring a corresponding data set and corresponding label information of a deep neural network to be tested;
step 2: encoding words in the data set into word vectors, and generating a word distance matrix based on word vector space distances to form a synonym database;
step 3: generating an optimal initial population for the input text data according to the synonym library and the word influence screening method;
step 4: judging the termination condition of the current optimal population, outputting the optimal individual and exiting the program when the termination condition requirement is met, obtaining the antagonistic text of the input text data, and executing the step 5 when the termination condition requirement is not met;
step 5: selecting the population which does not meet the termination condition in the step 4, and performing heuristic multi-point cross operation based on the fitness function on each selected individual to form a variation seed pool;
step 6: performing part-of-speech-based mutation on individuals in the mutation seed pool, wherein the mutated individuals form a temporary offspring population;
step 7: mixing the temporary offspring population and the parent population thereof, and screening individuals based on a cross-generation elite selection method and semantic consistency constraint to form a final optimal population;
step 8: repeating the step 4-7 until the requirement of the termination condition is met.
Further, the text data set in the step 1 includes an original training set and a test set of the deep neural network to be tested.
The data preprocessing mainly comprises the steps of establishing a corresponding synonym word stock according to a data set, wherein the step 2 is further as follows:
step 21: word segmentation is carried out on all texts in the current dataset, and a corresponding dataset dictionary is generated;
step 22: using a Glove model to vectorize and express words in a dictionary, and finally forming a word embedding matrix;
step 23: and (4) calculating the space distance between words by using the Euclidean distance to the word embedding matrix generated in the step (22), and generating a word distance matrix by arranging the space distances from near to far to form a synonym word stock.
How to generate the optimal initial population is an important link in the method, the method adopts a word influence screening method to heuristically generate the initial population, and the step 3 is further as follows:
step 31: acquiring each word of an input data text, and filtering stop words in the input data text;
step 32: inputting the text formed by deleting each filtered word from the original text into a deep neural network to be tested in sequence, and then obtaining the influence score of the current word according to the output deviation of the current word and the original text, wherein the larger the influence score is, the larger the influence of the word in the text on the correct output of the deep neural network is;
step 33: based on the word influence score, heuristically selecting Top 60-100 words with high scores to replace synonyms, wherein the searching of the synonyms is completed based on the synonym database generated in the step 2 and the constraint of using word parts of speech, and each word is replaced by a plurality of synonyms to generate a plurality of new individuals, and finally an initial population is formed.
Further, the step 4 sets an algorithm termination condition and judges the termination condition of the current population, which specifically includes:
step 41: finding out optimal individuals according to the attack effect on the deep neural network model on individuals of the current population, wherein the attack effect refers to the confidence coefficient deviation between the model output of the current individuals and the model output of the original text, and the larger the deviation is, the better the attack effect is represented;
step 42: judging whether the optimal individual and the current iteration number meet a termination condition, wherein the termination condition is set to be that the model output label of the current individual is not equal to the model output label of the original text or the current iteration number reaches the maximum iteration number; if the optimal individuals which enable the model output labels and the original text corresponding output labels to be different are found, outputting the optimal individuals and ending the program, if the current iteration number reaches the maximum iteration number, outputting the individuals with the best attack effect as the optimal individuals and ending the program, and if the termination condition is not met, continuing the next step.
And (3) carrying out fitness function-based selection operation and fitness function-based heuristic multi-point cross operation on the population which does not meet the termination condition, wherein the step (5) is further as follows:
step 51: ranking each individual of the population that does not meet the termination condition from large to small according to the fitness function and finally selecting a set number of constituent parent populations, assumingRepresenting f output tag at input x +.>Delta represents the semantic consistency of the replacement text with the original text, sigma represents the dissimilarity ratio, i.e. the ratio of the number of transformed words to the total number of text words, p 1 、p 2 、p 3 Is the weight of each term of the formula, the fitness function calculation formula is that
Step 52: setting a cross coefficient and a cross condition to ensure the randomness of population individuals, wherein the cross coefficient is 0-1, generating a random number of 0-1 before cross operation is carried out on each individual of the parent population, and carrying out cross operation only when the cross condition that the random number is smaller than the cross coefficient is met;
step 53: in order to randomly search another individual in the parent population range for the individual meeting the crossing condition, heuristic multi-point crossing operation is carried out on the two individuals based on the fitness function, and a variation seed pool is formed by the new individual finally generated.
Further, in the step 6, the mutation based on the part-of-speech constraint is performed on the individuals in the mutation seed pool, which specifically includes:
step 61: setting a variation coefficient, generating a random number for each individual in the variation seed pool, and performing variation on the individual only when the random number is smaller than the variation coefficient;
step 62: in order to randomly select a position as a variation point in the range of the word length of an individual meeting the variation condition, the synonym is replaced for the word at the variation point based on the synonym word stock generated in the step 23 and the constraint of word parts of speech by using, and the generated new individual forms a temporary offspring population.
Further, in the step 7, the temporary offspring population formed in the step 62 and the parent population formed in the step 51 are mixed, cross-generation elite screening is performed on the mixed population based on the fitness function containing text semantic consistency in the step 51, and a plurality of individuals with highest scores are selected to form a final offspring population.
Further, the semantic consistency of the generated individuals and the original text is represented by cosine included angles of word frequency vectors of the two texts.
Based on the same inventive concept, the application provides a deep neural network resistance text generation system based on an improved genetic algorithm, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the computer program is used for realizing the deep neural network resistance text generation method based on the improved genetic algorithm when being loaded to the processor.
The beneficial effects are that: the application provides a deep neural network resistance text generation method based on an improved genetic algorithm, which is characterized in that an initial population part is generated, and an initial population with higher quality is generated by using word influence, part of speech and word space distance; in the cross variation part, heuristic multi-point cross based on fitness function is used, and part-of-speech constraint is added in the variation; in the offspring population generation section, the provisional offspring population and the parent population formed after mutation are mixed, and then cross-generation elite selection is performed based on an fitness function containing text semantic consistency. Compared with the prior art, the method can effectively reduce the iteration times and the total iteration time of the genetic algorithm, can ensure that the generated antagonistic text has better consistency with the original text in terms of semantics, can reduce the occurrence of local optimal solutions, and can improve the success rate of generating the antagonistic text.
Drawings
FIG. 1 is an overall step diagram of an embodiment of the present application;
fig. 2 is a flow chart of a method according to an embodiment of the present application.
Detailed Description
The present application is further illustrated below in conjunction with specific embodiments, it being understood that these embodiments are meant to be illustrative of the application and not limiting the scope of the application, and that modifications of the application, which are equivalent to those skilled in the art to which the application pertains, fall within the scope of the application defined in the appended claims after reading the application.
As shown in fig. 1, the embodiment of the application discloses a deep neural network resistance text generation method based on an improved genetic algorithm, which mainly comprises the following steps:
step 1: acquiring a corresponding data set and corresponding label information of a deep neural network to be tested;
step 2: encoding words in the text data set into word vectors, and generating a word distance matrix based on word vector space distances to form a synonym word stock;
step 3: generating an optimal initial population for the input text data according to the synonym library and the word influence screening method;
step 4: judging the termination condition of the current optimal population, outputting the optimal individual and exiting the program when the termination condition requirement is met, obtaining the antagonistic text of the input text data, and executing the step 5 when the termination condition requirement is not met;
step 5: selecting the population which does not meet the termination condition in the step 4, and performing heuristic multi-point cross operation based on the fitness function on each selected individual to form a variation seed pool;
step 6: performing part-of-speech-based mutation on individuals in the mutation seed pool, wherein the mutated individuals form a temporary offspring population;
step 7: mixing the temporary offspring population and the parent population thereof, and screening individuals based on a cross-generation elite selection method and semantic consistency constraint to form a final optimal population;
step 8: repeating the step 4-7 until the requirement of the termination condition is met.
As shown in fig. 2, taking a deep neural network for text classification as an example, the detailed steps of a deep neural network resistance text generation method based on an improved genetic algorithm disclosed in the embodiment of the present application are specifically as follows:
step 1: the method comprises the steps of obtaining an IMDB movie comment data set, wherein the method mainly comprises two aspects:
step 11: downloading the training set, the test set and the corresponding labels thereof by using an IMDB data set downloading website (http:// ai. Stanford. Edu/-amaas/data/sender/aclimdb_v1. Tar. Gz);
step 12: the required data is read from the corresponding compressed file and stored locally.
Step 2: generating a synonym database of the IMDB data set according to the Glove model, wherein the detailed process is as follows:
step 21: segmenting all texts in the IMDB data set, generating a dic dictionary and an inv_dic dictionary, wherein words in the dictionary are represented by words, idx represents the positions of words in the dictionary, and the key value pair format of the dic dictionary is word: the key-value pair format of the idx ", inv_dic dictionary is" idx: word ";
step 22: using a Glove model to vectorize and express words in an IMDB data set dictionary, and finally forming a word embedding matrix;
step 23: the euclidean distance is used to calculate the spatial distance between words for the word embedding matrix generated in step 22, and the word distance matrix is generated by arranging the spatial distances from near to far, so as to form a synonym word stock (the closer the distance is, the more synonyms are considered). Wherein the matrix row number represents the word with the same number in the dictionary, and the elements on each row are orderly arranged according to the distance from the word. The Euclidean distance formula is Where x ', y' represent the word vector for which the distance needs to be calculated and n is the vector dimension.
Step 3: generating an optimal initial population of input text data according to a word stock library and a word influence screening method, wherein the method comprises the following specific steps of:
step 31: each word of the input data text is acquired, and the stop words such as ", 'the', 'and', 'a', 'of', 'to', 'is', 'br', 'it', 'in', 'i', 'this', 'that','s', 'wass', 'as', 'for', 'with', 'movie', 'but', 'film', 'you', 'on', 'n't ',' not ',' are filtered;
step 32: inputting the text formed by deleting each filtered word from the original text into the deep neural network to be tested in turn, calculating the influence score of the word according to the output at the moment and the output of the original text through a formula, assuming that x represents the original text,representing a text formed after deleting the ith word, f representing the deep neural network to be tested, y representing the output label of the deep neural network f on the input text x, < +.>The input representing f is +.>Output label of time, f (x, y) represents confidence of output label y of f when x is input, word w i Is the influence score of (2)
S(x,w i ) The larger the word w i The greater the impact on the correct output of the deep neural network in the text;
step 33: based on the word influence score, top80 words with high scores are preferentially selected for synonym replacement, wherein the search of the synonyms is completed based on the synonym database generated in the step 2 and the constraint of word parts of speech (the synonym database is based on the word vector space distance, and the constraint of word parts of speech can be realized by means of the pos_tag method of the ntk database in python) and each word is replaced by at least 2 synonyms to generate a plurality of new individuals, and finally an initial population containing 160 individuals is formed.
Step 4: judging termination conditions of the current population, wherein the method comprises the following specific steps of:
step 41: finding out optimal individuals according to the attack effect on the deep neural network model on individuals of the current population, wherein the attack effect refers to the confidence coefficient deviation between the model output of the current individuals and the model output of the original text, and the larger the deviation is, the better the attack effect is represented;
step 42: judging whether the optimal individual and the current iteration number meet the termination condition, wherein the termination condition is that the model output label of the current individual is not equal to the model output label of the original text (in the IMDB dataset, positive label pos is represented by 1, negative label neg is represented by 0), or the current iteration number reaches the maximum iteration number (set to 20), outputting the optimal individual and ending the program if the termination condition is met, and continuing the next step if the termination condition is not met.
Step 5: and selecting the population which does not meet the termination condition based on the fitness function and heuristic multipoint crossing operation based on the fitness function, wherein the specific steps are as follows:
step 51: ranking each individual of the population that does not meet the termination condition from large to small according to the fitness function and finally selecting Top60 to form the parent population, assumingRepresenting f output tag at input x +.>Delta represents the semantic consistency of the replacement text with the original text, sigma represents the dissimilarity ratio, i.e. the ratio of the number of transformed words to the total number of text words, p 1 、p 2 、p 3 Is the weight of each term of the formula, the fitness function calculation formula is +.>At this time p 1 、p 2 、p 3 0.3, 0.35 respectively;
calculating semantic consistency between the generated individual and the original input text by utilizing cosine included angle similarity, wherein a calculation formula of the cosine included angle is as followsWherein X and Y are respectively the original text and the word frequency vector representation of the generated individual; catabolism formula->Wherein M and M respectively represent the number of words replaced by the individual and the total number of words of the original text;
step 52: setting a cross coefficient and a cross condition to ensure the randomness of individuals in the population, wherein the cross coefficient is set to be 0.5, generating a random number of 0-1 before each individual in the parent population performs cross operation, and performing cross operation only when the cross condition that the random number is smaller than the cross coefficient is met;
step 53: in order to randomly search another individual in the parent population range for the individual meeting the crossing condition, heuristic multi-point crossing operation based on fitness function is carried out on the two individuals, firstly, variation point positions are randomly generated, word blocks among variation points are determined by using a probability formula based on the fitness function, and finally, the generated new individual forms a variation seed pool.
The probability formula based on the fitness function is as follows: assuming V, W represents the parent individual, V (i) represents the ith word block of parent individual V, score (V) represents the fitness function of individual V, then the probability that the ith word block of offspring uses the same-position word block of parent V is
Step 6: the individual in the mutation seed pool is subjected to part-of-speech-based mutation, and the specific steps are as follows:
step 61: setting the variation coefficient to be 0.01, generating a random number between 0 and 1 for each individual in the variation seed pool, and performing variation on the individual only when the random number is smaller than the variation coefficient;
step 62: in order to randomly select a position as a variation point in the range of the word length of an individual meeting variation conditions, the words at the variation point are replaced by synonyms based on the synonym word stock generated in the step 23 and the constraint of word parts of speech, specifically, the word at each variation point is required to be replaced by 5 synonyms with the same part of speech and the nearest distance, so that 5 sub-generation individuals are finally generated for 1 individual allowing variation, and the generated new individuals form a temporary sub-population.
Step 7: the temporary offspring population formed in step 62 and the parent population formed in step 51 are mixed, the mixed population is screened based on the fitness function containing text semantic consistency, and Top60 with the highest score is selected to form the final offspring population. The selected fitness function has a calculation formula of At this time p 1 、p 2 、p 3 0.5, 0.25, respectively.
Step 8: repeating the step 4-7 until the requirement of the termination condition is met.
Based on the same inventive concept, the embodiment of the application discloses a deep neural network resistance text generation system based on an improved genetic algorithm, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the computer program is loaded to the processor to realize the deep neural network resistance text generation method based on the improved genetic algorithm.

Claims (5)

1. The deep neural network resistance text generation method based on the improved genetic algorithm is characterized by comprising the following steps of:
step 1: acquiring a text data set and corresponding label information of a deep neural network to be tested;
step 2: encoding words in the text data set into word vectors, and generating a word distance matrix based on word vector space distances to form a synonym word stock; comprising the following steps:
step 21: word segmentation is carried out on all texts in the current dataset, and a corresponding dataset dictionary is generated;
step 22: using a Glove model to vectorize and express words in a dictionary, and finally forming a word embedding matrix;
step 23: calculating the space distance between words by using Euclidean distance to the word embedding matrix generated in the step 22, and arranging from near to far according to the space distance to generate a word distance matrix to form a synonym word stock;
step 3: generating an optimal initial population for the input text data according to the synonym library and the word influence screening method; comprising the following steps:
step 31: acquiring each word of an input data text, and filtering stop words in the input data text;
step 32: inputting the text formed by deleting each filtered word from the original text into a deep neural network to be tested in sequence, and then obtaining the influence score of the current word according to the output deviation of the current word and the original text, wherein the larger the influence score is, the larger the influence of the word in the text on the correct output of the deep neural network is;
step 33: based on the word influence score, preferentially selecting a set number of words with high scores to replace synonyms, wherein the searching of the synonyms is completed based on a synonym database and constraint of word parts of speech, each word is replaced by a plurality of synonyms to generate a plurality of new individuals, and the best initial population is finally formed;
step 4: judging the current optimal population under the termination condition, outputting the optimal individual and exiting the program when the termination condition is met, obtaining the antagonistic text of the input text data, and executing the step 5 when the termination condition is not met; comprising the following steps:
step 41: finding out the optimal individuals of the current optimal population according to the attack effect on the deep neural network model, wherein the attack effect refers to the confidence coefficient deviation between the model output of the current individuals and the model output of the original text, and the larger the deviation is, the better the attack effect is represented;
step 42: if the optimal individuals with different model output labels and original text corresponding output labels are found, outputting the optimal individuals and ending the program, or outputting the individuals with the best attack effect as the optimal individuals and ending the program if the current iteration number reaches the maximum iteration number, otherwise, continuing the next step;
step 5: selecting the population which does not meet the termination condition in the step 4, and performing heuristic multi-point cross operation based on the fitness function on each selected individual to form a variation seed pool; comprising the following steps:
step 51: sequencing each individual of the population which does not meet the termination condition from large to small according to the fitness function, finally selecting a set number of individuals to form a parent population, and settingRepresenting deep neural network f outputting tag +.>Delta represents the semantic consistency of the replacement text with the original text, sigma represents the dissimilarity ratio, i.e. the ratio of the number of transformed words to the total number of text words, p 1 、p 2 、p 3 Is the weight of each term of the formula, the fitness function calculation formula is that
Step 52: setting a cross coefficient and a cross condition to ensure the randomness of individuals in the population, generating a random number before each individual in the parent population is subjected to cross operation, and performing cross operation only when the cross condition that the random number is smaller than the cross coefficient is met;
step 53: in order to randomly search another individual in the parent population range for the individual meeting the crossing condition, performing heuristic multi-point crossing operation on the two individuals based on the fitness function, and finally forming a variation seed pool by the generated new individual;
step 6: performing part-of-speech-based mutation on individuals in the mutation seed pool, wherein the mutated individuals form a temporary offspring population; comprising the following steps:
step 61: setting a variation coefficient, generating a random number for each individual in the variation seed pool, and performing variation on the individual only when the random number is smaller than the variation coefficient;
step 62: randomly selecting an individual meeting a variation condition as a variation point in the word length range, replacing synonyms for the words at the variation point based on a synonym word stock and using the constraint of word parts of speech, and forming a temporary offspring population by the generated new individual;
step 7: mixing the temporary offspring population and the parent population thereof, and screening individuals to form an optimal population based on a cross-generation elite selection method and semantic consistency constraint;
step 8: repeating the step 4-7 until the requirement of the termination condition is met.
2. The method for generating resistive text based on the deep neural network of the improved genetic algorithm as claimed in claim 1, wherein the text data set in the step 1 comprises a training set and a testing set of the deep neural network to be tested.
3. The method for generating the resistance text by the deep neural network based on the improved genetic algorithm according to claim 1, wherein the step 7 is characterized in that parent generation populations of the temporary offspring population are mixed, the mixed population is screened based on a fitness function containing text semantic consistency, and a plurality of individuals with highest scores are selected to form a final offspring population.
4. The method for generating the resistance text by using the deep neural network based on the improved genetic algorithm according to claim 1, wherein the semantic consistency of the generated individuals and the original text is represented by cosine included angles of word frequency vectors of the two texts.
5. A deep neural network resistant text generation system based on an improved genetic algorithm, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program when loaded to the processor implements the deep neural network resistant text generation method based on an improved genetic algorithm according to any of claims 1-4.
CN202110511391.3A 2021-05-11 2021-05-11 Deep neural network resistance text generation method and system based on improved GA Active CN113221544B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110511391.3A CN113221544B (en) 2021-05-11 2021-05-11 Deep neural network resistance text generation method and system based on improved GA

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110511391.3A CN113221544B (en) 2021-05-11 2021-05-11 Deep neural network resistance text generation method and system based on improved GA

Publications (2)

Publication Number Publication Date
CN113221544A CN113221544A (en) 2021-08-06
CN113221544B true CN113221544B (en) 2023-10-03

Family

ID=77094661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110511391.3A Active CN113221544B (en) 2021-05-11 2021-05-11 Deep neural network resistance text generation method and system based on improved GA

Country Status (1)

Country Link
CN (1) CN113221544B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111241807A (en) * 2019-12-31 2020-06-05 浙江大学 Machine reading understanding method based on knowledge-guided attention
US10831990B1 (en) * 2019-05-09 2020-11-10 International Business Machines Corporation Debiasing textual data while preserving information
US10915697B1 (en) * 2020-07-31 2021-02-09 Grammarly, Inc. Computer-implemented presentation of synonyms based on syntactic dependency
CN112765355A (en) * 2021-01-27 2021-05-07 江南大学 Text anti-attack method based on improved quantum behavior particle swarm optimization algorithm

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10831990B1 (en) * 2019-05-09 2020-11-10 International Business Machines Corporation Debiasing textual data while preserving information
CN111241807A (en) * 2019-12-31 2020-06-05 浙江大学 Machine reading understanding method based on knowledge-guided attention
US10915697B1 (en) * 2020-07-31 2021-02-09 Grammarly, Inc. Computer-implemented presentation of synonyms based on syntactic dependency
CN112765355A (en) * 2021-01-27 2021-05-07 江南大学 Text anti-attack method based on improved quantum behavior particle swarm optimization algorithm

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于支配关系的数据流测试用例生成方法;吉顺慧;张鹏程;;计算机科学(第09期);全文 *
引入自编码机制对抗网络的文本生成模型;韩虎;孙天岳;赵启涛;;计算机工程与科学(第09期);全文 *

Also Published As

Publication number Publication date
CN113221544A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
Vateekul et al. A study of sentiment analysis using deep learning techniques on Thai Twitter data
CN111444320B (en) Text retrieval method and device, computer equipment and storage medium
CN108132927B (en) Keyword extraction method for combining graph structure and node association
CN109840287A (en) A kind of cross-module state information retrieval method neural network based and device
Quteineh et al. Textual data augmentation for efficient active learning on tiny datasets
Rahman et al. Classifying non-functional requirements using RNN variants for quality software development
Wahid et al. Cricket sentiment analysis from Bangla text using recurrent neural network with long short term memory model
CN115393692A (en) Generation formula pre-training language model-based association text-to-image generation method
CN111985228B (en) Text keyword extraction method, text keyword extraction device, computer equipment and storage medium
CN111966810B (en) Question-answer pair ordering method for question-answer system
CN109597747A (en) A method of across item association defect report is recommended based on multi-objective optimization algorithm NSGA- II
JP2021182398A (en) Event prediction device and program for event prediction
CN112883722B (en) Distributed text summarization method based on cloud data center
CN114936266A (en) Multi-modal fusion rumor early detection method and system based on gating mechanism
CN114048729A (en) Medical document evaluation method, electronic device, storage medium, and program product
CN114564563A (en) End-to-end entity relationship joint extraction method and system based on relationship decomposition
CN113505583A (en) Sentiment reason clause pair extraction method based on semantic decision diagram neural network
CN111145914A (en) Method and device for determining lung cancer clinical disease library text entity
Nazeer et al. Use of novel ensemble machine learning approach for social media sentiment analysis
CN111709225A (en) Event cause and effect relationship judging method and device and computer readable storage medium
CN113221544B (en) Deep neural network resistance text generation method and system based on improved GA
CN115098690B (en) Multi-data document classification method and system based on cluster analysis
Alam et al. Probabilistic neural network and word embedding for sentiment analysis
CN115640799A (en) Sentence vector characterization method based on enhanced momentum contrast learning
CN115600595A (en) Entity relationship extraction method, system, equipment and readable storage medium

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