Datasets:
Update german.py
Browse files
german.py
CHANGED
@@ -153,7 +153,7 @@ features_types_per_config = {
|
|
153 |
"current_savings": datasets.Value("int8"),
|
154 |
"employed_since": datasets.Value("int8"),
|
155 |
"installment_rate_percentage": datasets.Value("int8"),
|
156 |
-
"
|
157 |
"marital_status": datasets.Value("string"),
|
158 |
"guarantors": datasets.Value("int8"),
|
159 |
"years_living_in_current_residence": datasets.Value("int8"),
|
@@ -164,7 +164,7 @@ features_types_per_config = {
|
|
164 |
"job_status": datasets.Value("int8"),
|
165 |
"number_of_people_in_support": datasets.Value("int8"),
|
166 |
"has_registered_phone_number": datasets.Value("int8"),
|
167 |
-
"is_foreign": datasets.Value("
|
168 |
"loan_granted": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
169 |
}
|
170 |
|
@@ -190,9 +190,6 @@ class German(datasets.GeneratorBasedBuilder):
|
|
190 |
|
191 |
|
192 |
def _info(self):
|
193 |
-
if self.config.name not in features_per_config:
|
194 |
-
raise ValueError(f"Unknown configuration: {self.config.name}")
|
195 |
-
|
196 |
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
197 |
features=features_per_config[self.config.name])
|
198 |
|
@@ -206,10 +203,7 @@ class German(datasets.GeneratorBasedBuilder):
|
|
206 |
]
|
207 |
|
208 |
def _generate_examples(self, filepath: str):
|
209 |
-
if self.config.name
|
210 |
-
raise ValueError(f"Unknown config: {self.config.name}")
|
211 |
-
|
212 |
-
elif self.config.name == "encoding":
|
213 |
data = self.encoding_dics()
|
214 |
|
215 |
else:
|
@@ -238,6 +232,9 @@ class German(datasets.GeneratorBasedBuilder):
|
|
238 |
data.drop("personal_status_and_sex", axis="columns", inplace=True)
|
239 |
|
240 |
data = data[_BASE_FEATURE_NAMES]
|
|
|
|
|
|
|
241 |
|
242 |
return data
|
243 |
|
|
|
153 |
"current_savings": datasets.Value("int8"),
|
154 |
"employed_since": datasets.Value("int8"),
|
155 |
"installment_rate_percentage": datasets.Value("int8"),
|
156 |
+
"is_male": datasets.Value("bool"),
|
157 |
"marital_status": datasets.Value("string"),
|
158 |
"guarantors": datasets.Value("int8"),
|
159 |
"years_living_in_current_residence": datasets.Value("int8"),
|
|
|
164 |
"job_status": datasets.Value("int8"),
|
165 |
"number_of_people_in_support": datasets.Value("int8"),
|
166 |
"has_registered_phone_number": datasets.Value("int8"),
|
167 |
+
"is_foreign": datasets.Value("bool"),
|
168 |
"loan_granted": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
|
169 |
}
|
170 |
|
|
|
190 |
|
191 |
|
192 |
def _info(self):
|
|
|
|
|
|
|
193 |
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
194 |
features=features_per_config[self.config.name])
|
195 |
|
|
|
203 |
]
|
204 |
|
205 |
def _generate_examples(self, filepath: str):
|
206 |
+
if self.config.name == "encoding":
|
|
|
|
|
|
|
207 |
data = self.encoding_dics()
|
208 |
|
209 |
else:
|
|
|
232 |
data.drop("personal_status_and_sex", axis="columns", inplace=True)
|
233 |
|
234 |
data = data[_BASE_FEATURE_NAMES]
|
235 |
+
data = data.rename(columns={"sex": "is_male"})
|
236 |
+
data = data.astype({"is_foreign": "bool"})
|
237 |
+
data.loc[:, "is_foreign"] = data.is_foreign.apply(bool)
|
238 |
|
239 |
return data
|
240 |
|