Skip to content

Commit 0235bde

Browse files
rcap107jeromedockesGaelVaroquaux
committed
DOC - More fixes and improvements to the user guide (skrub-data#1574)
Co-authored-by: Jérôme Dockès <jerome@dockes.org> Co-authored-by: Gael Varoquaux <gael.varoquaux@normalesup.org>
1 parent 43c0cdb commit 0235bde

64 files changed

Lines changed: 3149 additions & 1772 deletions

File tree

Some content is hidden

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

CHANGES.rst

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Highlights
7575
to train and tune machine learning models. Then, the DataOps plans can be exported
7676
as ``Learners`` (:class:`skrub.SkrubLearner`), standalone objects that can be
7777
used on new data. More detail about the DataOps can be found in the
78-
:ref:`User guide <userguide_data_ops>` and in the
78+
:ref:`User guide <user_guide_data_ops_index>` and in the
7979
:ref:`examples <data_ops_examples_ref>`.
8080

8181
- The :class:`TableReport` has been improved with many new features. Series are
@@ -86,12 +86,12 @@ Highlights
8686

8787
- :mod:`selectors`, :class:`ApplyToCols` and :class:`ApplyToFrame` are now available,
8888
providing utilities for selecting columns to which a transformer should be applied
89-
in a flexible way. For more details, see the :ref:`User guide <userguide_selectors>`
90-
and the :ref:`example <sphx_glr_auto_examples_10_apply_on_cols.py>`.
89+
in a flexible way. For more details, see the :ref:`User guide <user_guide_selectors>`
90+
and the :ref:`example <sphx_glr_auto_examples_09_apply_to_cols.py>`.
9191

9292
- The :class:`SquashingScaler` has been added: it robustly rescales and smoothly
93-
clips numerical columns, enabling more robust handling of numerical columns
94-
with neural networks. See the :ref:`example <sphx_glr_auto_examples_11_squashing_scaler.py>`
93+
clips numeric columns, enabling more robust handling of numeric columns
94+
with neural networks. See the :ref:`example <sphx_glr_auto_examples_10_squashing_scaler.py>`
9595

9696
New features
9797
------------
@@ -137,8 +137,8 @@ New features
137137
in reports. :pr:`1470` by :user:`George S <georgescutelnicu>`.
138138

139139
- Added the :class:`SquashingScaler`, a transformer that
140-
robustly rescales and smoothly clips numerical columns,
141-
enabling more robust handling of numerical columns
140+
robustly rescales and smoothly clips numeric columns,
141+
enabling more robust handling of numeric columns
142142
with neural networks. :pr:`1310` by :user:`Vincent Maladiere <Vincent-Maladiere>` and
143143
:user:`David Holzmüller <dholzmueller>`.
144144

@@ -206,7 +206,7 @@ Changes
206206

207207
- The :class:`TableReport` now supports Series in addition to Dataframes. :pr:`1420` by :user:`Vitor Pohlenz<vitorpohlenz>`.
208208

209-
- The :class:`Cleaner` now exposes a parameter to convert numerical values to float32. :pr:`1440` by
209+
- The :class:`Cleaner` now exposes a parameter to convert numeric values to float32. :pr:`1440` by
210210
:user:`Riccardo Cappuzzo<rcap107>`.
211211

212212
- The :class:`TableReport` now shows if columns are sorted. :pr:`1512` by :user:`Dea María Léon<DeaMariaLeon>`.
@@ -337,8 +337,7 @@ Release 0.4.1
337337
Changes
338338
-------
339339

340-
* :class: `TableReport` has `write_html` method
341-
:pr:`1190` by :user:`Mojdeh Rastgoo<mrastgoo>`.
340+
* :class:`TableReport` has `write_html` method. :pr:`1190` by :user:`Mojdeh Rastgoo<mrastgoo>`.
342341

343342
* A new parameter ``verbose`` has been added to the :class:`TableReport` to toggle on or off the
344343
printing of progress information when a report is being generated.
@@ -806,7 +805,7 @@ Minor changes
806805
- `check_is_fitted` now looks at `"transformers_"` rather than `"columns_"`
807806
- the default of the `remainder` parameter in the docstring is now `"passthrough"`
808807
instead of `"drop"` to match the implementation.
809-
- uint8 and int8 dtypes are now considered as numerical columns.
808+
- uint8 and int8 dtypes are now considered as numeric columns.
810809

811810
* Removed the leading "<" and trailing ">" symbols from KEN entities
812811
and types.
@@ -856,10 +855,10 @@ Dirty-cat release 0.4.1
856855

857856
Major changes
858857
-------------
859-
* :func:`fuzzy_join` and :class:`FeatureAugmenter` can now join on numerical columns based on the euclidean distance.
858+
* :func:`fuzzy_join` and :class:`FeatureAugmenter` can now join on numeric columns based on the euclidean distance.
860859
:pr:`530` by :user:`Jovan Stojanovic <jovan-stojanovic>`
861860

862-
* :func:`fuzzy_join` and :class:`FeatureAugmenter` can perform many-to-many joins on lists of numerical or string key columns.
861+
* :func:`fuzzy_join` and :class:`FeatureAugmenter` can perform many-to-many joins on lists of numeric or string key columns.
863862
:pr:`530` by :user:`Jovan Stojanovic <jovan-stojanovic>`
864863

865864
* :func:`GapEncoder.transform` will not continue fitting of the instance anymore.
@@ -949,7 +948,7 @@ Dirty-cat Release 0.3.0
949948
Major changes
950949
-------------
951950

952-
* New encoder: :class:`DatetimeEncoder` can transform a datetime column into several numerical columns
951+
* New encoder: :class:`DatetimeEncoder` can transform a datetime column into several numeric columns
953952
(year, month, day, hour, minute, second, ...). It is now the default transformer used
954953
in the :class:`TableVectorizer` for datetime columns. :pr:`239` by :user:`Leo Grinsztajn <LeoGrin>`
955954

doc/_templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ <h5 class="feature-title">Inspect it, apply it to new data</h5>
147147
</div>
148148
<p class="feature-text-see-also">
149149
<!-- name of the userguide file on DataOps -->
150-
<a href="userguide_data_ops.html">Discover the skrub DataOps →</a>
150+
<a href="{{ pathto('auto_examples/data_ops/11_data_ops_intro') }}">Discover the skrub DataOps →</a>
151151
</p>
152152
</div>
153153
<div class="col-md-7">

doc/api_reference.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@
5656
"sections": [
5757
{
5858
"description": (
59-
"See :ref:`End-to-End pipeline <userguide_tablevectorizer>` for "
60-
"further details. For more flexibility and control to build "
61-
"pipelines, see the :ref:`skrub DataOps <userguide_data_ops>`."
59+
"See :ref:`End-to-End pipeline"
60+
" <user_guide_building_pipeline_index>` for further details. For"
61+
" more flexibility and control to build pipelines, see the"
62+
" :ref:`skrub DataOps <user_guide_data_ops_index>`."
6263
),
6364
"autosummary": [
6465
"tabular_pipeline",
65-
"tabular_learner",
6666
"TableVectorizer",
6767
"SelectCols",
6868
"DropCols",
@@ -79,7 +79,8 @@
7979
"sections": [
8080
{
8181
"description": (
82-
"See :ref:`encoding <userguide_encoders>` for further details."
82+
"See :ref:`encoding <user_guide_encoders_index>` for further"
83+
" details."
8384
),
8485
"autosummary": [
8586
"StringEncoder",
@@ -153,7 +154,7 @@
153154
{
154155
"description": (
155156
"Contains method to select columns in a dataframe. See the"
156-
" :ref:`selectors <userguide_selectors>` section for further"
157+
" :ref:`selectors <user_guide_selectors>` section for further"
157158
" details."
158159
),
159160
"autosummary": [
@@ -186,8 +187,8 @@
186187
"sections": [
187188
{
188189
"description": (
189-
"Generalizing the scikit-learn pipeline. "
190-
"See :ref:`skrub DataOps <userguide_data_ops>` for further details."
190+
"Generalizing the scikit-learn pipeline. See :ref:`skrub DataOps"
191+
" <user_guide_data_ops_index>` for further details."
191192
),
192193
"autosummary": ["var", "X", "y", "as_data_op", "deferred"],
193194
"template": "base.rst",

doc/column_level_featurizing.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. _user_guide_encoders_index:
2+
3+
Column-level feature extraction
4+
===============================
5+
6+
Skrub provides various transformers that help with feature engineering numeric,
7+
datetime and categorical data. The encoders covered in this section convert the
8+
raw features found in an input dataframe into numeric features that can be used
9+
directly by machine learning models.
10+
11+
.. include:: includes/big_toc_css.rst
12+
13+
.. toctree::
14+
:maxdepth: 3
15+
16+
modules/column_level_featurizing/feature_engineering_categorical
17+
modules/column_level_featurizing/feature_engineering_datetimes
18+
modules/column_level_featurizing/robust_scaling

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@
353353
"skrub Documentation",
354354
author,
355355
"skrub",
356-
"Prepping tables for machine learning.",
356+
"Machine learning with dataframes",
357357
"Data Science",
358358
),
359359
]
@@ -397,7 +397,7 @@ def notebook_modification_function(notebook_content, notebook_filename):
397397
"</div>",
398398
]
399399
)
400-
400+
# TODO: remove this when we remove KEN embeddings
401401
if "06_ken_embeddings_example" in notebook_filename:
402402
message_class = "danger"
403403
message = (

doc/configuration_and_utils.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. _user_guide_configuration_index:
2+
3+
Configuration and dataset utilities
4+
=========================================
5+
6+
This section covers the skrub global configurations and dataset utilities.
7+
8+
.. toctree::
9+
:maxdepth: 2
10+
11+
modules/configuration_and_utils/customizing_configuration
12+
modules/configuration_and_utils/deduplicate_categorical_data
13+
modules/configuration_and_utils/fetching_datasets

doc/data_ops.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.. _user_guide_data_ops_index:
2+
3+
Complex multi-table pipelines with Data Ops
4+
===========================================
5+
6+
Skrub provides an easy way to build complex, flexible machine learning pipelines.
7+
There are several needs that are not easily addressed with standard scikit-learn
8+
tools such as :class:`~sklearn.pipeline.Pipeline` and
9+
:class:`~sklearn.compose.ColumnTransformer`, and for which the Skrub DataOps offer
10+
a solution:
11+
12+
- Multiple tables: We often have several tables of different shapes (for
13+
example, "Customers", "Orders", and "Products" tables) that need to be
14+
processed and assembled into a design matrix ``X``. The target ``y`` may also
15+
be the result of some data processing. Standard scikit-learn estimators do not
16+
support this, as they expect right away a single design matrix ``X`` and a
17+
target array ``y``, with one row per observation.
18+
- DataFrame wrangling: Performing typical DataFrame operations such as
19+
projections, joins, and aggregations should be possible and allow leveraging
20+
the powerful and familiar APIs of `Pandas <https://pandas.pydata.org>`_ or
21+
`Polars <https://docs.pola.rs/>`_.
22+
- Hyperparameter tuning: Choices of estimators, hyperparameters, and even
23+
the pipeline architecture can be guided by validation scores. Specifying
24+
ranges of possible values outside of the pipeline itself (as in
25+
:class:`~sklearn.model_selection.GridSearchCV`) is difficult in complex
26+
pipelines.
27+
- Iterative development: Building a pipeline step by step while inspecting
28+
intermediate results allows for a short feedback loop and early discovery of
29+
errors.
30+
31+
In this section we cover all about the skrub Data Ops, from starting out with a
32+
simple example, to more advanced concepts like parameter tuning and and pipeline
33+
validation.
34+
35+
Data Ops basic concepts
36+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
38+
.. toctree::
39+
:maxdepth: 3
40+
41+
modules/data_ops/basics/what_are_data_ops
42+
modules/data_ops/basics/building_data_ops_plan
43+
modules/data_ops/basics/using_previews
44+
modules/data_ops/basics/direct_access_methods
45+
modules/data_ops/basics/control_flow
46+
modules/data_ops/basics/data_ops_vs_alternatives
47+
48+
Building a complex pipeline with the skrub Data Ops
49+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
51+
.. toctree::
52+
:maxdepth: 2
53+
54+
modules/data_ops/ml_pipeline/applying_ml_estimators
55+
modules/data_ops/ml_pipeline/applying_different_transformers
56+
modules/data_ops/ml_pipeline/documenting_data_ops_plan
57+
modules/data_ops/ml_pipeline/evaluating_debugging_data_ops
58+
modules/data_ops/ml_pipeline/using_part_of_data_ops_plan
59+
modules/data_ops/ml_pipeline/subsampling_data
60+
61+
Tuning and validating Skrub DataOps plans
62+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63+
64+
.. toctree::
65+
:maxdepth: 2
66+
67+
modules/data_ops/validation/tuning_validating_data_ops
68+
modules/data_ops/validation/hyperparameter_tuning
69+
modules/data_ops/validation/nested_cross_validation
70+
modules/data_ops/validation/nesting_choices_choosing_pipelines
71+
modules/data_ops/validation/exporting_data_ops

doc/default_wrangling.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. _user_guide_building_pipeline_index:
2+
3+
Wrangling data with good defaults
4+
=================================
5+
6+
This section covers how to build a predictive pipeline starting from a dataframe.
7+
The skrub objects described in this section can be used as strong defaults for
8+
building baseline pipelines, and can be customized for specific use cases.
9+
10+
11+
.. toctree::
12+
:maxdepth: 3
13+
14+
modules/default_wrangling/cleaning_dataframes
15+
modules/default_wrangling/table_vectorizer
16+
modules/default_wrangling/tabular_pipeline

doc/documentation.rst

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
1+
.. |TableReport| replace:: :class:`~skrub.TableReport`
2+
.. |Cleaner| replace:: :class:`~skrub.Cleaner`
3+
.. |TableVectorizer| replace:: :class:`~skrub.TableVectorizer`
4+
.. |tabular_pipeline| replace:: :func:`~skrub.tabular_pipeline`
5+
16
.. _user_guide:
27

38
User Guide
49
==========
5-
Skrub is a library that eases machine learning with dataframes
6-
for machine learning.
10+
Skrub is a library that eases machine learning with dataframes, from exploring
11+
dataframes to validating a machine-learning pipeline.
12+
13+
The |TableReport| is a powerful data exploration tool, which can be followed by
14+
data sanitization and feature engineering tools in the |Cleaner| and |TableVectorizer|.
15+
The |tabular_pipeline| combines the two to build a strong baseline for dataframes.
16+
17+
The skrub :ref:`column-level encoders<user_guide_encoders_index>` can be tweaked by the user for more
18+
specific needs.
19+
Various :ref:`multi-column transformers <user_guide_building_pipeline_index>` and the :ref:`selectors API<user_guide_selectors>`
20+
provide a high degree of control over which columns should be modified.
721

8-
Starting from rich, complex data stored in one or several dataframes, it helps
9-
performing the data wrangling necessary to produce a numeric array that is fed
10-
to a machine-learning model. This wrangling comprises joining tables (possibly
11-
with inexact matches), parsing structured data such as datetimes from text,
12-
and extracting numeric features from non-numeric data.
22+
More complex, multi-table scenarios can make use of the skrub :ref:`Data Ops <user_guide_data_ops_index>`,
23+
which enable constructing and validating pipelines that involve
24+
multiple dataframes and hyperparameter tuning.
1325

14-
For those tasks, skrub does not replace pandas or polars. Instead, it
26+
Skrub does not replace pandas or polars. Instead, it
1527
leverages the dataframe libraries to provide more high-level building blocks that
1628
perform the data preprocessing steps that are typically needed in a machine learning
1729
pipeline.
1830

19-
This guide demonstrates how to resolve various issues using Skrub's features.
20-
See the examples section for full code snippets.
2131

2232

2333
.. include:: includes/big_toc_css.rst
2434

2535
.. toctree::
26-
:maxdepth: 2
27-
28-
userguide_tablereport
29-
userguide_encoders
30-
userguide_datetimes
31-
userguide_tablevectorizer
32-
userguide_data_cleaning
33-
userguide_selectors
34-
userguide_data_ops
35-
userguide_data_ops_ml_pipeline
36-
userguide_data_ops_validation
37-
userguide_joining_tables
38-
userguide_utils
36+
:maxdepth: 3
37+
38+
exploring_a_dataframe
39+
default_wrangling
40+
column_level_featurizing
41+
multi_column_operations
42+
data_ops
43+
configuration_and_utils
44+
joining_dataframes

doc/exploring_a_dataframe.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. _user_guide_exploring_a_dataframe_index:
2+
3+
Exploring a Dataframe
4+
=====================
5+
6+
This section covers the :class:`~skrub.TableReport` and how it can be used for exploring
7+
and understanding your dataframes.
8+
9+
10+
.. toctree::
11+
:maxdepth: 3
12+
13+
modules/tablereport/exploring_dataframes_interactively
14+
modules/tablereport/finding_correlated_columns

0 commit comments

Comments
 (0)