Datasets:
Update README.md
Browse files
README.md
CHANGED
@@ -21,10 +21,23 @@ You are provided with a large number of Wikipedia comments which have been label
|
|
21 |
|
22 |
The original dataset can be found here: [jigsaw_toxic_classification](https://www.kaggle.com/competitions/jigsaw-toxic-comment-classification-challenge/data)
|
23 |
|
24 |
-
Our training dataset is a version from the original dataset, <b>containing equal number of samples
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
### Caution:
|
30 |
This dataset contains comments that are toxic in nature. Kindly use appropriately.
|
|
|
21 |
|
22 |
The original dataset can be found here: [jigsaw_toxic_classification](https://www.kaggle.com/competitions/jigsaw-toxic-comment-classification-challenge/data)
|
23 |
|
24 |
+
Our training dataset is a sampled version from the original dataset, <b>containing equal number of samples for both clean and toxic classes. </b><br>
|
25 |
+
|
26 |
+
#### Dataset creation:
|
27 |
+
<code><pre>data = pd.read_csv('train.csv') # train.csv from the original dataset
|
28 |
+
column_names = ['toxic', 'severe_toxic', 'obscene', 'threat', 'insult', 'identity_hate']
|
29 |
+
column_labels = data[column_names][2:-1]
|
30 |
+
train_toxic = data[data[column_names].sum(axis=1) > 0]
|
31 |
+
train_clean = data[data[column_names].sum(axis=1) == 0]
|
32 |
+
train_clean_sampled = train_clean.sample(n=16225, random_state=42)
|
33 |
+
|
34 |
+
dataframe = pd.concat([train_toxic, train_clean_sampled], axis=0)
|
35 |
+
|
36 |
+
dataframe = dataframe.sample(frac=1, random_state=42)
|
37 |
+
dataset = Dataset.from_pandas(dataframe)
|
38 |
+
|
39 |
+
train_dataset = dataset.train_test_split(test_size=0.2)['train']
|
40 |
+
val_dataset = dataset.train_test_split(test_size=0.2)['test']</pre></code>
|
41 |
|
42 |
### Caution:
|
43 |
This dataset contains comments that are toxic in nature. Kindly use appropriately.
|