diff --git a/docs/api/config.rst b/docs/api/config.rst new file mode 100644 index 000000000..525a5ab45 --- /dev/null +++ b/docs/api/config.rst @@ -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 diff --git a/docs/api/index.rst b/docs/api/index.rst index 31d1f1f17..b05427e8c 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -18,3 +18,4 @@ API Reference prepare.rst stats.rst viz.rst + config.rst \ No newline at end of file diff --git a/docs/changes/newsfragments/277.enh b/docs/changes/newsfragments/277.enh new file mode 100644 index 000000000..d1e26291e --- /dev/null +++ b/docs/changes/newsfragments/277.enh @@ -0,0 +1 @@ +Avoid parallel calls in :class:`.FilterColumns` if not specified by the user in the :mod:`.config` module by `Fede Raimondo`_ \ No newline at end of file diff --git a/julearn/transformers/dataframe/filter_columns.py b/julearn/transformers/dataframe/filter_columns.py index d8e863189..84ca07899 100644 --- a/julearn/transformers/dataframe/filter_columns.py +++ b/julearn/transformers/dataframe/filter_columns.py @@ -15,6 +15,7 @@ JuTransformer, ensure_column_types, ) +from ...config import get_config from ...utils.typing import DataLike @@ -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. @@ -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