mstz commited on
Commit
901d3ce
·
1 Parent(s): 3a7b078

Upload german.py

Browse files
Files changed (1) hide show
  1. german.py +15 -1
german.py CHANGED
@@ -237,7 +237,21 @@ class German(datasets.GeneratorBasedBuilder):
237
  data = data[_BASE_FEATURE_NAMES]
238
 
239
  return data
240
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  def encode_loan_purpose(self, code):
242
  return {
243
  "A40": "new car",
 
237
  data = data[_BASE_FEATURE_NAMES]
238
 
239
  return data
240
+
241
+ def encode(self, feature, value):
242
+ if feature in _ENCODING_DICS:
243
+ return _ENCODING_DICS[feature][value]
244
+ raise ValueError(f"Unknown feature: {feature}")
245
+
246
+ def encoding_dics(self):
247
+ data = [pandas.DataFrame([(feature, original, encoded) for original, encoded in d.items()])
248
+ for feature, d in _ENCODING_DICS.items()]
249
+ data = pandas.concat(data, axis="rows").reset_index()
250
+ data.drop("index", axis="columns", inplace=True)
251
+ data.columns = ["feature", "original_value", "encoded_value"]
252
+
253
+ return data
254
+
255
  def encode_loan_purpose(self, code):
256
  return {
257
  "A40": "new car",