Datasets:
Upload adult.py
Browse files
adult.py
CHANGED
@@ -197,13 +197,13 @@ class Adult(datasets.GeneratorBasedBuilder):
|
|
197 |
|
198 |
return data
|
199 |
|
200 |
-
def encode_race(race):
|
201 |
return self.race_encoding_dic()[race]
|
202 |
|
203 |
-
def decode_race(code):
|
204 |
return self.race_decoding_dic()[code]
|
205 |
|
206 |
-
def race_decoding_dic():
|
207 |
return {
|
208 |
0: "White",
|
209 |
1: "Black",
|
@@ -212,7 +212,7 @@ class Adult(datasets.GeneratorBasedBuilder):
|
|
212 |
4: "Other",
|
213 |
}
|
214 |
|
215 |
-
def race_encoding_dic():
|
216 |
return {
|
217 |
"White": 0,
|
218 |
"Black": 1,
|
@@ -221,19 +221,19 @@ class Adult(datasets.GeneratorBasedBuilder):
|
|
221 |
"Other": 4,
|
222 |
}
|
223 |
|
224 |
-
def encode_sex(sex):
|
225 |
return self.sex_encoding_dic()[sex]
|
226 |
|
227 |
-
def decode_sex(code):
|
228 |
return self.sex_decoding_dic()[code]
|
229 |
|
230 |
-
def sex_encoding_dic():
|
231 |
return {
|
232 |
"Male": 0,
|
233 |
"Female": 1
|
234 |
}
|
235 |
|
236 |
-
def sex_decoding_dic():
|
237 |
return {
|
238 |
0: "Male",
|
239 |
1: "Female"
|
|
|
197 |
|
198 |
return data
|
199 |
|
200 |
+
def encode_race(self, race):
|
201 |
return self.race_encoding_dic()[race]
|
202 |
|
203 |
+
def decode_race(self, code):
|
204 |
return self.race_decoding_dic()[code]
|
205 |
|
206 |
+
def race_decoding_dic(self):
|
207 |
return {
|
208 |
0: "White",
|
209 |
1: "Black",
|
|
|
212 |
4: "Other",
|
213 |
}
|
214 |
|
215 |
+
def race_encoding_dic(self):
|
216 |
return {
|
217 |
"White": 0,
|
218 |
"Black": 1,
|
|
|
221 |
"Other": 4,
|
222 |
}
|
223 |
|
224 |
+
def encode_sex(self, sex):
|
225 |
return self.sex_encoding_dic()[sex]
|
226 |
|
227 |
+
def decode_sex(self, code):
|
228 |
return self.sex_decoding_dic()[code]
|
229 |
|
230 |
+
def sex_encoding_dic(self):
|
231 |
return {
|
232 |
"Male": 0,
|
233 |
"Female": 1
|
234 |
}
|
235 |
|
236 |
+
def sex_decoding_dic(self):
|
237 |
return {
|
238 |
0: "Male",
|
239 |
1: "Female"
|