Arsive commited on
Commit
dd6e43f
1 Parent(s): 7c73063

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -4
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 from each classes. </b><br>
25
- Number of samples in train_dataset: 25960<br>
26
- Number of samples in val_dataset: 6490<br>
27
- Number of samples in test_dataset: 153164<br>
 
 
 
 
 
 
 
 
 
 
 
 
 
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.