diff --git a/docs/Makefile b/docs/Makefile index 8ad9ee70a..6bdee39ec 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -17,6 +17,7 @@ help: clean: rm -rf $(BUILDDIR)/* rm -rf auto_examples/ + rm -rf api/generated/ # For local build local: news diff --git a/docs/changes/newsfragments/242.doc b/docs/changes/newsfragments/242.doc new file mode 100644 index 000000000..0fab06f7a --- /dev/null +++ b/docs/changes/newsfragments/242.doc @@ -0,0 +1 @@ +Update ``julearn`` example under ``examples`` by `Synchon Mandal`_ diff --git a/docs/conf.py b/docs/conf.py index c17459636..04c5a5b60 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -81,6 +81,7 @@ nitpick_ignore_regex = [ ("py:class", "typing.Any"), # python 3.11 error # ('py:class', 'numpy.typing.ArrayLike') ("py:obj", "sqlalchemy.engine.Engine"), # ignore sqlalchemy + ("py:class", "pipeline.Pipeline"), # nilearn ] # -- Options for HTML output ------------------------------------------------- diff --git a/examples/run_junifer_julearn.py b/examples/run_junifer_julearn.py index aec3bbbaf..c1435b682 100644 --- a/examples/run_junifer_julearn.py +++ b/examples/run_junifer_julearn.py @@ -16,9 +16,9 @@ import tempfile import nilearn import pandas as pd -from julearn import run_cross_validation +from julearn import run_cross_validation, PipelineCreator -import junifer.testing.registry # noqa +import junifer.testing.registry # noqa: F401 from junifer.api import collect, run from junifer.storage.sqlite import SQLiteFeatureStorage from junifer.utils import configure_logging @@ -70,7 +70,6 @@ sex = ( ############################################################################### # Create a temporary directory for junifer feature extraction: with tempfile.TemporaryDirectory() as tmpdir: - storage = {"kind": "SQLiteFeatureStorage", "uri": f"{tmpdir}/test.sqlite"} # run the defined junifer feature extraction pipeline run( @@ -97,15 +96,23 @@ X = list(df_vbm.columns) df_vbm[y] = age df_vbm[confound] = sex +X_types = { + "features": X, + "confound": confound, +} + +creator = PipelineCreator(problem_type="regression", apply_to="features") +creator.add("zscore", apply_to=["features", "confound"]) +creator.add("confound_removal", apply_to="features", confounds="confound") +creator.add("ridge") + scores = run_cross_validation( - X=X, - confounds=confound, + X=X + [confound], y=y, + X_types=X_types, data=df_vbm, - problem_type="regression", - model="ridge", + model=creator, cv=3, - preprocess_X=["zscore", "remove_confound"], ) print(scores) diff --git a/pyproject.toml b/pyproject.toml index 93793da59..3c5267e0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,7 @@ docs = [ "sphinx-gallery>=0.11.0,<0.12", "furo>=2022.9.29,<2023.0.0", "numpydoc>=1.5.0,<1.6", - "julearn==0.2.5", + "julearn==0.3.0", "sphinx-copybutton==0.5.1", "towncrier==22.12.0", "sphinxcontrib-mermaid==0.8.1",