8000 Merge branch 'master' into install_instructions · scikit-learn/scikit-learn@1749fe6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1749fe6

Browse files
committed
Merge branch 'master' into install_instructions
2 parents 974a510 + af8a6e5 commit 1749fe6

File tree

120 files changed

+4514
-1540
lines changed

Some content is hidden

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

120 files changed

+4514
-1540
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ matrix:
2222
# installed from their CI wheels in a virtualenv with the Python
2323
# interpreter provided by travis.
2424
- python: 3.7
25-
env: DISTRIB="scipy-dev" CHECK_WARNINGS="true"
25+
env: CHECK_WARNINGS="true"
2626
if: type = cron OR commit_message =~ /\[scipy-dev\]/
2727

2828
install: source build_tools/travis/install.sh

azure-pipelines.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,24 @@ jobs:
3131
# Linux environment to test the latest available dependencies and MKL.
3232
# It runs tests requiring pandas and PyAMG.
3333
pylatest_pip_openblas_pandas:
34-
DISTRIB: 'conda-latest'
34+
DISTRIB: 'conda-pip-latest'
3535
PYTHON_VERSION: '*'
3636
PYTEST_VERSION: '4.6.2'
3737
COVERAGE: 'true'
3838
CHECK_PYTEST_SOFT_DEPENDENCY: 'true'
3939
TEST_DOCSTRINGS: 'true'
4040
CHECK_WARNINGS: 'true'
41+
pylatest_conda_mkl:
42+
DISTRIB: 'conda'
43+
PYTHON_VERSION: '*'
44+
INSTALL_MKL: 'true'
45+
NUMPY_VERSION: '*'
46+
SCIPY_VERSION: '*'
47+
CYTHON_VERSION: '*'
48+
PILLOW_VERSION: '*'
49+
PYTEST_VERSION: '*'
50+
JOBLIB_VERSION: '*'
51+
COVERAGE: 'true'
4152

4253
- template: build_tools/azure/posix-32.yml
4354
parameters:

build_tools/azure/install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ elif [[ "$DISTRIB" == "ubuntu-32" ]]; then
8686
python3 -m virtualenv --system-site-packages --python=python3 $VIRTUALENV
8787
source $VIRTUALENV/bin/activate
8888
python -m pip install pytest==$PYTEST_VERSION pytest-cov cython joblib==$JOBLIB_VERSION
89-
elif [[ "$DISTRIB" == "conda-latest" ]]; then
90-
# since conda main channel usually lacks behind on the latest releases,
89+
elif [[ "$DISTRIB" == "conda-pip-latest" ]]; then
90+
# Since conda main channel usually lacks behind on the latest releases,
9191
# we use pypi to test against the latest releases of the dependencies.
92+
# conda is still used as a convenient way to install Python and pip.
9293
make_conda "python=$PYTHON_VERSION"
9394
python -m pip install numpy scipy joblib cython
9495
python -m pip install pytest==$PYTEST_VERSION pytest-cov pytest-xdist

build_tools/travis/install.sh

Lines changed: 38 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -16,133 +16,53 @@ set -e
1616
# Fail fast
1717
build_tools/travis/travis_fastfail.sh
1818

19-
echo 'List files from cached directories'
20-
echo 'pip:'
19+
echo "List files from cached directories"
20+
echo "pip:"
2121
ls $HOME/.cache/pip
2222

23-
if [ $TRAVIS_OS_NAME = "linux" ]
24-
then
25-
export CC=/usr/lib/ccache/gcc
26-
export CXX=/usr/lib/ccache/g++
27-
# Useful for debugging how ccache is used
28-
# export CCACHE_LOGFILE=/tmp/ccache.log
29-
# ~60M is used by .ccache when compiling from scratch at the time of writing
30-
ccache --max-size 100M --show-stats
31-
elif [ $TRAVIS_OS_NAME = "osx" ]
32-
then
33-
# enable OpenMP support for Apple-clang
34-
export CC=/usr/bin/clang
35-
export CXX=/usr/bin/clang++
36-
export CPPFLAGS="$CPPFLAGS -Xpreprocessor -fopenmp"
37-
export CFLAGS="$CFLAGS -I/usr/local/opt/libomp/include"
38-
export CXXFLAGS="$CXXFLAGS -I/usr/local/opt/libomp/include"
39-
export LDFLAGS="$LDFLAGS -L/usr/local/opt/libomp/lib -lomp"
40-
export DYLD_LIBRARY_PATH=/usr/local/opt/libomp/lib
41-
fi
42-
43-
make_conda() {
44-
TO_INSTALL="$@"
45-
# Deactivate the travis-provided virtual environment and setup a
46-
# conda-based environment instead
47-
# If Travvis has language=generic, deactivate does not exist. `|| :` will pass.
48-
deactivate || :
49-
50-
# Install miniconda
51-
if [ $TRAVIS_OS_NAME = "osx" ]
52-
then
53-
fname=Miniconda3-latest-MacOSX-x86_64.sh
54-
else
55-
fname=Miniconda3-latest-Linux-x86_64.sh
56-
fi
57-
wget https://repo.continuum.io/miniconda/$fname \
58-
-O miniconda.sh
59-
MINICONDA_PATH=$HOME/miniconda
60-
chmod +x miniconda.sh && ./miniconda.sh -b -p $MINICONDA_PATH
61-
export PATH=$MINICONDA_PATH/bin:$PATH
62-
conda update --yes conda
63-
64-
conda create -n testenv --yes $TO_INSTALL
65-
source activate testenv
66-
}
67-
68-
if [[ "$DISTRIB" == "conda" ]]; then
69-
TO_INSTALL="python=$PYTHON_VERSION pip pytest pytest-cov \
70-
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
71-
cython=$CYTHON_VERSION"
72-
73-
if [[ "$INSTALL_MKL" == "true" ]]; then
74-
TO_INSTALL="$TO_INSTALL mkl"
75-
else
76-
TO_INSTALL="$TO_INSTALL nomkl"
77-
fi
78-
79-
if [[ -n "$PANDAS_VERSION" ]]; then
80-
TO_INSTALL="$TO_INSTALL pandas=$PANDAS_VERSION"
81-
fi
82-
83-
if [[ -n "$PYAMG_VERSION" ]]; then
84-
TO_INSTALL="$TO_INSTALL pyamg=$PYAMG_VERSION"
85-
fi
86-
87-
if [[ -n "$PILLOW_VERSION" ]]; then
88-
TO_INSTALL="$TO_INSTALL pillow=$PILLOW_VERSION"
89-
fi
90-
91-
if [[ -n "$JOBLIB_VERSION" ]]; then
92-
TO_INSTALL="$TO_INSTALL joblib=$JOBLIB_VERSION"
93-
fi
94-
make_conda $TO_INSTALL
95-
96-
elif [[ "$DISTRIB" == "ubuntu" ]]; then
97-
# At the time of writing numpy 1.9.1 is included in the travis
98-
# virtualenv but we want to use the numpy installed through apt-get
99-
# install.
100-
deactivate
101-
# Create a new virtualenv using system site packages for python, numpy
102-
# and scipy
103-
virtualenv --system-site-packages --python=python3 testvenv
104-
source testvenv/bin/activate
105-
pip install pytest pytest-cov cython joblib==$JOBLIB_VERSION
106-
107-
elif [[ "$DISTRIB" == "scipy-dev" ]]; then
108-
make_conda python=3.7
109-
pip install --upgrade pip setuptools
110-
111-
echo "Installing numpy and scipy master wheels"
112-
dev_url=https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com
113-
pip install --pre --upgrade --timeout=60 -f $dev_url numpy scipy pandas cython
114-
echo "Installing joblib master"
115-
pip install https://github.com/joblib/joblib/archive/master.zip
116-
echo "Installing pillow master"
117-
pip install https://github.com/python-pillow/Pillow/archive/master.zip
118-
pip install pytest==4.6.4 pytest-cov
119-
fi
120-
121-
if [[ "$COVERAGE" == "true" ]]; then
122-
pip install coverage codecov
123-
fi
124-
125-
if [[ "$TEST_DOCSTRINGS" == "true" ]]; then
126-
pip install sphinx numpydoc # numpydoc requires sphinx
127-
fi
23+
export CC=/usr/lib/ccache/gcc
24+
export CXX=/usr/lib/ccache/g++
25+
# Useful for debugging how ccache is used
26+
# export CCACHE_LOGFILE=/tmp/ccache.log
27+
# ~60M is used by .ccache when compiling from scratch at the time of writing
28+
ccache --max-size 100M --show-stats
29+
30+
# Deactivate the travis-provided virtual environment and setup a
31+
# conda-based environment instead
32+
# If Travvis has language=generic, deactivate does not exist. `|| :` will pass.
33+
deactivate || :
34+
35+
# Install miniconda
36+
fname=Miniconda3-latest-Linux-x86_64.sh
37+
wget https://repo.continuum.io/miniconda/$fname -O miniconda.sh
38+
MINICONDA_PATH=$HOME/miniconda
39+
chmod +x miniconda.sh && ./miniconda.sh -b -p $MINICONDA_PATH
40+
export PATH=$MINICONDA_PATH/bin:$PATH
41+
conda update --yes conda
42+
43+
# Create environment and install dependencies
44+
conda create -n testenv --yes python=3.7
45+
source activate testenv
46+
47+
pip install --upgrade pip setuptools
48+
echo "Installing numpy and scipy master wheels"
49+
dev_url=https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com
50+
pip install --pre --upgrade --timeout=60 -f $dev_url numpy scipy pandas cython
51+
echo "Installing joblib master"
52+
pip install https://github.com/joblib/joblib/archive/master.zip
53+
echo "Installing pillow master"
54+
pip install https://github.com/python-pillow/Pillow/archive/master.zip
55+
pip install pytest==4.6.4 pytest-cov
12856

12957
# Build scikit-learn in the install.sh script to collapse the verbose
13058
# build output in the travis output when it succeeds.
13159
python --version
13260
python -c "import numpy; print('numpy %s' % numpy.__version__)"
13361
python -c "import scipy; print('scipy %s' % scipy.__version__)"
134-
python -c "\
135-
try:
136-
import pandas
137-
print('pandas %s' % pandas.__version__)
138-
except ImportError:
139-
pass
140-
"
62+
14163
python setup.py develop
142-
if [ $TRAVIS_OS_NAME = "linux" ]
143-
then
144-
ccache --show-stats
145-
fi
64+
65+
ccache --show-stats
14666
# Useful for debugging how ccache is used
14767
# cat $CCACHE_LOGFILE
14868

doc/conf.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@
5252
imgmath_image_format = 'svg'
5353
else:
5454
extensions.append('sphinx.ext.mathjax')
55-
mathjax_path = ('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/'
56-
'MathJax.js?config=TeX-AMS_SVG')
57-
55+
mathjax_path = ('https://cdn.jsdelivr.net/npm/mathjax@3/es5/'
56+
'tex-chtml.js')
5857

5958
autodoc_default_options = {
6059
'members': True,
@@ -74,7 +73,7 @@
7473
#source_encoding = 'utf-8'
7574

7675
# The master toctree document.
77-
master_doc = 'index'
76+
master_doc = 'contents'
7877

7978
# General information about the project.
8079
project = 'scikit-learn'
@@ -130,14 +129,13 @@
130129

131130
# The theme to use for HTML and HTML Help pages. Major themes that come with
132131
# Sphinx are currently 'default' and 'sphinxdoc'.
133-
html_theme = 'scikit-learn'
132+
html_theme = 'scikit-learn-modern'
134133

135134
# Theme options are theme-specific and customize the look and feel of a theme
136135
# further. For a list of options available for each theme, see the
137136
# documentation.
138-
html_theme_options = {'oldversion': False, 'collapsiblesidebar': True,
139-
'google_analytics': True, 'surveybanner': False,
140-
'sprintbanner': True, 'body_max_width': None}
137+
html_theme_options = {'google_analytics': True,
138+
'mathjax_path': mathjax_path}
141139

142140
# Add any paths that contain custom themes here, relative to this directory.
143141
html_theme_path = ['themes']
@@ -173,7 +171,8 @@
173171

174172
# Additional templates that should be rendered to pages, maps page names to
175173
# template names.
176-
#html_additional_pages = {}
174+
html_additional_pages = {'index': 'index.html',
175+
'documentation': 'documentation.html'}
177176

178177
# If false, no module index is generated.
179178
html_domain_indices = False
@@ -217,7 +216,7 @@
217216
# Grouping the document tree into LaTeX files. List of tuples
218217
# (source start file, target name, title, author, documentclass
219218
# [howto/manual]).
220-
latex_documents = [('index', 'user_guide.tex', 'scikit-learn user guide',
219+
latex_documents = [('contents', 'user_guide.tex', 'scikit-learn user guide',
221220
'scikit-learn developers', 'manual'), ]
222221

223222
# The name of an image file (relative to this directory) to place at the top of
@@ -279,11 +278,7 @@
279278
# thumbnails for the front page of the scikit-learn home page.
280279
# key: first image in set
281280
# values: (number of plot in set, height of thumbnail)
282-
carousel_thumbs = {'sphx_glr_plot_classifier_comparison_001.png': 600,
283-
'sphx_glr_plot_anomaly_comparison_001.png': 372,
284-
'sphx_glr_plot_gpr_co2_001.png': 350,
285-
'sphx_glr_plot_adaboost_twoclass_001.png': 372,
286-
'sphx_glr_plot_compare_methods_001.png': 349}
281+
carousel_thumbs = {'sphx_glr_plot_classifier_comparison_001.png': 600}
287282

288283

289284
# enable experimental module so that experimental estimators can be
@@ -314,8 +309,6 @@ def make_carousel_thumbs(app, exception):
314309

315310
def setup(app):
316311
# to hide/show the prompt in code examples:
317-
app.add_javascript('js/copybutton.js')
318-
app.add_javascript('js/extra.js')
319312
app.connect('build-finished', make_carousel_thumbs)
320313

321314

doc/contents.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. include:: includes/big_toc_css.rst
2+
.. include:: tune_toc.rst
3+
4+
.. Places global toc into the sidebar
5+
:globalsidebartoc: True
6+
7+
=================
8+
Table Of Contents
9+
=================
10+
11+
.. Define an order for the Table of Contents:
12+
13+
.. toctree::
14+
:maxdepth: 2
15+
16+
preface
17+
tutorial/index
18+
getting_started
19+
user_guide
20+
glossary
21+
auto_examples/index
22+
modules/classes
23+
developers/index

doc/data_transforms.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ transformations of the target space (e.g. categorical labels) for use in
2424
scikit-learn.
2525

2626
.. toctree::
27+
:maxdepth: 2
2728

2829
modules/compose
2930
modules/feature_extraction

doc/developers/contributing.rst

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,53 +1037,3 @@ make this task easier and faster (in no particular order).
10371037
<https://git-scm.com/docs/git-grep#_examples>`_) is also extremely
10381038
useful to see every occurrence of a pattern (e.g. a function call or a
10391039
variable) in the code base.
1040-
1041-
1042-
.. _plotting_api:
1043-
1044-
Plotting API
1045-
============
1046-
1047-
Scikit-learn defines a simple API for creating visualizations for machine
1048-
learning. The key features of this API is to run calculations once and to have
1049-
the flexibility to adjust the visualizations after the fact. This logic is
1050-
encapsulated into a display object where the computed data is stored and
1051-
the plotting is done in a `plot` method. The display object's `__init__`
1052-
method contains only the data needed to create the visualization. The `plot`
1053-
method takes in parameters that only have to do with visualization, such as a
1054-
matplotlib axes. The `plot` method will store the matplotlib artists as
1055-
attributes allowing for style adjustments through the display object. A
1056-
`plot_*` helper function accepts parameters to do the computation and the
1057-
parameters used for plotting. After the helper function creates the display
1058-
object with the computed values, it calls the display's plot method. Note
1059-
that the `plot` method defines attributes related to matplotlib, such as the
1060-
line artist. This allows for customizations after calling the `plot` method.
1061-
1062-
For example, the `RocCurveDisplay` defines the following methods and
1063-
attributes:
1064-
1065-
.. code-block:: python
1066-
1067-
class RocCurveDisplay:
1068-
def __init__(self, fpr, tpr, roc_auc, estimator_name):
1069-
...
1070-
self.fpr = fpr
1071-
self.tpr = tpr
1072-
self.roc_auc = roc_auc
1073-
self.estimator_name = estimator_name
1074-
1075-
def plot(self, ax=None, name=None, **kwargs):
1076-
...
1077-
self.line_ = ...
1078-
self.ax_ = ax
1079-
self.figure_ = ax.figure_
1080-
1081-
def plot_roc_curve(estimator, X, y, pos_label=None, sample_weight=None,
1082-
drop_intermediate=True, response_method="auto",
1083-
name=None, ax=None, **kwargs):
1084-
# do computation
1085-
viz = RocCurveDisplay(fpr, tpr, roc_auc,
1086-
estimator.__class__.__name__)
1087-
return viz.plot(ax=ax, name=name, **kwargs)
1088-
1089-
Read more in the :ref:`User Guide <visualizations>`.

doc/developers/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.. Places global toc into the sidebar
2+
:globalsidebartoc: True
3+
14
.. _developers_guide:
25

36
=================
@@ -16,3 +19,4 @@ Developer's Guide
1619
performance
1720
advanced_installation
1821
maintainer
22+
plotting

0 commit comments

Comments
 (0)
0