diff --git a/.travis.yml b/.travis.yml index f224e07..40732a3 100755 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/setup.py b/setup.py index 15bf1d4..5f138c8 100755 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/skdatasets/__init__.py b/skdatasets/__init__.py index efc88ae..c1d9dd1 100755 --- a/skdatasets/__init__.py +++ b/skdatasets/__init__.py @@ -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) diff --git a/tests/test_load.py b/tests/test_load.py new file mode 100644 index 0000000..bd74e85 --- /dev/null +++ b/tests/test_load.py @@ -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)