Skip to content

DOC: a simple implementation of folding #26625

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

Merged
merged 5 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,26 @@
# Not showing the search summary makes the search page load faster.
html_show_search_summary = False


rst_prolog = """
.. |details-start| raw:: html

<details>
<summary class="btn btn-light">

.. |details-split| raw:: html

<span class="tooltiptext">Click for more details</span>
</summary>
<div class="card">

.. |details-end| raw:: html

</div>
</details>

"""

# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
Expand Down
16 changes: 16 additions & 0 deletions doc/modules/model_evaluation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ the :func:`fbeta_score` function::
>>> grid = GridSearchCV(LinearSVC(dual="auto"), param_grid={'C': [1, 10]},
... scoring=ftwo_scorer, cv=5)


|details-start|
**Custom scorer objects**
|details-split|


The second use case is to build a completely custom scorer object
from a simple python function using :func:`make_scorer`, which can
take several parameters:
Expand Down Expand Up @@ -202,13 +208,21 @@ Here is an example of building custom scorers, and of using the
>>> score(clf, X, y)
-0.69...

|details-end|

.. _diy_scoring:

Implementing your own scoring object
------------------------------------

You can generate even more flexible model scorers by constructing your own
scoring object from scratch, without using the :func:`make_scorer` factory.


|details-start|
**How to build a scorer from scratch**
|details-split|

For a callable to be a scorer, it needs to meet the protocol specified by
the following two rules:

Expand Down Expand Up @@ -249,6 +263,8 @@ the following two rules:
... cv=5,
... n_jobs=-1) # doctest: +SKIP

|details-end|

.. _multimetric_scoring:

Using multiple metric evaluation
Expand Down
58 changes: 58 additions & 0 deletions doc/themes/scikit-learn-modern/static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,61 @@ div.clearer {
clear: both;
}

/* details / summary */

div.sk-page-content details {
margin: 4ex 0pt;
}

div.sk-page-content summary.btn {
display: list-item;
padding: 6px 20px;
border: 1pt solid #999;
}

div.sk-page-content details div.card {
padding: 0pt .5ex;
margin: 1ex 0pt;
border: 1px solid #e9ecef;
border-left-width: .25rem;
border-radius: .25rem;
background: rgb(250, 252, 253)
}

div.sk-page-content summary {
position: relative; /* Needed for the tooltips */
}

div.sk-page-content summary .tooltiptext {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 150%;
left: 50%;
margin-left: -60px;
}

div.sk-page-content summary .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}

div.sk-page-content summary:hover .tooltiptext {
visibility: visible;
}

/* Button */

.sk-btn-primary {
Expand Down Expand Up @@ -606,6 +661,7 @@ div.sk-sidebar-global-toc ul ul {
div.sk-page-content h1 {
background-color: #cde8ef;
padding: 0.5rem;
margin-top: calc(max(2.5rem, 1vh));
border-radius: 0 1rem;
text-align: center;
font-size: 2rem;
Expand All @@ -617,6 +673,7 @@ div.sk-page-content h2 {
background-color: #BED4EB;
border-radius: 0.3rem;
font-size: 1.5rem;
margin-top: calc(max(2rem, .7vh));
margin-bottom: 1rem;
word-wrap: break-word;
}
Expand All @@ -627,6 +684,7 @@ div.sk-page-content h3 {
border-radius: 0.3rem;
font-size: 1.2rem;
word-wrap: break-word;
margin-top: 1.5rem;
}

div.sk-page-content h4 {
Expand Down