pietrolesci commited on
Commit
2331b52
·
1 Parent(s): af4917a

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -0
README.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Overview
2
+ Original dataset available [here](https://gluebenchmark.com/diagnostics).
3
+
4
+
5
+ ## Dataset curation
6
+ Only filled in the empty rows of columns "lexical semantics", "predicate-argument structure",
7
+ "logic", "knowledge" with empty string `""`.
8
+
9
+ ## Code to create dataset
10
+
11
+ ```python
12
+ import pandas as pd
13
+ from datasets import Features, Value, ClassLabel, Dataset
14
+
15
+
16
+ df = pd.read_csv("<path to file>/diagnostic-full.tsv", sep="\t")
17
+
18
+ # column names to lower
19
+ df.columns = df.columns.str.lower()
20
+
21
+ # fill na
22
+ assert df["label"].isna().sum() == 0
23
+ df = df.fillna("")
24
+
25
+ # encode labels
26
+ df["label"] = df["label"].map({"entailment": 0, "neutral": 1, "contradiction": 2})
27
+
28
+ # cast to dataset
29
+ features = Features({
30
+ "lexical semantics": Value(dtype="string", id=None),
31
+ "predicate-argument structure": Value(dtype="string", id=None),
32
+ "logic": Value(dtype="string", id=None),
33
+ "knowledge": Value(dtype="string", id=None),
34
+ "domain": Value(dtype="string", id=None),
35
+ "premise": Value(dtype="string", id=None),
36
+ "hypothesis": Value(dtype="string", id=None),
37
+ "label": ClassLabel(num_classes=3, names=["entailment", "neutral", "contradiction"]),
38
+ })
39
+
40
+ dataset = Dataset.from_pandas(df, features=features)
41
+ dataset.push_to_hub("glue_diagnostics", token="<token>", split="test")
42
+ ```
43
+
44
+
45
+