Skip to content

Commit

Permalink
Renaming to py_learning_benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriyMulyar committed Dec 31, 2018
1 parent 4fcc145 commit b65c927
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 13 deletions.
Binary file removed datasets/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
Binary file not shown.
23 changes: 12 additions & 11 deletions datasets/classification/classification_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ def _load_keel(self):
for dataset_directory in pkg_resources.resource_listdir('datasets', 'classification/data/keel'+'/'+directory):
metadata_file = pkg_resources.resource_filename('datasets', 'classification/data/keel'+'/'+directory+'/'+dataset_directory+'/'+dataset_directory+'-names.txt')
dataset_metadata = {'name':dataset_directory, 'directory': 'classification/data/keel'+'/'+directory+'/'+dataset_directory}
file = open(metadata_file, 'r')
text = file.read()
matches = re.finditer(r"\d:\s([\w ]*)[.:\s]*([A-Za-z0-9.,]+(?:\s+[A-Za-z0-9.,]+)*\s*$)", text, re.MULTILINE)
for match in matches:
dataset_metadata[match.group(1).strip()] = self._parse_float(match.group(2).strip().replace(',', '.'))
if "Description" in dataset_metadata:
dataset_metadata.pop('Description')
if "Header" in dataset_metadata:
dataset_metadata.pop('Header')
dataset_metadata["dataset_provider"] = 'keel'
self.datasets_metadata.append(dataset_metadata)
with open(metadata_file, 'r') as file:
text = file.read()
matches = re.finditer(r"\d:\s([\w ]*)[.:\s]*([A-Za-z0-9.,]+(?:\s+[A-Za-z0-9.,]+)*\s*$)", text, re.MULTILINE)
for match in matches:
dataset_metadata[match.group(1).strip()] = self._parse_float(match.group(2).strip().replace(',', '.'))
# if "Description" in dataset_metadata:
# dataset_metadata.pop('Description')
if "Header" in dataset_metadata:
dataset_metadata.pop('Header')
dataset_metadata["dataset_provider"] = 'keel'
self.datasets_metadata.append(dataset_metadata)

def _parse_float(self, value):
try:
Expand All @@ -51,6 +51,7 @@ def filter_single(self, filter_this_dict, key, operation, value):
'>=': operator.ge,
'<=': operator.le,
'=': operator.eq,
'not contains': lambda a,b : not operator.contains(a,b),
'contains': operator.contains}
return [x for x in filter_this_dict if ops[operation](x[key], value)]

Expand Down
Binary file removed ml_datasets/__pycache__/__init__.cpython-35.pyc
Binary file not shown.
Binary file removed ml_datasets/__pycache__/data_loader.cpython-35.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from unittest import TestCase
from ml_datasets import DataLoader
from py_learning_benchmarks import DataLoader
from pprint import pprint
class TestDataLoader(TestCase):

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from setuptools import setup, find_packages
from ml_datasets import __version__, __authors__
from py_learning_benchmarks import __version__, __authors__

packages = find_packages()

Expand Down

0 comments on commit b65c927

Please sign in to comment.