feat: support for multi-label tasks
Browse files- agro-nt-tasks.py +24 -2
agro-nt-tasks.py
CHANGED
@@ -50,7 +50,12 @@ _TASK_NAMES = ['poly_a.arabidopsis_thaliana',
|
|
50 |
'lncrna.t_aestivum',
|
51 |
'lncrna.s_bicolor',
|
52 |
'promoter_strength.leaf',
|
53 |
-
'promoter_strength.protoplast'
|
|
|
|
|
|
|
|
|
|
|
54 |
]
|
55 |
|
56 |
|
@@ -58,7 +63,13 @@ _TASK_INFO = {'poly_a':{'type': 'binary', 'val_set':False},
|
|
58 |
'splicing':{'type': 'binary', 'val_set':False},
|
59 |
'lncrna':{'type': 'binary', 'val_set':False},
|
60 |
'promoter_strength': {'type': 'regression', 'val_set': True},
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
class AgroNtTasksConfig(datasets.BuilderConfig):
|
@@ -72,6 +83,7 @@ class AgroNtTasksConfig(datasets.BuilderConfig):
|
|
72 |
"""
|
73 |
|
74 |
self.task,self.sub_task = task_name.split(".")
|
|
|
75 |
self.task_type = _TASK_INFO[self.task]['type']
|
76 |
self.val_set = _TASK_INFO[self.task]['val_set']
|
77 |
|
@@ -110,6 +122,16 @@ class AgroNtTasks(datasets.GeneratorBasedBuilder):
|
|
110 |
}
|
111 |
)
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
return datasets.DatasetInfo(
|
114 |
# This is the description that will appear on the datasets page.
|
115 |
description=_DESCRIPTION,
|
|
|
50 |
'lncrna.t_aestivum',
|
51 |
'lncrna.s_bicolor',
|
52 |
'promoter_strength.leaf',
|
53 |
+
'promoter_strength.protoplast',
|
54 |
+
'gene_exp.glycine_max',
|
55 |
+
'gene_exp.oryza_sativa',
|
56 |
+
'gene_exp.solanum_lycopersicum',
|
57 |
+
'gene_exp.zea_mays',
|
58 |
+
'gene_exp.arabidopsis_thaliana'
|
59 |
]
|
60 |
|
61 |
|
|
|
63 |
'splicing':{'type': 'binary', 'val_set':False},
|
64 |
'lncrna':{'type': 'binary', 'val_set':False},
|
65 |
'promoter_strength': {'type': 'regression', 'val_set': True},
|
66 |
+
'gene_exp':{'type':'multi_regression','val_set':True,
|
67 |
+
'num_labels':
|
68 |
+
{'arabidopsis_thaliana': 56,
|
69 |
+
'glycine_max': 14,
|
70 |
+
'zea_mays': 23,
|
71 |
+
'solanum_lycopersicum': 10,
|
72 |
+
'oryza_sativa': 7}},
|
73 |
}
|
74 |
|
75 |
class AgroNtTasksConfig(datasets.BuilderConfig):
|
|
|
83 |
"""
|
84 |
|
85 |
self.task,self.sub_task = task_name.split(".")
|
86 |
+
|
87 |
self.task_type = _TASK_INFO[self.task]['type']
|
88 |
self.val_set = _TASK_INFO[self.task]['val_set']
|
89 |
|
|
|
122 |
}
|
123 |
)
|
124 |
|
125 |
+
elif self.config.task_type == 'multi_regression':
|
126 |
+
|
127 |
+
num_labels = _TASK_INFO[self.config.task]['num_labels'][self.config.sub_task]
|
128 |
+
|
129 |
+
features = datasets.Features({
|
130 |
+
"sequence": datasets.Value("string"),
|
131 |
+
"name": datasets.Value("string"),
|
132 |
+
"label": datasets.Array2D(shape=(1, num_labels),
|
133 |
+
dtype= "float32")})
|
134 |
+
|
135 |
return datasets.DatasetInfo(
|
136 |
# This is the description that will appear on the datasets page.
|
137 |
description=_DESCRIPTION,
|