Datasets:
Upload compas.py
Browse files
compas.py
CHANGED
@@ -333,6 +333,11 @@ class Compas(datasets.GeneratorBasedBuilder):
|
|
333 |
data.loc[:, feature] = data[feature].apply(encoding_function)
|
334 |
|
335 |
return data[list(features_types_per_config[config].keys())]
|
|
|
|
|
|
|
|
|
|
|
336 |
|
337 |
def encoding_dics(self):
|
338 |
data = [pandas.DataFrame([(feature, original, encoded) for original, encoded in d.items()])
|
|
|
333 |
data.loc[:, feature] = data[feature].apply(encoding_function)
|
334 |
|
335 |
return data[list(features_types_per_config[config].keys())]
|
336 |
+
|
337 |
+
def encode(self, feature, value):
|
338 |
+
if feature in _ENCODING_DICS:
|
339 |
+
return _ENCODING_DICS[feature][value]
|
340 |
+
raise ValueError(f"Unknown feature: {feature}")
|
341 |
|
342 |
def encoding_dics(self):
|
343 |
data = [pandas.DataFrame([(feature, original, encoded) for original, encoded in d.items()])
|