Skip to content

[MRG] DOC Revamp statistical inference tutorial pages #17865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
25 changes: 20 additions & 5 deletions doc/themes/scikit-learn-modern/static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ a code {

img {
max-width: 100%;
border-radius: 0.25rem;
}

span.highlighted {
Expand Down Expand Up @@ -836,10 +837,6 @@ div.highlight:hover span.copybutton:hover {
background-color: #20252B;
}

div.body img.align-center {
max-width: 800px;
}

div.body img {
max-width: 100%;
height: unset!important; /* Needed because sphinx sets the height */
Expand Down Expand Up @@ -1210,16 +1207,34 @@ div.sk-sponsor-div, div.sk-testimonial-div {
align-items: center;
}

div.sk-sponsor-div-box, div.sk-testimonial-div-box {
div.sk-sponsor-div-box, div.sk-testimonial-div-box,
div.sk-doc-div-box {
width: 100%;
}

div.sk-doc-div {
display: flex;
flex-wrap: wrap;
justify-content: center;
}

div.sk-doc-div-box {
padding: 0.30rem;
overflow: auto;
}

@media screen and (min-width: 500px) {
div.sk-sponsor-div-box, div.sk-testimonial-div-box {
width: 50%;
}
}

@media screen and (min-width: 1200px) {
div.sk-doc-div-box {
width: 50%;
}
}

table.sk-sponsor-table tr, table.sk-sponsor-table tr:nth-child(odd) {
border-style: none;
background-color: white;
Expand Down
4 changes: 2 additions & 2 deletions doc/tutorial/statistical_inference/finding_help.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ Q&A communities with Machine Learning practitioners

.. _`multiple subdomains for Machine Learning questions`: https://meta.stackexchange.com/q/130524

-- _'An excellent free online course for Machine Learning taught by Professor Andrew Ng of Stanford': https://www.coursera.org/learn/machine-learning
- `An excellent free online course for Machine Learning taught by Professor Andrew Ng of Stanford <https://www.coursera.org/learn/machine-learning>`_

-- _'Another excellent free online course that takes a more general approach to Artificial Intelligence': https://www.udacity.com/course/intro-to-artificial-intelligence--cs271
- `Another excellent free online course that takes a more general approach to Artificial Intelligence <https://www.udacity.com/course/intro-to-artificial-intelligence--cs271>`_
35 changes: 23 additions & 12 deletions doc/tutorial/statistical_inference/model_selection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,35 @@ scoring method.
.. currentmodule:: sklearn.svm

.. topic:: **Exercise**
:class: green

.. image:: /auto_examples/exercises/images/sphx_glr_plot_cv_digits_001.png
:target: ../../auto_examples/exercises/plot_cv_digits.html
:align: right
:scale: 90
.. raw :: html

<div class="sk-doc-div">
<div class="sk-doc-div-box">

On the digits dataset, plot the cross-validation score of a :class:`SVC`
estimator with an linear kernel as a function of parameter ``C`` (use a
logarithmic grid of points, from 1 to 10).

On the digits dataset, plot the cross-validation score of a :class:`SVC`
estimator with an linear kernel as a function of parameter ``C`` (use a
logarithmic grid of points, from 1 to 10).
.. literalinclude:: ../../auto_examples/exercises/plot_cv_digits.py
:lines: 13-23

.. literalinclude:: ../../auto_examples/exercises/plot_cv_digits.py
:lines: 13-23
.. raw :: html

</div>
<div class="sk-doc-div-box">

.. image:: /auto_examples/exercises/images/sphx_glr_plot_cv_digits_001.png
:target: ../../auto_examples/exercises/plot_cv_digits.html
:align: center
:scale: 90

**Solution:** :ref:`sphx_glr_auto_examples_exercises_plot_cv_digits.py`
.. raw :: html

</div>
</div>

**Solution:** :ref:`sphx_glr_auto_examples_exercises_plot_cv_digits.py`

Grid-search and cross-validated estimators
============================================
Expand Down Expand Up @@ -273,7 +285,6 @@ These estimators are called similarly to their counterparts, with 'CV'
appended to their name.

.. topic:: **Exercise**
:class: green

On the diabetes dataset, find the optimal regularization parameter
alpha.
Expand Down
35 changes: 20 additions & 15 deletions doc/tutorial/statistical_inference/putting_together.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ Pipelining
We have seen that some estimators can transform data and that some estimators
can predict variables. We can also create combined estimators:

.. image:: ../../auto_examples/compose/images/sphx_glr_plot_digits_pipe_001.png
:target: ../../auto_examples/compose/plot_digits_pipe.html
:scale: 65
:align: right

.. literalinclude:: ../../auto_examples/compose/plot_digits_pipe.py
:lines: 23-63



.. image:: ../../auto_examples/compose/images/sphx_glr_plot_digits_pipe_001.png
:target: ../../auto_examples/compose/plot_digits_pipe.html
:scale: 65
:align: center

Face recognition with eigenfaces
=================================
Expand All @@ -40,20 +37,28 @@ The dataset used in this example is a preprocessed excerpt of the
.. |eigenfaces| image:: ../../images/plot_face_recognition_2.png
:scale: 50

.. list-table::
:class: centered
.. raw :: html

<div class="sk-doc-div">
<div class="sk-doc-div-box">

<h4>Prediction</h4>

|prediction|

*
.. raw :: html

- |prediction|
</div>
<div class="sk-doc-div-box">

- |eigenfaces|
<h4>Eigenfaces</h4>

*
|eigenfaces|

- **Prediction**
.. raw :: html

- **Eigenfaces**
</div>
</div>

Expected results for the top 5 most represented people in the dataset::

Expand Down
24 changes: 19 additions & 5 deletions doc/tutorial/statistical_inference/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ needs to be preprocessed in order to be used by scikit-learn.

.. topic:: An example of reshaping data would be the digits dataset

.. raw :: html

<div class="sk-doc-div">
<div class="sk-doc-div-box">

The digits dataset is made of 1797 8x8 images of hand-written
digits ::

Expand All @@ -41,16 +46,25 @@ needs to be preprocessed in order to be used by scikit-learn.
>>> plt.imshow(digits.images[-1], cmap=plt.cm.gray_r) #doctest: +SKIP
<matplotlib.image.AxesImage object at ...>

.. image:: /auto_examples/datasets/images/sphx_glr_plot_digits_last_image_001.png
:target: ../../auto_examples/datasets/plot_digits_last_image.html
:align: left
:scale: 60

To use this dataset with scikit-learn, we transform each 8x8 image into a
feature vector of length 64 ::

>>> data = digits.images.reshape((digits.images.shape[0], -1))

.. raw :: html

</div>
<div class="sk-doc-div-box">

.. image:: /auto_examples/datasets/images/sphx_glr_plot_digits_last_image_001.png
:target: ../../auto_examples/datasets/plot_digits_last_image.html
:align: center

.. raw :: html

</div>
</div>


Estimators objects
===================
Expand Down
Loading