From 5c1d350a9ed904aeeb6d24fe44e615f7cfe55c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20D=C3=ADaz=20Vico?= Date: Thu, 6 Feb 2020 23:15:14 +0100 Subject: [PATCH] Bug fixed --- .travis.yml | 2 +- setup.py | 4 ++-- skdatasets/utils/experiment.py | 19 +++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 15050a3..9679783 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ script: - python setup.py test - mkdir docs - export PYTHONPATH=`pwd` - - sphinx-quickstart -q -p scikit-datasets -a "David Diaz Vico" -v 0.1 -r 0.1.37 -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.38 -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 efa152c..fcb302a 100755 --- a/setup.py +++ b/setup.py @@ -9,13 +9,13 @@ setup(name='scikit-datasets', packages=find_packages(), - version='0.1.37', + version='0.1.38', description='Scikit-learn-compatible datasets', # long_description=open('README.md', 'r').read(), 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.37.tar.gz', + download_url='https://github.com/daviddiazvico/scikit-datasets/archive/v0.1.38.tar.gz', keywords=['scikit-learn'], classifiers=['Intended Audience :: Science/Research', 'Topic :: Scientific/Engineering', diff --git a/skdatasets/utils/experiment.py b/skdatasets/utils/experiment.py index 6a7710e..35cdfbf 100755 --- a/skdatasets/utils/experiment.py +++ b/skdatasets/utils/experiment.py @@ -78,9 +78,13 @@ def run(): if hasattr(data, 'data_test') and (data.data_test is not None): # Test partition e.fit(X, y=y) - with NamedTemporaryFile() as tmpfile: - joblib.dump(e, tmpfile.name) - experiment.add_artifact(tmpfile.name, name='estimator.joblib') + try: + with NamedTemporaryFile() as tmpfile: + joblib.dump(e, tmpfile.name) + experiment.add_artifact(tmpfile.name, + name='estimator.joblib') + except Exception as exception: + warn(f'Artifact save failed: {exception}') experiment.log_scalar('score_mean', e.score(data.data_test, y=data.target_test)) experiment.log_scalar('score_std', 0.0) @@ -124,9 +128,12 @@ def run(): cv=data.outer_cv, return_train_score=True, return_estimator=True) - with NamedTemporaryFile() as tmpfile: - joblib.dump(e, tmpfile.name) - experiment.add_artifact(tmpfile.name, name='scores.joblib') + try: + with NamedTemporaryFile() as tmpfile: + joblib.dump(e, tmpfile.name) + experiment.add_artifact(tmpfile.name, name='scores.joblib') + except Exception as exception: + warn(f'Artifact save failed: {exception}') experiment.log_scalar('score_mean', np.nanmean(scores['test_score'])) experiment.log_scalar('score_std', np.nanstd(scores['test_score']))