Skip to content

Commit

Permalink
ENH Suppress FutureWarning from sklearn.externals.joblib; Bump versio…
Browse files Browse the repository at this point in the history
…n to 1.13.1 (#375)

* ENH suppress FutureWarning from sklearn.externals.joblib

* ENH handle run_joblib_func.py as well

* MAINT bump version to 1.13.1

* COMPAT python 2.7 can't stand non-ASCII characters
  • Loading branch information
jacksonlee-civis committed Mar 6, 2020
1 parent ab19a8a commit 9a777a5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
### Changed

## 1.13.1 - 2020-03-06
### Added
- Suppressed FutureWarning from sklearn.externals.joblib. (#375)

## 1.13.0 - 2020-03-05
### Added
- Add `civis jobs follow-log` and `civis jobs follow-run-log` CLI commands. (#359)
Expand Down
2 changes: 1 addition & 1 deletion civis/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.13.0"
__version__ = "1.13.1"
7 changes: 7 additions & 0 deletions civis/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@
# models, you may need to re-serialize those models with
# scikit-learn 0.21+."
warnings.simplefilter('ignore', DeprecationWarning)
# sklearn 0.22 has switched from DeprecationWarning to FutureWarning
warnings.simplefilter('ignore', FutureWarning)
from sklearn.externals.joblib import (
register_parallel_backend as _sklearn_reg_para_backend)

# NO_SKLEARN_BACKEND would be a better name here since it'll be true
# for future scikit-learn versions that won't include the joblib
# module as well as when scikit-learn isn't installed, but changing
# the name would technically be a breaking change.
NO_SKLEARN = False
except ImportError:
NO_SKLEARN = True
Expand Down
22 changes: 19 additions & 3 deletions civis/run_joblib_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import os
import pickle
import sys
import warnings

import civis
import cloudpickle
Expand All @@ -22,9 +23,24 @@
from joblib import parallel_backend as _joblib_para_backend

try:
from sklearn.externals.joblib import (
parallel_backend as _sklearn_para_backend)
NO_SKLEARN = False
with warnings.catch_warnings():
# Ignore the warning: "DeprecationWarning: sklearn.externals.joblib is
# deprecated in 0.21 and will be removed in 0.23. Please import this
# functionality directly from joblib, which can be installed with:
# pip install joblib. If this warning is raised when loading pickled
# models, you may need to re-serialize those models with
# scikit-learn 0.21+."
warnings.simplefilter('ignore', DeprecationWarning)
# sklearn 0.22 has switched from DeprecationWarning to FutureWarning
warnings.simplefilter('ignore', FutureWarning)
from sklearn.externals.joblib import (
parallel_backend as _sklearn_para_backend)

# NO_SKLEARN_BACKEND would be a better name here since it'll be true
# for future scikit-learn versions that won't include the joblib
# module as well as when scikit-learn isn't installed, but changing
# the name would technically be a breaking change.
NO_SKLEARN = False
except ImportError:
NO_SKLEARN = True

Expand Down

0 comments on commit 9a777a5

Please sign in to comment.