Skip to content

Commit b65c927

Browse files
committed
Renaming to py_learning_benchmarks
1 parent 4fcc145 commit b65c927

File tree

14 files changed

+14
-13
lines changed

14 files changed

+14
-13
lines changed
-250 Bytes
Binary file not shown.
Binary file not shown.

datasets/classification/classification_loader.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ def _load_keel(self):
2626
for dataset_directory in pkg_resources.resource_listdir('datasets', 'classification/data/keel'+'/'+directory):
2727
metadata_file = pkg_resources.resource_filename('datasets', 'classification/data/keel'+'/'+directory+'/'+dataset_directory+'/'+dataset_directory+'-names.txt')
2828
dataset_metadata = {'name':dataset_directory, 'directory': 'classification/data/keel'+'/'+directory+'/'+dataset_directory}
29-
file = open(metadata_file, 'r')
30-
text = file.read()
31-
matches = re.finditer(r"\d:\s([\w ]*)[.:\s]*([A-Za-z0-9.,]+(?:\s+[A-Za-z0-9.,]+)*\s*$)", text, re.MULTILINE)
32-
for match in matches:
33-
dataset_metadata[match.group(1).strip()] = self._parse_float(match.group(2).strip().replace(',', '.'))
34-
if "Description" in dataset_metadata:
35-
dataset_metadata.pop('Description')
36-
if "Header" in dataset_metadata:
37-
dataset_metadata.pop('Header')
38-
dataset_metadata["dataset_provider"] = 'keel'
39-
self.datasets_metadata.append(dataset_metadata)
29+
with open(metadata_file, 'r') as file:
30+
text = file.read()
31+
matches = re.finditer(r"\d:\s([\w ]*)[.:\s]*([A-Za-z0-9.,]+(?:\s+[A-Za-z0-9.,]+)*\s*$)", text, re.MULTILINE)
32+
for match in matches:
33+
dataset_metadata[match.group(1).strip()] = self._parse_float(match.group(2).strip().replace(',', '.'))
34+
# if "Description" in dataset_metadata:
35+
# dataset_metadata.pop('Description')
36+
if "Header" in dataset_metadata:
37+
dataset_metadata.pop('Header')
38+
dataset_metadata["dataset_provider"] = 'keel'
39+
self.datasets_metadata.append(dataset_metadata)
4040

4141
def _parse_float(self, value):
4242
try:
@@ -51,6 +51,7 @@ def filter_single(self, filter_this_dict, key, operation, value):
5151
'>=': operator.ge,
5252
'<=': operator.le,
5353
'=': operator.eq,
54+
'not contains': lambda a,b : not operator.contains(a,b),
5455
'contains': operator.contains}
5556
return [x for x in filter_this_dict if ops[operation](x[key], value)]
5657

-271 Bytes
Binary file not shown.
-1.58 KB
Binary file not shown.
-170 Bytes
Binary file not shown.
-3.68 KB
Binary file not shown.
-1.85 KB
Binary file not shown.

0 commit comments

Comments
 (0)