Skip to content

Commit

Permalink
Global load function added
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddiazvico committed Sep 19, 2018
1 parent dc64b09 commit b5eaec0
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ install:
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- nosetests -x -v -d --with-coverage --cover-erase --cover-package=skdatasets --cover-xml tests/test_gunnar_raetsch.py tests/test_keel.py tests/test_libsvm.py tests/test_sklearn.py tests/test_uci.py
- nosetests -x -v -d --with-coverage --cover-erase --cover-package=skdatasets --cover-xml tests/test_gunnar_raetsch.py tests/test_keel.py tests/test_libsvm.py tests/test_load.py tests/test_sklearn.py tests/test_uci.py
- mkdir docs
- export PYTHONPATH=`pwd`
- sphinx-quickstart -q -p scikit-datasets -a "David Diaz Vico" -v 0.1 -r 0.1.13 -l en --ext-autodoc --ext-viewcode --ext-githubpages --extensions sphinxcontrib.napoleon --no-makefile --no-batchfile docs
- sphinx-quickstart -q -p scikit-datasets -a "David Diaz Vico" -v 0.1 -r 0.1.14 -l en --ext-autodoc --ext-viewcode --ext-githubpages --extensions sphinxcontrib.napoleon --no-makefile --no-batchfile docs
- sphinx-apidoc -o docs/_static/ skdatasets -F -a -l
- travis-sphinx -v build -s docs -n
after_success:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

setup(name='scikit-datasets',
packages=find_packages(),
version='0.1.13',
version='0.1.14',
description='Scikit-learn-compatible datasets',
author='David Diaz Vico',
author_email='david.diaz.vico@outlook.com',
url='https://github.com/daviddiazvico/scikit-datasets',
download_url='https://github.com/daviddiazvico/scikit-datasets/archive/v0.1.13.tar.gz',
download_url='https://github.com/daviddiazvico/scikit-datasets/archive/v0.1.14.tar.gz',
keywords=['scikit-learn', 'pandas'],
classifiers=['Intended Audience :: Science/Research',
'Intended Audience :: Developers',
Expand Down
13 changes: 13 additions & 0 deletions skdatasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,16 @@
setattr(repository,
'load_' + dataset.replace('-', '_').replace('.', '_'),
partial(repository.load, dataset))


loader = {'gunnar_raetsch': gunnar_raetsch.load, 'keel': keel.load,
'libsvm': libsvm.load, 'sklearn': sklearn.load, 'uci': uci.load}
try:
loader.update({'keras': keras.load})
except:
pass


def load(repository, dataset, **kwargs):
""" Select a dataset. """
return loader[repository](dataset, **kwargs)
19 changes: 19 additions & 0 deletions tests/test_load.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
Tests.
@author: David Diaz Vico
@license: MIT
"""

from functools import partial

from .base import load, use

from skdatasets import load as load_global


def test_load():
"""Tests global load function."""
load_abalone9_18 = partial(load_global, 'keel', 'abalone9-18')
load(load_abalone9_18)
use(load_abalone9_18)

0 comments on commit b5eaec0

Please sign in to comment.