-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #541 from QData/master
Update
- Loading branch information
Showing
33 changed files
with
768 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.constraints.grammaticality package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.constraints package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.constraints.semantics package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.datasets package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.goal\_functions package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
textattack.metrics.attack\_metrics package | ||
========================================== | ||
|
||
.. automodule:: textattack.metrics.attack_metrics | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
|
||
.. automodule:: textattack.metrics.attack_metrics.attack_queries | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
.. automodule:: textattack.metrics.attack_metrics.attack_success_rate | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
.. automodule:: textattack.metrics.attack_metrics.words_perturbed | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
textattack.metrics.quality\_metrics package | ||
=========================================== | ||
|
||
.. automodule:: textattack.metrics.quality_metrics | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
|
||
.. automodule:: textattack.metrics.quality_metrics.perplexity | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
.. automodule:: textattack.metrics.quality_metrics.use | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
textattack.metrics package | ||
========================== | ||
|
||
.. automodule:: textattack.metrics | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
textattack.metrics.attack_metrics | ||
textattack.metrics.quality_metrics | ||
|
||
|
||
|
||
.. automodule:: textattack.metrics.metric | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.models package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.shared package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ textattack.transformations package | |
:show-inheritance: | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 6 | ||
|
||
|
74 changes: 74 additions & 0 deletions
74
tests/sample_outputs/run_attack_hotflip_lstm_mr_4_adv_metrics.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/.*/Attack( | ||
(search_method): BeamSearch( | ||
(beam_width): 10 | ||
) | ||
(goal_function): UntargetedClassification | ||
(transformation): WordSwapGradientBased( | ||
(top_n): 1 | ||
) | ||
(constraints): | ||
(0): MaxWordsPerturbed( | ||
(max_num_words): 2 | ||
(compare_against_original): True | ||
) | ||
(1): WordEmbeddingDistance( | ||
(embedding): WordEmbedding | ||
(min_cos_sim): 0.8 | ||
(cased): False | ||
(include_unknown_words): True | ||
(compare_against_original): True | ||
) | ||
(2): PartOfSpeech( | ||
(tagger_type): nltk | ||
(tagset): universal | ||
(allow_verb_noun_swap): True | ||
(compare_against_original): True | ||
) | ||
(3): RepeatModification | ||
(4): StopwordModification | ||
(is_black_box): False | ||
) | ||
|
||
--------------------------------------------- Result 1 --------------------------------------------- | ||
[[Positive (96%)]] --> [[Negative (77%)]] | ||
|
||
the story gives ample opportunity for large-scale action and suspense , which director shekhar kapur [[supplies]] with tremendous skill . | ||
|
||
the story gives ample opportunity for large-scale action and suspense , which director shekhar kapur [[stagnated]] with tremendous skill . | ||
|
||
|
||
--------------------------------------------- Result 2 --------------------------------------------- | ||
[[Negative (57%)]] --> [[[SKIPPED]]] | ||
|
||
red dragon " never cuts corners . | ||
|
||
|
||
--------------------------------------------- Result 3 --------------------------------------------- | ||
[[Positive (51%)]] --> [[[FAILED]]] | ||
|
||
fresnadillo has something serious to say about the ways in which extravagant chance can distort our perspective and throw us off the path of good sense . | ||
|
||
|
||
--------------------------------------------- Result 4 --------------------------------------------- | ||
[[Positive (89%)]] --> [[[FAILED]]] | ||
|
||
throws in enough clever and unexpected twists to make the formula feel fresh . | ||
|
||
|
||
|
||
+-------------------------------+--------+ | ||
| Attack Results | | | ||
+-------------------------------+--------+ | ||
| Number of successful attacks: | 1 | | ||
| Number of failed attacks: | 2 | | ||
| Number of skipped attacks: | 1 | | ||
| Original accuracy: | 75.0% | | ||
| Accuracy under attack: | 50.0% | | ||
| Attack success rate: | 33.33% | | ||
| Average perturbed word %: | 5.56% | | ||
| Average num. words per input: | 15.5 | | ||
| Avg num queries: | 1.33 | | ||
| Average Original Perplexity: | 291.47 | | ||
| Average Attack Perplexity: | 320.33 | | ||
| Average Attack USE Score: | 0.91 | | ||
+-------------------------------+--------+ |
68 changes: 68 additions & 0 deletions
68
tests/sample_outputs/run_attack_transformers_datasets_adv_metrics.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/.*/Attack( | ||
(search_method): GreedyWordSwapWIR( | ||
(wir_method): unk | ||
) | ||
(goal_function): UntargetedClassification | ||
(transformation): CompositeTransformation( | ||
(0): WordSwapNeighboringCharacterSwap( | ||
(random_one): True | ||
) | ||
(1): WordSwapRandomCharacterSubstitution( | ||
(random_one): True | ||
) | ||
(2): WordSwapRandomCharacterDeletion( | ||
(random_one): True | ||
) | ||
(3): WordSwapRandomCharacterInsertion( | ||
(random_one): True | ||
) | ||
) | ||
(constraints): | ||
(0): LevenshteinEditDistance( | ||
(max_edit_distance): 30 | ||
(compare_against_original): True | ||
) | ||
(1): RepeatModification | ||
(2): StopwordModification | ||
(is_black_box): True | ||
) | ||
|
||
--------------------------------------------- Result 1 --------------------------------------------- | ||
[[Negative (100%)]] --> [[Positive (71%)]] | ||
|
||
[[hide]] [[new]] secretions from the parental units | ||
|
||
[[Ehide]] [[enw]] secretions from the parental units | ||
|
||
|
||
--------------------------------------------- Result 2 --------------------------------------------- | ||
[[Negative (100%)]] --> [[[FAILED]]] | ||
|
||
contains no wit , only labored gags | ||
|
||
|
||
--------------------------------------------- Result 3 --------------------------------------------- | ||
[[Positive (100%)]] --> [[Negative (96%)]] | ||
|
||
that [[loves]] its characters and communicates [[something]] [[rather]] [[beautiful]] about human nature | ||
|
||
that [[lodes]] its characters and communicates [[somethNng]] [[rathrer]] [[beautifdul]] about human nature | ||
|
||
|
||
|
||
+-------------------------------+---------+ | ||
| Attack Results | | | ||
+-------------------------------+---------+ | ||
| Number of successful attacks: | 2 | | ||
| Number of failed attacks: | 1 | | ||
| Number of skipped attacks: | 0 | | ||
| Original accuracy: | 100.0% | | ||
| Accuracy under attack: | 33.33% | | ||
| Attack success rate: | 66.67% | | ||
| Average perturbed word %: | 30.95% | | ||
| Average num. words per input: | 8.33 | | ||
| Avg num queries: | 22.67 | | ||
| Average Original Perplexity: | 1126.57 | | ||
| Average Attack Perplexity: | 2823/.*/| | ||
| Average Attack USE Score: | 0.76 | | ||
+-------------------------------+---------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.