Skip to content

Commit

Permalink
Merge pull request #277 from juaml/enh/filter_parallel_control
Browse files Browse the repository at this point in the history
Control parallel column transformer in filter columns
  • Loading branch information
fraimondo authored Oct 22, 2024
2 parents f34d277 + f8b68fa commit 6393826
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/api/config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Config
======

.. automodule:: julearn.config
:no-members:
:no-inherited-members:


See :ref:`configuration` for more information on the flags that can be set.

Functions
---------

.. currentmodule:: julearn.config

.. autosummary::
:toctree: generated/
:template: function.rst

set_config
get_config
1 change: 1 addition & 0 deletions docs/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ API Reference
prepare.rst
stats.rst
viz.rst
config.rst
1 change: 1 addition & 0 deletions docs/changes/newsfragments/277.enh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid parallel calls in :class:`.FilterColumns` if not specified by the user in the :mod:`.config` module by `Fede Raimondo`_
8 changes: 7 additions & 1 deletion julearn/transformers/dataframe/filter_columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
JuTransformer,
ensure_column_types,
)
from ...config import get_config
from ...utils.typing import DataLike


Expand Down Expand Up @@ -53,7 +54,9 @@ def __init__(
)

def _fit(
self, X: pd.DataFrame, y: Optional[DataLike] = None # noqa: N803
self,
X: pd.DataFrame, # noqa: N803
y: Optional[DataLike] = None,
) -> "FilterColumns":
"""Fit the transformer.
Expand All @@ -75,6 +78,9 @@ def _fit(
transformers=[("keep", "passthrough", apply_to_selector)],
remainder="drop",
verbose_feature_names_out=False,
n_jobs=None
if get_config("enable_parallel_column_transformers")
else 1,
)
self.filter_columns_.fit(X, y)
return self
Expand Down

0 comments on commit 6393826

Please sign in to comment.