Skip to content

Commit d25da1b

Browse files
tomMoraljnothman
authored andcommitted
FIX make joblib utils private, and remove mentions of externals.joblib (scikit-learn#12345)
1 parent 4ab6055 commit d25da1b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+278
-170
lines changed

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ scikit-learn requires:
5858
Scikit-learn 0.21 and later will require Python 3.5 or newer.
5959

6060
For running the examples Matplotlib >= 1.4 is required. A few examples
61-
require scikit-image >= 0.11.3 and a few examples require pandas >= 0.17.1.
61+
require scikit-image >= 0.11.3, a few examples require pandas >= 0.17.1
62+
and a few example require joblib >= 0.11.
6263

6364
scikit-learn also uses CBLAS, the C interface to the Basic Linear Algebra
6465
Subprograms library. scikit-learn comes with a reference implementation, but

benchmarks/bench_covertype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from time import time
5151
import argparse
5252
import numpy as np
53+
from joblib import Memory
5354

5455
from sklearn.datasets import fetch_covtype, get_data_home
5556
from sklearn.svm import LinearSVC
@@ -59,7 +60,6 @@
5960
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier
6061
from sklearn.ensemble import GradientBoostingClassifier
6162
from sklearn.metrics import zero_one_loss
62-
from sklearn.utils import Memory
6363
from sklearn.utils import check_array
6464

6565
# Memoize the data extraction and memory map the resulting

benchmarks/bench_mnist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
from time import time
3636
import argparse
3737
import numpy as np
38+
from joblib import Memory
3839

3940
from sklearn.datasets import fetch_mldata
4041
from sklearn.datasets import get_data_home
4142
from sklearn.ensemble import ExtraTreesClassifier
4243
from sklearn.ensemble import RandomForestClassifier
4344
from sklearn.dummy import DummyClassifier
44-
from sklearn.utils import Memory
4545
from sklearn.kernel_approximation import Nystroem
4646
from sklearn.kernel_approximation import RBFSampler
4747
from sklearn.metrics import zero_one_loss

benchmarks/bench_plot_nmf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import numpy as np
1616
import matplotlib.pyplot as plt
17+
from joblib import Memory
1718
import pandas
1819

1920
from sklearn.utils.testing import ignore_warnings
@@ -22,7 +23,6 @@
2223
from sklearn.decomposition.nmf import _initialize_nmf
2324
from sklearn.decomposition.nmf import _beta_divergence
2425
from sklearn.decomposition.nmf import INTEGER_TYPES, _check_init
25-
from sklearn.utils import Memory
2626
from sklearn.exceptions import ConvergenceWarning
2727
from sklearn.utils.extmath import safe_sparse_dot, squared_norm
2828
from sklearn.utils import check_array

benchmarks/bench_rcv1_logreg_convergence.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# License: BSD 3 clause
55

66
import matplotlib.pyplot as plt
7+
from joblib import Memory
78
import numpy as np
89
import gc
910
import time
1011

11-
from sklearn.utils import Memory
1212
from sklearn.linear_model import (LogisticRegression, SGDClassifier)
1313
from sklearn.datasets import fetch_rcv1
1414
from sklearn.linear_model.sag import get_auto_step_size

benchmarks/bench_saga.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import time
88
from os.path import expanduser
99

10+
from joblib import delayed, Parallel, Memory
1011
import matplotlib.pyplot as plt
1112
import numpy as np
1213

1314
from sklearn.datasets import fetch_rcv1, load_iris, load_digits, \
1415
fetch_20newsgroups_vectorized
15-
from sklearn.utils import delayed, Parallel, Memory
1616
from sklearn.linear_model import LogisticRegression
1717
from sklearn.metrics import log_loss
1818
from sklearn.model_selection import train_test_split

benchmarks/bench_tsne_mnist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import numpy as np
1515
import json
1616
import argparse
17+
from joblib import Memory
1718

18-
from sklearn.utils import Memory
1919
from sklearn.datasets import fetch_mldata
2020
from sklearn.manifold import TSNE
2121
from sklearn.neighbors import NearestNeighbors

build_tools/circle/build_doc.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ conda update --yes --quiet conda
120120
conda create -n $CONDA_ENV_NAME --yes --quiet python="${PYTHON_VERSION:-*}" \
121121
numpy="${NUMPY_VERSION:-*}" scipy="${SCIPY_VERSION:-*}" cython \
122122
pytest coverage matplotlib="${MATPLOTLIB_VERSION:-*}" sphinx=1.6.2 pillow \
123-
scikit-image="${SCIKIT_IMAGE_VERSION:-*}" pandas="${PANDAS_VERSION:-*}"
123+
scikit-image="${SCIKIT_IMAGE_VERSION:-*}" pandas="${PANDAS_VERSION:-*}" \
124+
joblib
124125

125126
source activate testenv
126127
pip install sphinx-gallery

doc/modules/classes.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,31 +1480,32 @@ Low-level methods
14801480

14811481
Utilities from joblib:
14821482

1483-
.. autosummary::
1484-
:toctree: generated/
1485-
:template: class.rst
1486-
1487-
utils.Memory
1488-
utils.Parallel
1489-
14901483
.. autosummary::
14911484
:toctree: generated/
14921485
:template: function.rst
14931486

1494-
utils.cpu_count
1495-
utils.delayed
14961487
utils.parallel_backend
1488+
utils.register_parallel_backend
14971489

14981490
Recently deprecated
14991491
===================
15001492

15011493
To be removed in 0.23
15021494
---------------------
15031495

1496+
.. autosummary::
1497+
:toctree: generated/
1498+
:template: deprecated_class.rst
1499+
1500+
utils.Memory
1501+
utils.Parallel
1502+
15041503
.. autosummary::
15051504
:toctree: generated/
15061505
:template: deprecated_function.rst
15071506

1507+
utils.cpu_count
1508+
utils.delayed
15081509
metrics.calinski_harabaz_score
15091510

15101511

doc/modules/model_persistence.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,25 @@ persistence model, namely `pickle <https://docs.python.org/2/library/pickle.html
3535
>>> y[0]
3636
0
3737

38-
In the specific case of scikit-learn, it may be better to use
39-
joblib's replacement of pickle (``joblib.dump`` & ``joblib.load``),
40-
which is more efficient on objects that carry large numpy arrays internally as
41-
is often the case for fitted scikit-learn estimators, but can only pickle to the
42-
disk and not to a string::
38+
In the specific case of scikit-learn, it may be better to use joblib's
39+
replacement of pickle (``dump`` & ``load``), which is more efficient on
40+
objects that carry large numpy arrays internally as is often the case for
41+
fitted scikit-learn estimators, but can only pickle to the disk and not to a
42+
string::
4343

44-
>>> from sklearn.externals import joblib
45-
>>> joblib.dump(clf, 'filename.joblib') # doctest: +SKIP
44+
>>> from joblib import dump, load
45+
>>> dump(clf, 'filename.joblib') # doctest: +SKIP
4646

4747
Later you can load back the pickled model (possibly in another Python process)
4848
with::
4949

50-
>>> clf = joblib.load('filename.joblib') # doctest:+SKIP
50+
>>> clf = load('filename.joblib') # doctest:+SKIP
5151

5252
.. note::
5353

54-
``joblib.dump`` and ``joblib.load`` functions also accept file-like object
54+
``dump`` and ``load`` functions also accept file-like object
5555
instead of filenames. More information on data persistence with Joblib is
56-
available `here <https://pythonhosted.org/joblib/persistence.html>`_.
56+
available `here <https://joblib.readthedocs.io/en/latest/persistence.html>`_.
5757

5858
.. _persistence_limitations:
5959

0 commit comments

Comments
 (0)