pietrolesci commited on
Commit
108c7cf
·
1 Parent(s): dc0d21d

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Overview
2
+ Original dataset is available on the HuggingFace Hub [here](https://huggingface.co/datasets/scitail).
3
+
4
+
5
+ ## Dataset curation
6
+ This is the same as the `snli_format` split of the SciTail dataset available on the HuggingFace Hub (i.e., same data, same splits, etc).
7
+ The only differences are the following:
8
+
9
+ - selecting only the columns `["sentence1", "sentence2", "gold_label"]`
10
+ - renaming columns with the following mapping `{"sentence1": "premise", "sentence2": "hypothesis", "gold_label": "label"}`
11
+ - encoding labels with the following mapping `{"entailment": 0, "neutral": 1, "contradiction": 2}`
12
+
13
+
14
+ ## Code to create the dataset
15
+ ```python
16
+ from datasets import Features, Value, ClassLabel, Dataset, DatasetDict, load_dataset
17
+
18
+ # load datasets from the Hub
19
+ dd = load_dataset("scitail", "snli_format")
20
+
21
+ ds = {}
22
+ for name, df_ in dd.items():
23
+ df = df_.to_pandas()
24
+
25
+ # select important columns
26
+ df = df[["sentence1", "sentence2", "gold_label"]]
27
+
28
+ # rename columns
29
+ df = df.rename(columns={"sentence1": "premise", "sentence2": "hypothesis", "gold_label": "label"})
30
+
31
+ # encode labels
32
+ df["label"] = df["label"].map({"entailment": 0, "neutral": 1, "contradiction": 2})
33
+
34
+ # cast to dataset
35
+ features = Features({
36
+ "premise": Value(dtype="string", id=None),
37
+ "hypothesis": Value(dtype="string", id=None),
38
+ "label": ClassLabel(num_classes=3, names=["entailment", "neutral", "contradiction"]),
39
+ })
40
+ ds[name] = Dataset.from_pandas(df, features=features)
41
+
42
+ dataset = DatasetDict(ds)
43
+ dataset.push_to_hub("scitail", token="<token>")
44
+ ```