mathemakitten commited on
Commit
b5c7b98
·
1 Parent(s): 3f96412
Files changed (1) hide show
  1. sentiment-evaluation-suite.py +43 -0
sentiment-evaluation-suite.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import evaluate
2
+ from evaluate.evaluation_suite import SubTask
3
+
4
+
5
+ class Suite(evaluate.EvaluationSuite):
6
+
7
+ def __init__(self, name):
8
+ super().__init__(name)
9
+
10
+ def setup(self):
11
+ self.preprocessor = lambda x: {"text": x["text"].lower()}
12
+ self.suite = [
13
+ SubTask(
14
+ task_type="text-classification",
15
+ data="imdb",
16
+ split="test[:10]",
17
+ data_preprocessor=self.preprocessor,
18
+ args_for_task={
19
+ "metric": "accuracy",
20
+ "input_column": "text",
21
+ "label_column": "label",
22
+ "label_mapping": {
23
+ "LABEL_0": 0.0,
24
+ "LABEL_1": 1.0
25
+ }
26
+ }
27
+ ),
28
+ SubTask(
29
+ task_type="text-classification",
30
+ data="sst2",
31
+ split="test[:10]",
32
+ data_preprocessor=lambda x: {"sentence": x["sentence"].lower()},
33
+ args_for_task={
34
+ "metric": "accuracy",
35
+ "input_column": "sentence",
36
+ "label_column": "label",
37
+ "label_mapping": {
38
+ "LABEL_0": 0.0,
39
+ "LABEL_1": 1.0
40
+ }
41
+ }
42
+ )
43
+ ]