pietrolesci commited on
Commit
8371e5c
1 Parent(s): ef4ea9a

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Overview
2
+
3
+ Original dataset available [here](https://github.com/sheng-z/JOCI/tree/master/data).
4
+ This dataset is the "full" JOCI dataset, which is the file named `joci.csv.zip`.
5
+
6
+
7
+ # Dataset curation
8
+ The following processing is applied,
9
+
10
+ - `label` column renamed to `original_label`
11
+ - creation of the `label` column using the following mapping, using common practices ([1](https://github.com/rabeehk/robust-nli/blob/c32ff958d4df68ac2fad9bf990f70d30eab9f297/data/scripts/joci.py#L22-L27), [2](https://github.com/azpoliak/hypothesis-only-NLI/blob/b045230437b5ba74b9928ca2bac5e21ae57876b9/data/convert_joci.py#L7-L12))
12
+
13
+ ```
14
+ {
15
+ 0: "contradiction",
16
+ 1: "contradiction",
17
+ 2: "neutral",
18
+ 3: "neutral",
19
+ 4: "neutral",
20
+ 5: "entailment",
21
+ }
22
+ ```
23
+
24
+ - finally, converting this to the usual NLI classes, that is `{"entailment": 0, "neutral": 1, "contradiction": 2}`
25
+
26
+
27
+ ## Code to create dataset
28
+ ```python
29
+ import pandas as pd
30
+ from datasets import Features, Value, ClassLabel, Dataset
31
+
32
+
33
+ # read data
34
+ df = pd.read_csv("<path to folder>/joci.csv")
35
+
36
+ # column name to lower
37
+ df.columns = df.columns.str.lower()
38
+
39
+ # rename label column
40
+ df = df.rename(columns={"label": "original_label"})
41
+
42
+ # encode labels
43
+ df["label"] = df["original_label"].map({
44
+ 0: "contradiction",
45
+ 1: "contradiction",
46
+ 2: "neutral",
47
+ 3: "neutral",
48
+ 4: "neutral",
49
+ 5: "entailment",
50
+ })
51
+
52
+ # encode labels
53
+ df["label"] = df["label"].map({"entailment": 0, "neutral": 1, "contradiction": 2})
54
+
55
+ # cast to dataset
56
+ features = Features({
57
+ "context": Value(dtype="string"),
58
+ "hypothesis": Value(dtype="string"),
59
+ "label": ClassLabel(num_classes=3, names=["entailment", "neutral", "contradiction"]),
60
+ "original_label": Value(dtype="int32"),
61
+ "context_from": Value(dtype="string"),
62
+ "hypothesis_from": Value(dtype="string"),
63
+ "subset": Value(dtype="string"),
64
+ })
65
+ ds = Dataset.from_pandas(df, features=features)
66
+ ds.push_to_hub("joci", token="<token>")
67
+ ```