darkknight25 commited on
Commit
830a4e6
·
verified ·
1 Parent(s): d5a7e0c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +113 -3
README.md CHANGED
@@ -1,3 +1,113 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - text-classification
5
+ language:
6
+ - en
7
+ pretty_name: sunny thakur
8
+ size_categories:
9
+ - n<1K
10
+ ---
11
+ Adversarial Machine Learning TextFooler Dataset
12
+ Overview
13
+ This dataset, adversarial_machine_learning_textfooler_dataset.jsonl, is designed for research and evaluation in adversarial machine learning, specifically focusing on text-based adversarial attacks. It contains pairs of original and adversarial text samples, primarily generated using the TextFooler attack method, along with other adversarial techniques such as Homoglyph, Number Substitution, Typo, Emoji, Semantic Shift, Paraphrase, and Zero-Width character injections. The dataset is intended for testing the robustness of natural language processing (NLP) models against adversarial perturbations.
14
+ Dataset Description
15
+ The dataset is stored in JSON Lines (.jsonl) format, where each line represents a single record with the following fields:
16
+
17
+ original_text: The original, unaltered text input.
18
+ adversarial_text: The perturbed text after applying an adversarial attack.
19
+ true_label: The sentiment or classification label of the original text (positive, negative, or neutral).
20
+ is_adversarial: Boolean indicating whether the text is adversarial (true for all entries in this dataset).
21
+ attack_type: The type of adversarial attack applied (e.g., TextFooler, Homoglyph, Number Substitution, Typo, Emoji, Semantic Shift, Paraphrase, Cyrillic Homoglyph, Zero-Width Space, etc.).
22
+
23
+ Example Record
24
+ {
25
+ "original_text": "This was surprisingly good.",
26
+ "adversarial_text": "This was surprisingly excellent.",
27
+ "true_label": "positive",
28
+ "is_adversarial": true,
29
+ "attack_type": "TextFooler"
30
+ }
31
+
32
+ Dataset Statistics
33
+
34
+ Total Records: 400+ (exact count depends on final dataset size after deduplication).
35
+ Label Distribution:
36
+ Positive: ~50%
37
+ Negative: ~40%
38
+ Neutral: ~10%
39
+
40
+
41
+ Attack Types:
42
+ TextFooler: Synonym-based word replacement.
43
+ Homoglyph: Substitution with visually similar characters (e.g., Cyrillic or Greek letters).
44
+ Number Substitution: Replacing letters with numbers (e.g., e with 3).
45
+ Typo: Intentional misspellings.
46
+ Emoji: Addition of emoji characters.
47
+ Semantic Shift: Rewording with similar meaning but different phrasing.
48
+ Paraphrase: Complete rephrasing of the sentence.
49
+ Zero-Width Space/Non-Joiner/Joiner: Injection of invisible Unicode characters.
50
+ Cyrillic/Greek Homoglyph: Use of non-Latin characters resembling Latin ones.
51
+
52
+
53
+
54
+ Usage
55
+ This dataset is ideal for:
56
+
57
+ Adversarial Robustness Testing: Evaluate NLP models (e.g., sentiment classifiers) against adversarial attacks.
58
+ Attack Detection: Develop methods to detect adversarial perturbations in text inputs.
59
+ Model Hardening: Train models to improve resilience against adversarial attacks.
60
+ Research: Study the impact of various adversarial attack types on NLP model performance.
61
+
62
+ Loading the Dataset
63
+ You can load the dataset using Python with libraries like json or pandas:
64
+ import json
65
+
66
+ dataset = []
67
+ with open("adversarial_machine_learning_textfooler_dataset.jsonl", "r") as file:
68
+ for line in file:
69
+ dataset.append(json.loads(line))
70
+
71
+ # Example: Print first record
72
+ print(dataset[0])
73
+
74
+ Example Analysis
75
+ To analyze the dataset, you can use Python to compute statistics or visualize attack type distribution:
76
+ import pandas as pd
77
+ from collections import Counter
78
+ import matplotlib.pyplot as plt
79
+
80
+ # Load dataset
81
+ df = pd.read_json("adversarial_machine_learning_textfooler_dataset.jsonl", lines=True)
82
+
83
+ # Count attack types
84
+ attack_counts = Counter(df["attack_type"])
85
+ plt.bar(attack_counts.keys(), attack_counts.values())
86
+ plt.xticks(rotation=45)
87
+ plt.title("Distribution of Attack Types")
88
+ plt.xlabel("Attack Type")
89
+ plt.ylabel("Count")
90
+ plt.savefig("attack_type_distribution.png")
91
+
92
+ Installation and Dependencies
93
+ To work with this dataset, ensure you have the following Python libraries:
94
+
95
+ json: For parsing JSON Lines format.
96
+ pandas: For data manipulation and analysis.
97
+ matplotlib: For visualization (optional).
98
+
99
+ Install dependencies:
100
+ pip install pandas matplotlib
101
+
102
+ Notes
103
+
104
+ Deduplication: Some records may be duplicated due to repetitive attack patterns. It is recommended to deduplicate the dataset before use.
105
+ Ethical Considerations: This dataset is for research purposes only. Do not use it to create or deploy malicious adversarial attacks in production systems.
106
+ Limitations: The dataset focuses on English text and may not generalize to other languages. Some attack types (e.g., Zero-Width characters) may be less effective on certain NLP models.
107
+
108
+ Contributing
109
+ Contributions to expand the dataset with new attack types or additional samples are welcome. Please submit a pull request or contact the maintainers for collaboration.
110
+ License
111
+ This dataset is released under the MIT License.
112
+ Contact
113
+ For questions or issues, please open an issue on the repository or contact the dataset maintainers at sunny48445@gmail.com.