Skip to content

Commit add7a8a

Browse files
Apply suggestions from code review
Co-authored-by: Christian Lorentzen <[email protected]>
1 parent eac9f9f commit add7a8a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

slep018/proposal.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SLEP018: Pandas Output for Transformers with set_output
1212
Abstract
1313
--------
1414

15-
This SLEP proposes a ``set_output`` method to configure the output container of
15+
This SLEP proposes a ``set_output`` method to configure the output data container of
1616
scikit-learn transformers.
1717

1818
Detailed description
@@ -32,9 +32,10 @@ The index of the output DataFrame must match the index of the input. If the
3232
transformer does not support ``transform="pandas"``, then it must raise a
3333
``ValueError`` stating that it does not support the feature.
3434

35-
For this SLEP, ``set_output`` will only configure the output for dense data. If
36-
the transformer returns sparse data, then ``transform`` will raise a
37-
``ValueError`` if ``set_output(transform="pandas")``.
35+
This SLEP's only focus is dense data for ``set_output``. If a transformer returns
36+
sparse data, e.g. `OneHotEncoder(sparse=True), then ``transform`` will raise a
37+
``ValueError`` if ``set_output(transform="pandas")``. Dealing with sparse output
38+
might be the scope of another future SLEP.
3839

3940
For a pipeline, calling ``set_output`` on the pipeline will configure all steps
4041
in the pipeline::
@@ -44,6 +45,9 @@ in the pipeline::
4445

4546
# X_trans_df is a pandas DataFrame
4647
X_trans_df = num_preprocessor.fit_transform(X_df)
48+
49+
# X_trans_df is again a pandas DataFrame
50+
X_trans_df = num_preprocessor[0].transform(X_df)
4751

4852
Meta-estimators that support ``set_output`` are required to configure all inner
4953
transformer by calling ``set_output``. If an inner transformer does not define
@@ -52,7 +56,7 @@ transformer by calling ``set_output``. If an inner transformer does not define
5256
Global Configuration
5357
....................
5458

55-
This SLEP proposes a global configuration flag that sets the output for all
59+
For ease of use, this SLEP proposes a global configuration flag that sets the output for all
5660
transformers::
5761

5862
import sklearn
@@ -64,7 +68,7 @@ determines the output container.
6468
Implementation
6569
--------------
6670

67-
The implementation of this SLEP is in :pr:`23734`.
71+
A possible implementation of this SLEP is worked out in :pr:`23734`.
6872

6973
Backward compatibility
7074
----------------------
@@ -99,7 +103,7 @@ A list of issues discussing Pandas output are: `#14315
99103

100104
Future Extensions
101105
-----------------
102-
106+
For information only!
103107
Sparse Data
104108
...........
105109

0 commit comments

Comments
 (0)