diff --git a/doc_conf/api.rst b/doc_conf/api.rst index 50fbff06..315daad1 100644 --- a/doc_conf/api.rst +++ b/doc_conf/api.rst @@ -26,7 +26,8 @@ Functions knockoff_aggregation model_x_knockoff multivariate_1D_simulation - permutation_test_cv + permutation_test + permutation_test_pval reid empirical_thresholding zscore_from_pval diff --git a/doc_conf/index.rst b/doc_conf/index.rst index 2eb52245..171428bf 100644 --- a/doc_conf/index.rst +++ b/doc_conf/index.rst @@ -37,6 +37,9 @@ HiDimStat depends on the following packages:: numpy scipy scikit-learn + pandas + torch + torchmetrics To run examples it is neccessary to install ``matplotlib``, and to run tests it @@ -71,8 +74,8 @@ To build the documentation you will need to run: .. code-block:: - pip install -U sphinx_gallery sphinx_bootstrap_theme - cd doc + pip install -U .[doc] + cd doc_conf make html diff --git a/doc_conf/references.bib b/doc_conf/references.bib index 88f3218e..9de772a0 100644 --- a/doc_conf/references.bib +++ b/doc_conf/references.bib @@ -176,7 +176,6 @@ @article{liuFastPowerfulConditional2021 abstract = {We consider the problem of conditional independence testing: given a response Y and covariates (X,Z), we test the null hypothesis that Y is independent of X given Z. The conditional randomization test (CRT) was recently proposed as a way to use distributional information about X{\textbar}Z to exactly (non-asymptotically) control Type-I error using any test statistic in any dimensionality without assuming anything about Y{\textbar}(X,Z). This flexibility in principle allows one to derive powerful test statistics from complex prediction algorithms while maintaining statistical validity. Yet the direct use of such advanced test statistics in the CRT is prohibitively computationally expensive, especially with multiple testing, due to the CRT's requirement to recompute the test statistic many times on resampled data. We propose the distilled CRT, a novel approach to using state-of-the-art machine learning algorithms in the CRT while drastically reducing the number of times those algorithms need to be run, thereby taking advantage of their power and the CRT's statistical guarantees without suffering the usual computational expense. In addition to distillation, we propose a number of other tricks like screening and recycling computations to further speed up the CRT without sacrificing its high power and exact validity. Indeed, we show in simulations that all our proposals combined lead to a test that has similar power to the most powerful existing CRT implementations but requires orders of magnitude less computation, making it a practical tool even for large data sets. We demonstrate these benefits on a breast cancer dataset by identifying biomarkers related to cancer stage.}, archiveprefix = {arxiv}, keywords = {Statistics - Methodology}, - file = {/home/ahmad/Zotero/storage/8HRQZX3H/Liu et al. - 2021 - Fast and Powerful Conditional Randomization Testin.pdf;/home/ahmad/Zotero/storage/YFNDKN2B/2006.html} } @thesis{chevalier_statistical_2020, @@ -188,4 +187,101 @@ @thesis{chevalier_statistical_2020 urldate = {2024-10-17}, date = {2020-12-11}, langid = {english}, -} \ No newline at end of file +} +} + +@article{benjamini1995controlling, + title={Controlling the false discovery rate: a practical and powerful approach to multiple testing}, + author={Benjamini, Yoav and Hochberg, Yosef}, + journal={Journal of the Royal statistical society: series B (Methodological)}, + volume={57}, + number={1}, + pages={289--300}, + year={1995}, + publisher={Wiley Online Library} +} + + +@article{wang2022false, + title={False discovery rate control with e-values}, + author={Wang, Ruodu and Ramdas, Aaditya}, + journal={Journal of the Royal Statistical Society Series B: Statistical Methodology}, + volume={84}, + number={3}, + pages={822--852}, + year={2022}, + publisher={Oxford University Press} +} + +@article{ramdas2017wasserstein, + title={On wasserstein two-sample testing and related families of nonparametric tests}, + author={Ramdas, Aaditya and Garc{\'\i}a Trillos, Nicol{\'a}s and Cuturi, Marco}, + journal={Entropy}, + volume={19}, + number={2}, + pages={47}, + year={2017}, + publisher={MDPI} +} + +@article{ramdas2017online, + title={Online control of the false discovery rate with decaying memory}, + author={Ramdas, Aaditya and Yang, Fanny and Wainwright, Martin J and Jordan, Michael I}, + journal={Advances in neural information processing systems}, + volume={30}, + year={2017} +} + +@article{meinshausen2008hierarchical, + title={Hierarchical testing of variable importance}, + author={Meinshausen, Nicolai}, + journal={Biometrika}, + volume={95}, + number={2}, + pages={265--278}, + year={2008}, + publisher={Oxford University Press} +} +@article{meinshausen2009p, + title={P-values for high-dimensional regression}, + author={Meinshausen, Nicolai and Meier, Lukas and B{\"u}hlmann, Peter}, + journal={Journal of the American Statistical Association}, + volume={104}, + number={488}, + pages={1671--1681}, + year={2009}, + publisher={Taylor \& Francis} +} + +@book{westfall1993resampling, + title={Resampling-based multiple testing: Examples and methods for p-value adjustment}, + author={Westfall, Peter H and Young, S Stanley}, + volume={279}, + year={1993}, + publisher={John Wiley \& Sons} +} + +@article{hirschhorn2005genome, + title={Genome-wide association studies for common diseases and complex traits}, + author={Hirschhorn, Joel N and Daly, Mark J}, + journal={Nature reviews genetics}, + volume={6}, + number={2}, + pages={95--108}, + year={2005}, + publisher={Nature Publishing Group UK London} +} +@article{gaonkar_deriving_2012, + title = {Deriving statistical significance maps for {SVM} based image classification and group comparisons}, + volume = {15}, + url = {https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3703958/}, + pages = {723--730}, + number = {0}, + journaltitle = {Medical image computing and computer-assisted intervention : {MICCAI} ... International Conference on Medical Image Computing and Computer-Assisted Intervention}, + journal = {Med Image Comput Comput Assist Interv}, + author = {Gaonkar, Bilwaj and Davatzikos, Christos}, + urldate = {2024-12-16}, + year = {2012}, + pmid = {23285616}, + pmcid = {PMC3703958}, +} diff --git a/docs/_downloads/06bb0f682e15138dfd659b791a14e9c6/plot_variable_importance_classif.zip b/docs/_downloads/06bb0f682e15138dfd659b791a14e9c6/plot_variable_importance_classif.zip index ed142d83..a29ba151 100644 Binary files a/docs/_downloads/06bb0f682e15138dfd659b791a14e9c6/plot_variable_importance_classif.zip and b/docs/_downloads/06bb0f682e15138dfd659b791a14e9c6/plot_variable_importance_classif.zip differ diff --git a/docs/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip b/docs/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip index 2cf543ce..f17e32fc 100644 Binary files a/docs/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip and b/docs/_downloads/07fcc19ba03226cd3d83d4e40ec44385/auto_examples_python.zip differ diff --git a/docs/_downloads/117422582fb46cc8ed6549598a2d87de/plot_dcrt_example.zip b/docs/_downloads/117422582fb46cc8ed6549598a2d87de/plot_dcrt_example.zip index ebeda7c2..3b73f387 100644 Binary files a/docs/_downloads/117422582fb46cc8ed6549598a2d87de/plot_dcrt_example.zip and b/docs/_downloads/117422582fb46cc8ed6549598a2d87de/plot_dcrt_example.zip differ diff --git a/docs/_downloads/1a99dc8cb1c22f91072d67cf26fce26c/plot_knockoff_aggregation.zip b/docs/_downloads/1a99dc8cb1c22f91072d67cf26fce26c/plot_knockoff_aggregation.zip index 8480cd24..84ad1c1e 100644 Binary files a/docs/_downloads/1a99dc8cb1c22f91072d67cf26fce26c/plot_knockoff_aggregation.zip and b/docs/_downloads/1a99dc8cb1c22f91072d67cf26fce26c/plot_knockoff_aggregation.zip differ diff --git a/docs/_downloads/5ca231767268e6cd969e65225d673650/plot_fmri_data_example.zip b/docs/_downloads/5ca231767268e6cd969e65225d673650/plot_fmri_data_example.zip index 6ec44e93..598f0b91 100644 Binary files a/docs/_downloads/5ca231767268e6cd969e65225d673650/plot_fmri_data_example.zip and b/docs/_downloads/5ca231767268e6cd969e65225d673650/plot_fmri_data_example.zip differ diff --git a/docs/_downloads/642b61154cca48af8e3feb505b920e16/plot_dcrt_example.ipynb b/docs/_downloads/642b61154cca48af8e3feb505b920e16/plot_dcrt_example.ipynb index c77112f2..9e14f022 100644 --- a/docs/_downloads/642b61154cca48af8e3feb505b920e16/plot_dcrt_example.ipynb +++ b/docs/_downloads/642b61154cca48af8e3feb505b920e16/plot_dcrt_example.ipynb @@ -78,7 +78,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/docs/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip b/docs/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip index 9da38a34..7df92cac 100644 Binary files a/docs/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip and b/docs/_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip differ diff --git a/docs/_downloads/707d94040f5ada342e781499193f46f1/plot_diabetes_variable_importance_example.zip b/docs/_downloads/707d94040f5ada342e781499193f46f1/plot_diabetes_variable_importance_example.zip index b712725e..3a2f3aa6 100644 Binary files a/docs/_downloads/707d94040f5ada342e781499193f46f1/plot_diabetes_variable_importance_example.zip and b/docs/_downloads/707d94040f5ada342e781499193f46f1/plot_diabetes_variable_importance_example.zip differ diff --git a/docs/_downloads/76c0979bf6618aa210fd11bb28dcf896/plot_fmri_data_example.py b/docs/_downloads/76c0979bf6618aa210fd11bb28dcf896/plot_fmri_data_example.py index 25b89b81..92c6936c 100644 --- a/docs/_downloads/76c0979bf6618aa210fd11bb28dcf896/plot_fmri_data_example.py +++ b/docs/_downloads/76c0979bf6618aa210fd11bb28dcf896/plot_fmri_data_example.py @@ -52,15 +52,18 @@ from sklearn.cluster import FeatureAgglomeration from sklearn.feature_extraction import image from sklearn.linear_model import Ridge +from sklearn.svm import LinearSVR from sklearn.utils import Bunch -from hidimstat.adaptive_permutation_threshold import ada_svr +from hidimstat.ada_svr import ada_svr from hidimstat.clustered_inference import clustered_inference from hidimstat.ensemble_clustered_inference import ensemble_clustered_inference -from hidimstat.permutation_test import permutation_test, permutation_test_cv +from hidimstat.permutation_test import permutation_test, permutation_test_pval from hidimstat.standardized_svr import standardized_svr from hidimstat.stat_tools import pval_from_scale, zscore_from_pval +n_job = None + ############################################################################# # Function to fetch and preprocess Haxby dataset @@ -151,19 +154,28 @@ def preprocess_haxby(subject=2, memory=None): SVR_permutation_test_inference = False if SVR_permutation_test_inference: - # We computed the regularization parameter by CV (C = 0.1) - pval_corr_svr_perm_test, one_minus_pval_corr_svr_perm_test = permutation_test_cv( - X, y, n_permutations=50, C=0.1 + # It will be better to associate cross validation with the estimator + # but for a sake of time, this is not done. + estimator = LinearSVR() + weight_svr, weight_svr_distribution = permutation_test( + X, y, estimator, n_permutations=50 + ) + pval_corr_svr_perm_test, one_minus_pval_corr_svr_perm_test = permutation_test_pval( + weight_svr, weight_svr_distribution ) # Another method is to compute the p-values by permutation test from the # Ridge decoder. The solution provided by this method should be very close to # the previous one and the computation time is much shorter: around 20 seconds. - +# We computed the parameter from a cross valisation (alpha = 0.0215) +# It will be better to use RidgeCV but for a sake of time, this is not done. estimator = Ridge() -pval_corr_ridge_perm_test, one_minus_pval_corr_ridge_perm_test = permutation_test( +weight_ridge, weight_ridge_distribution = permutation_test( X, y, estimator=estimator, n_permutations=200 ) +pval_corr_ridge_perm_test, one_minus_pval_corr_ridge_perm_test = permutation_test_pval( + weight_ridge, weight_ridge_distribution +) ############################################################################# # Now, let us run the algorithm introduced by Gaonkar et al. (c.f. References). @@ -305,4 +317,4 @@ def plot_map( # (EnCluDL) seems realistic as we recover the visual cortex and do not make # spurious discoveries. -show() +# show() diff --git a/docs/_downloads/7d2770a07fbe419760c9ac177df4f69e/plot_2D_simulation_example.ipynb b/docs/_downloads/7d2770a07fbe419760c9ac177df4f69e/plot_2D_simulation_example.ipynb index ef338cab..6e755c1d 100644 --- a/docs/_downloads/7d2770a07fbe419760c9ac177df4f69e/plot_2D_simulation_example.ipynb +++ b/docs/_downloads/7d2770a07fbe419760c9ac177df4f69e/plot_2D_simulation_example.ipynb @@ -240,7 +240,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/docs/_downloads/8635bd4b58b2828c710e4331f35d14f6/plot_knockoff_aggregation.ipynb b/docs/_downloads/8635bd4b58b2828c710e4331f35d14f6/plot_knockoff_aggregation.ipynb index 18078a4c..b462549a 100644 --- a/docs/_downloads/8635bd4b58b2828c710e4331f35d14f6/plot_knockoff_aggregation.ipynb +++ b/docs/_downloads/8635bd4b58b2828c710e4331f35d14f6/plot_knockoff_aggregation.ipynb @@ -42,7 +42,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/docs/_downloads/931385a6992917f918857d6a3ee9f780/plot_fmri_data_example.ipynb b/docs/_downloads/931385a6992917f918857d6a3ee9f780/plot_fmri_data_example.ipynb index 69c0e058..bee59e0c 100644 --- a/docs/_downloads/931385a6992917f918857d6a3ee9f780/plot_fmri_data_example.ipynb +++ b/docs/_downloads/931385a6992917f918857d6a3ee9f780/plot_fmri_data_example.ipynb @@ -22,7 +22,7 @@ }, "outputs": [], "source": [ - "import numpy as np\nimport pandas as pd\nfrom nilearn import datasets\nfrom nilearn.image import mean_img\nfrom nilearn.input_data import NiftiMasker\nfrom nilearn.plotting import plot_stat_map, show\nfrom sklearn.cluster import FeatureAgglomeration\nfrom sklearn.feature_extraction import image\nfrom sklearn.linear_model import Ridge\nfrom sklearn.utils import Bunch\n\nfrom hidimstat.adaptive_permutation_threshold import ada_svr\nfrom hidimstat.clustered_inference import clustered_inference\nfrom hidimstat.ensemble_clustered_inference import ensemble_clustered_inference\nfrom hidimstat.permutation_test import permutation_test, permutation_test_cv\nfrom hidimstat.standardized_svr import standardized_svr\nfrom hidimstat.stat_tools import pval_from_scale, zscore_from_pval" + "import numpy as np\nimport pandas as pd\nfrom nilearn import datasets\nfrom nilearn.image import mean_img\nfrom nilearn.input_data import NiftiMasker\nfrom nilearn.plotting import plot_stat_map, show\nfrom sklearn.cluster import FeatureAgglomeration\nfrom sklearn.feature_extraction import image\nfrom sklearn.linear_model import Ridge\nfrom sklearn.svm import LinearSVR\nfrom sklearn.utils import Bunch\n\nfrom hidimstat.ada_svr import ada_svr\nfrom hidimstat.clustered_inference import clustered_inference\nfrom hidimstat.ensemble_clustered_inference import ensemble_clustered_inference\nfrom hidimstat.permutation_test import permutation_test, permutation_test_pval\nfrom hidimstat.standardized_svr import standardized_svr\nfrom hidimstat.stat_tools import pval_from_scale, zscore_from_pval\n\nn_job = None" ] }, { @@ -119,7 +119,7 @@ }, "outputs": [], "source": [ - "# To derive the p-values from the SVR decoder, you may change the next line by\n# `SVR_permutation_test_inference = True`. It should take around 15 minutes.\n\nSVR_permutation_test_inference = False\nif SVR_permutation_test_inference:\n # We computed the regularization parameter by CV (C = 0.1)\n pval_corr_svr_perm_test, one_minus_pval_corr_svr_perm_test = permutation_test_cv(\n X, y, n_permutations=50, C=0.1\n )\n\n# Another method is to compute the p-values by permutation test from the\n# Ridge decoder. The solution provided by this method should be very close to\n# the previous one and the computation time is much shorter: around 20 seconds.\n\nestimator = Ridge()\npval_corr_ridge_perm_test, one_minus_pval_corr_ridge_perm_test = permutation_test(\n X, y, estimator=estimator, n_permutations=200\n)" + "# To derive the p-values from the SVR decoder, you may change the next line by\n# `SVR_permutation_test_inference = True`. It should take around 15 minutes.\n\nSVR_permutation_test_inference = False\nif SVR_permutation_test_inference:\n # It will be better to associate cross validation with the estimator\n # but for a sake of time, this is not done.\n estimator = LinearSVR()\n weight_svr, weight_svr_distribution = permutation_test(\n X, y, estimator, n_permutations=50\n )\n pval_corr_svr_perm_test, one_minus_pval_corr_svr_perm_test = permutation_test_pval(\n weight_svr, weight_svr_distribution\n )\n\n# Another method is to compute the p-values by permutation test from the\n# Ridge decoder. The solution provided by this method should be very close to\n# the previous one and the computation time is much shorter: around 20 seconds.\n# We computed the parameter from a cross valisation (alpha = 0.0215)\n# It will be better to use RidgeCV but for a sake of time, this is not done.\nestimator = Ridge()\nweight_ridge, weight_ridge_distribution = permutation_test(\n X, y, estimator=estimator, n_permutations=200\n)\npval_corr_ridge_perm_test, one_minus_pval_corr_ridge_perm_test = permutation_test_pval(\n weight_ridge, weight_ridge_distribution\n)" ] }, { @@ -281,7 +281,7 @@ }, "outputs": [], "source": [ - "show()" + "# show()" ] } ], @@ -301,7 +301,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/docs/_downloads/a70e28075a283d5e3fe675ced733c459/plot_diabetes_variable_importance_example.ipynb b/docs/_downloads/a70e28075a283d5e3fe675ced733c459/plot_diabetes_variable_importance_example.ipynb index 828cd728..fdfa9b99 100644 --- a/docs/_downloads/a70e28075a283d5e3fe675ced733c459/plot_diabetes_variable_importance_example.ipynb +++ b/docs/_downloads/a70e28075a283d5e3fe675ced733c459/plot_diabetes_variable_importance_example.ipynb @@ -186,7 +186,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/docs/_downloads/c983a5ad5887eff1a3df617cbd64234a/plot_variable_importance_classif.ipynb b/docs/_downloads/c983a5ad5887eff1a3df617cbd64234a/plot_variable_importance_classif.ipynb index 8485656b..4aa65391 100644 --- a/docs/_downloads/c983a5ad5887eff1a3df617cbd64234a/plot_variable_importance_classif.ipynb +++ b/docs/_downloads/c983a5ad5887eff1a3df617cbd64234a/plot_variable_importance_classif.ipynb @@ -132,7 +132,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.8" + "version": "3.12.9" } }, "nbformat": 4, diff --git a/docs/_downloads/e08c0f6d4aade0f0eaf8ba56dbbfd9c9/plot_2D_simulation_example.zip b/docs/_downloads/e08c0f6d4aade0f0eaf8ba56dbbfd9c9/plot_2D_simulation_example.zip index 240c0c6d..c6638cb1 100644 Binary files a/docs/_downloads/e08c0f6d4aade0f0eaf8ba56dbbfd9c9/plot_2D_simulation_example.zip and b/docs/_downloads/e08c0f6d4aade0f0eaf8ba56dbbfd9c9/plot_2D_simulation_example.zip differ diff --git a/docs/_sources/api.rst.txt b/docs/_sources/api.rst.txt index 885873f3..13937444 100644 --- a/docs/_sources/api.rst.txt +++ b/docs/_sources/api.rst.txt @@ -26,7 +26,8 @@ Functions knockoff_aggregation model_x_knockoff multivariate_1D_simulation - permutation_test_cv + permutation_test + permutation_test_pval reid standardized_svr zscore_from_pval diff --git a/docs/_sources/auto_examples/plot_2D_simulation_example.rst.txt b/docs/_sources/auto_examples/plot_2D_simulation_example.rst.txt index b97aba27..9ee5c5e6 100644 --- a/docs/_sources/auto_examples/plot_2D_simulation_example.rst.txt +++ b/docs/_sources/auto_examples/plot_2D_simulation_example.rst.txt @@ -554,9 +554,9 @@ randomization. .. rst-class:: sphx-glr-timing - **Total running time of the script:** (1 minutes 5.243 seconds) + **Total running time of the script:** (1 minutes 5.593 seconds) -**Estimated memory usage:** 701 MB +**Estimated memory usage:** 722 MB .. _sphx_glr_download_auto_examples_plot_2D_simulation_example.py: diff --git a/docs/_sources/auto_examples/plot_dcrt_example.rst.txt b/docs/_sources/auto_examples/plot_dcrt_example.rst.txt index 81a263d6..8b44d8cc 100644 --- a/docs/_sources/auto_examples/plot_dcrt_example.rst.txt +++ b/docs/_sources/auto_examples/plot_dcrt_example.rst.txt @@ -162,9 +162,9 @@ Plotting the comparison .. rst-class:: sphx-glr-timing - **Total running time of the script:** (1 minutes 2.810 seconds) + **Total running time of the script:** (1 minutes 2.729 seconds) -**Estimated memory usage:** 638 MB +**Estimated memory usage:** 658 MB .. _sphx_glr_download_auto_examples_plot_dcrt_example.py: diff --git a/docs/_sources/auto_examples/plot_diabetes_variable_importance_example.rst.txt b/docs/_sources/auto_examples/plot_diabetes_variable_importance_example.rst.txt index 31b91821..b615aede 100644 --- a/docs/_sources/auto_examples/plot_diabetes_variable_importance_example.rst.txt +++ b/docs/_sources/auto_examples/plot_diabetes_variable_importance_example.rst.txt @@ -491,9 +491,9 @@ Analyze the results .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 8.765 seconds) + **Total running time of the script:** (0 minutes 8.186 seconds) -**Estimated memory usage:** 623 MB +**Estimated memory usage:** 643 MB .. _sphx_glr_download_auto_examples_plot_diabetes_variable_importance_example.py: diff --git a/docs/_sources/auto_examples/plot_fmri_data_example.rst.txt b/docs/_sources/auto_examples/plot_fmri_data_example.rst.txt index a2d24891..d4919215 100644 --- a/docs/_sources/auto_examples/plot_fmri_data_example.rst.txt +++ b/docs/_sources/auto_examples/plot_fmri_data_example.rst.txt @@ -63,7 +63,7 @@ References Imports needed for this script ------------------------------ -.. GENERATED FROM PYTHON SOURCE LINES 46-65 +.. GENERATED FROM PYTHON SOURCE LINES 46-68 .. code-block:: Python @@ -76,15 +76,17 @@ Imports needed for this script from sklearn.cluster import FeatureAgglomeration from sklearn.feature_extraction import image from sklearn.linear_model import Ridge + from sklearn.svm import LinearSVR from sklearn.utils import Bunch - from hidimstat.adaptive_permutation_threshold import ada_svr + from hidimstat.ada_svr import ada_svr from hidimstat.clustered_inference import clustered_inference from hidimstat.ensemble_clustered_inference import ensemble_clustered_inference - from hidimstat.permutation_test import permutation_test, permutation_test_cv + from hidimstat.permutation_test import permutation_test, permutation_test_pval from hidimstat.standardized_svr import standardized_svr from hidimstat.stat_tools import pval_from_scale, zscore_from_pval + n_job = None @@ -93,12 +95,13 @@ Imports needed for this script -.. GENERATED FROM PYTHON SOURCE LINES 66-68 + +.. GENERATED FROM PYTHON SOURCE LINES 69-71 Function to fetch and preprocess Haxby dataset ---------------------------------------------- -.. GENERATED FROM PYTHON SOURCE LINES 68-106 +.. GENERATED FROM PYTHON SOURCE LINES 71-109 .. code-block:: Python @@ -147,7 +150,7 @@ Function to fetch and preprocess Haxby dataset -.. GENERATED FROM PYTHON SOURCE LINES 107-114 +.. GENERATED FROM PYTHON SOURCE LINES 110-117 Gathering and preprocessing Haxby dataset for a given subject ------------------------------------------------------------- @@ -157,7 +160,7 @@ it outputs the preprocessed activation maps for the two conditions the session labels (in `groups`) and the mask (in `masker`). You may choose a subject in [1, 2, 3, 4, 5, 6]. By default subject=2. -.. GENERATED FROM PYTHON SOURCE LINES 114-118 +.. GENERATED FROM PYTHON SOURCE LINES 117-121 .. code-block:: Python @@ -182,28 +185,28 @@ You may choose a subject in [1, 2, 3, 4, 5, 6]. By default subject=2. [fetch_single_file] ...done. (0 seconds, 0 min) [fetch_single_file] Downloading data from http://data.pymvpa.org/datasets/haxby2001/subj2-2010.01.14.tar.gz ... - [_chunk_report_] Downloaded 84115456 of 291168628 bytes (28.9%%, 2.5s remaining) - [_chunk_report_] Downloaded 187072512 of 291168628 bytes (64.2%%, 1.1s remaining) + [_chunk_report_] Downloaded 94011392 of 291168628 bytes (32.3%%, 2.1s remaining) + [_chunk_report_] Downloaded 212819968 of 291168628 bytes (73.1%%, 0.7s remaining) [fetch_single_file] ...done. (3 seconds, 0 min) [uncompress_file] Extracting data from /home/runner/nilearn_data/haxby2001/9cabe068089e791ef0c5fe930fc20e30/subj2-2010.01.14.tar.gz... [uncompress_file] .. done. - /home/runner/work/hidimstat/hidimstat/examples/plot_fmri_data_example.py:88: FutureWarning: From release 0.13.0 onwards, this function will, by default, copy the header of the input image to the output. Currently, the header is reset to the default Nifti1Header. To suppress this warning and use the new behavior, set `copy_header=True`. + /home/runner/work/hidimstat/hidimstat/examples/plot_fmri_data_example.py:91: FutureWarning: From release 0.13.0 onwards, this function will, by default, copy the header of the input image to the output. Currently, the header is reset to the default Nifti1Header. To suppress this warning and use the new behavior, set `copy_header=True`. bg_img = mean_img(haxby_dataset.anat) - /opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/nilearn/image/resampling.py:489: UserWarning: The provided image has no sform in its header. Please check the provided file. Results may not be as expected. + /opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/nilearn/image/resampling.py:489: UserWarning: The provided image has no sform in its header. Please check the provided file. Results may not be as expected. warnings.warn( -.. GENERATED FROM PYTHON SOURCE LINES 119-122 +.. GENERATED FROM PYTHON SOURCE LINES 122-125 Initializing FeatureAgglomeration object that performs the clustering ------------------------------------------------------------------------- For fMRI data taking 500 clusters is generally a good default choice. -.. GENERATED FROM PYTHON SOURCE LINES 122-131 +.. GENERATED FROM PYTHON SOURCE LINES 125-134 .. code-block:: Python @@ -223,18 +226,18 @@ For fMRI data taking 500 clusters is generally a good default choice. -.. GENERATED FROM PYTHON SOURCE LINES 132-134 +.. GENERATED FROM PYTHON SOURCE LINES 135-137 Making the inference with several algorithms -------------------------------------------- -.. GENERATED FROM PYTHON SOURCE LINES 136-139 +.. GENERATED FROM PYTHON SOURCE LINES 139-142 First, we try to recover the discriminative partern by computing p-values from SVR decoder weights and a parametric approximation of the distribution of these weights. -.. GENERATED FROM PYTHON SOURCE LINES 139-145 +.. GENERATED FROM PYTHON SOURCE LINES 142-148 .. code-block:: Python @@ -251,12 +254,12 @@ of the distribution of these weights. -.. GENERATED FROM PYTHON SOURCE LINES 146-148 +.. GENERATED FROM PYTHON SOURCE LINES 149-151 Now, we compute p-values thanks to permutation tests applied to 1/the weights of the SVR decoder or 2/the weights of the Ridge decoder. -.. GENERATED FROM PYTHON SOURCE LINES 148-168 +.. GENERATED FROM PYTHON SOURCE LINES 151-180 .. code-block:: Python @@ -266,42 +269,44 @@ Now, we compute p-values thanks to permutation tests applied to SVR_permutation_test_inference = False if SVR_permutation_test_inference: - # We computed the regularization parameter by CV (C = 0.1) - pval_corr_svr_perm_test, one_minus_pval_corr_svr_perm_test = permutation_test_cv( - X, y, n_permutations=50, C=0.1 + # It will be better to associate cross validation with the estimator + # but for a sake of time, this is not done. + estimator = LinearSVR() + weight_svr, weight_svr_distribution = permutation_test( + X, y, estimator, n_permutations=50 + ) + pval_corr_svr_perm_test, one_minus_pval_corr_svr_perm_test = permutation_test_pval( + weight_svr, weight_svr_distribution ) # Another method is to compute the p-values by permutation test from the # Ridge decoder. The solution provided by this method should be very close to # the previous one and the computation time is much shorter: around 20 seconds. - + # We computed the parameter from a cross valisation (alpha = 0.0215) + # It will be better to use RidgeCV but for a sake of time, this is not done. estimator = Ridge() - pval_corr_ridge_perm_test, one_minus_pval_corr_ridge_perm_test = permutation_test( + weight_ridge, weight_ridge_distribution = permutation_test( X, y, estimator=estimator, n_permutations=200 ) + pval_corr_ridge_perm_test, one_minus_pval_corr_ridge_perm_test = permutation_test_pval( + weight_ridge, weight_ridge_distribution + ) -.. rst-class:: sphx-glr-script-out - - .. code-block:: none - [Parallel(n_jobs=1)]: Done 49 tasks | elapsed: 1.6s - [Parallel(n_jobs=1)]: Done 199 tasks | elapsed: 6.6s - - -.. GENERATED FROM PYTHON SOURCE LINES 169-173 +.. GENERATED FROM PYTHON SOURCE LINES 181-185 Now, let us run the algorithm introduced by Gaonkar et al. (c.f. References). Since the estimator they derive is obtained by approximating the hard margin SVM formulation, we referred to this method as "ada-SVR" which stands for "Adaptive Permutation Threshold SVR". The function is ``ada_svr``. -.. GENERATED FROM PYTHON SOURCE LINES 173-176 +.. GENERATED FROM PYTHON SOURCE LINES 185-188 .. code-block:: Python @@ -315,12 +320,12 @@ SVM formulation, we referred to this method as "ada-SVR" which stands for -.. GENERATED FROM PYTHON SOURCE LINES 177-179 +.. GENERATED FROM PYTHON SOURCE LINES 189-191 Now, the clustered inference algorithm which combines parcellation and high-dimensional inference (c.f. References). -.. GENERATED FROM PYTHON SOURCE LINES 179-183 +.. GENERATED FROM PYTHON SOURCE LINES 191-195 .. code-block:: Python @@ -337,13 +342,13 @@ and high-dimensional inference (c.f. References). .. code-block:: none Clustered inference: n_clusters = 500, inference method = desparsified-lasso, seed = 0 - /opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/sklearn/linear_model/_coordinate_descent.py:681: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.7422256933791083, tolerance: 0.21600000000000003 + /opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/sklearn/linear_model/_coordinate_descent.py:681: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.7422256933791083, tolerance: 0.21600000000000003 model = cd_fast.enet_coordinate_descent_gram( -.. GENERATED FROM PYTHON SOURCE LINES 184-191 +.. GENERATED FROM PYTHON SOURCE LINES 196-203 Below, we run the ensemble clustered inference algorithm which adds a randomization step over the clustered inference algorithm (c.f. References). @@ -353,7 +358,7 @@ then 5 statistical maps are produced and aggregated into one. However you might benefit from clustering randomization taking `n_bootstraps=25` or `n_bootstraps=100`, also we set `n_jobs=2`. -.. GENERATED FROM PYTHON SOURCE LINES 191-195 +.. GENERATED FROM PYTHON SOURCE LINES 203-207 .. code-block:: Python @@ -370,12 +375,12 @@ However you might benefit from clustering randomization taking .. code-block:: none [Parallel(n_jobs=2)]: Using backend LokyBackend with 2 concurrent workers. - [Parallel(n_jobs=2)]: Done 5 out of 5 | elapsed: 34.2s finished + [Parallel(n_jobs=2)]: Done 5 out of 5 | elapsed: 32.0s finished -.. GENERATED FROM PYTHON SOURCE LINES 196-204 +.. GENERATED FROM PYTHON SOURCE LINES 208-216 Plotting the results -------------------- @@ -386,7 +391,7 @@ inverse survival function. First, we set theoretical FWER target at 10%. -.. GENERATED FROM PYTHON SOURCE LINES 204-208 +.. GENERATED FROM PYTHON SOURCE LINES 216-220 .. code-block:: Python @@ -401,13 +406,13 @@ First, we set theoretical FWER target at 10%. -.. GENERATED FROM PYTHON SOURCE LINES 209-212 +.. GENERATED FROM PYTHON SOURCE LINES 221-224 We now translate the FWER target into a z-score target. For the permutation test methods we do not need any additional correction since the p-values are already adjusted for multiple testing. -.. GENERATED FROM PYTHON SOURCE LINES 212-215 +.. GENERATED FROM PYTHON SOURCE LINES 224-227 .. code-block:: Python @@ -421,13 +426,13 @@ since the p-values are already adjusted for multiple testing. -.. GENERATED FROM PYTHON SOURCE LINES 216-219 +.. GENERATED FROM PYTHON SOURCE LINES 228-231 Other methods need to be corrected. We consider the Bonferroni correction. For methods that do not reduce the feature space, the correction consists in dividing by the number of features. -.. GENERATED FROM PYTHON SOURCE LINES 219-223 +.. GENERATED FROM PYTHON SOURCE LINES 231-235 .. code-block:: Python @@ -442,12 +447,12 @@ consists in dividing by the number of features. -.. GENERATED FROM PYTHON SOURCE LINES 224-226 +.. GENERATED FROM PYTHON SOURCE LINES 236-238 For methods that parcelates the brain into groups of voxels, the correction consists in dividing by the number of parcels (or clusters). -.. GENERATED FROM PYTHON SOURCE LINES 226-230 +.. GENERATED FROM PYTHON SOURCE LINES 238-242 .. code-block:: Python @@ -462,14 +467,14 @@ consists in dividing by the number of parcels (or clusters). -.. GENERATED FROM PYTHON SOURCE LINES 231-235 +.. GENERATED FROM PYTHON SOURCE LINES 243-247 Now, we can plot the thresholded z-score maps by translating the p-value maps estimated previously into z-score maps and using the suitable threshold. For a better readability, we make a small function called `plot_map` that wraps all these steps. -.. GENERATED FROM PYTHON SOURCE LINES 235-292 +.. GENERATED FROM PYTHON SOURCE LINES 247-304 .. code-block:: Python @@ -576,13 +581,13 @@ called `plot_map` that wraps all these steps. .. code-block:: none - /opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/nilearn/plotting/displays/_slicers.py:313: UserWarning: empty mask + /opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/nilearn/plotting/displays/_slicers.py:313: UserWarning: empty mask ims = self._map_show(img, type="imshow", threshold=threshold, **kwargs) -.. GENERATED FROM PYTHON SOURCE LINES 293-307 +.. GENERATED FROM PYTHON SOURCE LINES 305-319 Analysis of the results ----------------------- @@ -599,12 +604,12 @@ Finally, the solution provided by the ensemble clustered inference algorithm (EnCluDL) seems realistic as we recover the visual cortex and do not make spurious discoveries. -.. GENERATED FROM PYTHON SOURCE LINES 307-309 +.. GENERATED FROM PYTHON SOURCE LINES 319-321 .. code-block:: Python - show() + # show() @@ -615,9 +620,9 @@ spurious discoveries. .. rst-class:: sphx-glr-timing - **Total running time of the script:** (1 minutes 27.619 seconds) + **Total running time of the script:** (1 minutes 23.795 seconds) -**Estimated memory usage:** 3365 MB +**Estimated memory usage:** 3287 MB .. _sphx_glr_download_auto_examples_plot_fmri_data_example.py: diff --git a/docs/_sources/auto_examples/plot_knockoff_aggregation.rst.txt b/docs/_sources/auto_examples/plot_knockoff_aggregation.rst.txt index abcbc376..2304b1e7 100644 --- a/docs/_sources/auto_examples/plot_knockoff_aggregation.rst.txt +++ b/docs/_sources/auto_examples/plot_knockoff_aggregation.rst.txt @@ -205,9 +205,9 @@ Imports needed for this script .. rst-class:: sphx-glr-timing - **Total running time of the script:** (5 minutes 39.528 seconds) + **Total running time of the script:** (5 minutes 40.613 seconds) -**Estimated memory usage:** 815 MB +**Estimated memory usage:** 841 MB .. _sphx_glr_download_auto_examples_plot_knockoff_aggregation.py: diff --git a/docs/_sources/auto_examples/plot_variable_importance_classif.rst.txt b/docs/_sources/auto_examples/plot_variable_importance_classif.rst.txt index a720f06c..438937e9 100644 --- a/docs/_sources/auto_examples/plot_variable_importance_classif.rst.txt +++ b/docs/_sources/auto_examples/plot_variable_importance_classif.rst.txt @@ -176,7 +176,7 @@ Visualize the data .. code-block:: none - [, , , , , , , , , ] + [, , , , , , , , , ] @@ -287,7 +287,7 @@ estimate the importance of the features. .. code-block:: none - /opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/joblib/externals/loky/process_executor.py:752: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak. + /opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/joblib/externals/loky/process_executor.py:752: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak. warnings.warn( @@ -422,16 +422,16 @@ the features. .. code-block:: none - + .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 44.777 seconds) + **Total running time of the script:** (0 minutes 42.709 seconds) -**Estimated memory usage:** 619 MB +**Estimated memory usage:** 639 MB .. _sphx_glr_download_auto_examples_plot_variable_importance_classif.py: diff --git a/docs/_sources/auto_examples/sg_execution_times.rst.txt b/docs/_sources/auto_examples/sg_execution_times.rst.txt index 64a7c0e3..5fc9fcbf 100644 --- a/docs/_sources/auto_examples/sg_execution_times.rst.txt +++ b/docs/_sources/auto_examples/sg_execution_times.rst.txt @@ -6,7 +6,7 @@ Computation times ================= -**10:08.743** total execution time for 6 files **from auto_examples**: +**10:03.624** total execution time for 6 files **from auto_examples**: .. container:: @@ -33,20 +33,20 @@ Computation times - Time - Mem (MB) * - :ref:`sphx_glr_auto_examples_plot_knockoff_aggregation.py` (``plot_knockoff_aggregation.py``) - - 05:39.528 - - 814.6 + - 05:40.613 + - 841.3 * - :ref:`sphx_glr_auto_examples_plot_fmri_data_example.py` (``plot_fmri_data_example.py``) - - 01:27.619 - - 3365.0 + - 01:23.795 + - 3287.3 * - :ref:`sphx_glr_auto_examples_plot_2D_simulation_example.py` (``plot_2D_simulation_example.py``) - - 01:05.243 - - 701.4 + - 01:05.593 + - 722.1 * - :ref:`sphx_glr_auto_examples_plot_dcrt_example.py` (``plot_dcrt_example.py``) - - 01:02.810 - - 637.9 + - 01:02.729 + - 658.2 * - :ref:`sphx_glr_auto_examples_plot_variable_importance_classif.py` (``plot_variable_importance_classif.py``) - - 00:44.777 - - 618.6 + - 00:42.709 + - 639.3 * - :ref:`sphx_glr_auto_examples_plot_diabetes_variable_importance_example.py` (``plot_diabetes_variable_importance_example.py``) - - 00:08.765 - - 622.7 + - 00:08.186 + - 643.0 diff --git a/docs/_sources/generated/hidimstat.permutation_test.rst.txt b/docs/_sources/generated/hidimstat.permutation_test.rst.txt new file mode 100644 index 00000000..d5b6dab2 --- /dev/null +++ b/docs/_sources/generated/hidimstat.permutation_test.rst.txt @@ -0,0 +1,6 @@ +hidimstat.permutation\_test +=========================== + +.. currentmodule:: hidimstat + +.. autofunction:: permutation_test \ No newline at end of file diff --git a/docs/_sources/generated/hidimstat.permutation_test_cv.rst.txt b/docs/_sources/generated/hidimstat.permutation_test_cv.rst.txt deleted file mode 100644 index f300d673..00000000 --- a/docs/_sources/generated/hidimstat.permutation_test_cv.rst.txt +++ /dev/null @@ -1,6 +0,0 @@ -hidimstat.permutation\_test\_cv -=============================== - -.. currentmodule:: hidimstat - -.. autofunction:: permutation_test_cv \ No newline at end of file diff --git a/docs/_sources/generated/hidimstat.permutation_test_pval.rst.txt b/docs/_sources/generated/hidimstat.permutation_test_pval.rst.txt new file mode 100644 index 00000000..806523c0 --- /dev/null +++ b/docs/_sources/generated/hidimstat.permutation_test_pval.rst.txt @@ -0,0 +1,6 @@ +hidimstat.permutation\_test\_pval +================================= + +.. currentmodule:: hidimstat + +.. autofunction:: permutation_test_pval \ No newline at end of file diff --git a/docs/_sources/index.rst.txt b/docs/_sources/index.rst.txt index 2eb52245..171428bf 100644 --- a/docs/_sources/index.rst.txt +++ b/docs/_sources/index.rst.txt @@ -37,6 +37,9 @@ HiDimStat depends on the following packages:: numpy scipy scikit-learn + pandas + torch + torchmetrics To run examples it is neccessary to install ``matplotlib``, and to run tests it @@ -71,8 +74,8 @@ To build the documentation you will need to run: .. code-block:: - pip install -U sphinx_gallery sphinx_bootstrap_theme - cd doc + pip install -U .[doc] + cd doc_conf make html diff --git a/docs/_sources/sg_execution_times.rst.txt b/docs/_sources/sg_execution_times.rst.txt index f1d74ef2..9122dec7 100644 --- a/docs/_sources/sg_execution_times.rst.txt +++ b/docs/_sources/sg_execution_times.rst.txt @@ -6,7 +6,7 @@ Computation times ================= -**10:08.743** total execution time for 6 files **from all galleries**: +**10:03.624** total execution time for 6 files **from all galleries**: .. container:: @@ -33,20 +33,20 @@ Computation times - Time - Mem (MB) * - :ref:`sphx_glr_auto_examples_plot_knockoff_aggregation.py` (``../examples/plot_knockoff_aggregation.py``) - - 05:39.528 - - 814.6 + - 05:40.613 + - 841.3 * - :ref:`sphx_glr_auto_examples_plot_fmri_data_example.py` (``../examples/plot_fmri_data_example.py``) - - 01:27.619 - - 3365.0 + - 01:23.795 + - 3287.3 * - :ref:`sphx_glr_auto_examples_plot_2D_simulation_example.py` (``../examples/plot_2D_simulation_example.py``) - - 01:05.243 - - 701.4 + - 01:05.593 + - 722.1 * - :ref:`sphx_glr_auto_examples_plot_dcrt_example.py` (``../examples/plot_dcrt_example.py``) - - 01:02.810 - - 637.9 + - 01:02.729 + - 658.2 * - :ref:`sphx_glr_auto_examples_plot_variable_importance_classif.py` (``../examples/plot_variable_importance_classif.py``) - - 00:44.777 - - 618.6 + - 00:42.709 + - 639.3 * - :ref:`sphx_glr_auto_examples_plot_diabetes_variable_importance_example.py` (``../examples/plot_diabetes_variable_importance_example.py``) - - 00:08.765 - - 622.7 + - 00:08.186 + - 643.0 diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 27d261e8..fafe80e6 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,5 +1,5 @@ const DOCUMENTATION_OPTIONS = { - VERSION: '0.1.dev1+g19e6cf7', + VERSION: '0.1.dev1+g349ade8', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/api.html b/docs/api.html index ed8f9f87..a521dac1 100644 --- a/docs/api.html +++ b/docs/api.html @@ -5,7 +5,7 @@ - API Documentation — HiDimStat 0.1.dev1+g19e6cf7 documentation + API Documentation — HiDimStat 0.1.dev1+g349ade8 documentation @@ -13,7 +13,7 @@ - + @@ -133,7 +133,7 @@

Functions

ada_svr(X, y[, rcond])

-

Adaptative Permutation Threshold for SVR

+

ADA-SVR: Adaptive Permutation Threshold Support Vector Regression

aggregate_quantiles(list_one_sided_pval[, ...])

Aggregation of survival function values by adaptive quantile procedure

@@ -165,16 +165,19 @@

Functions

multivariate_1D_simulation([n_samples, ...])

Generate 1D data with Toeplitz design matrix

-

permutation_test_cv(X, y[, n_permutations, ...])

-

Cross-validated permutation test shuffling the target

+

permutation_test(X, y, estimator[, ...])

+

Permutation test

-

reid(X, y[, eps, tol, max_iter, n_jobs, seed])

+

permutation_test_pval(weights, ...)

+

Compute p-value from permutation test

+ +

reid(X, y[, eps, tol, max_iter, n_jobs, seed])

Estimation of noise standard deviation using Reid procedure

-

standardized_svr(X, y[, Cs, n_jobs])

+

standardized_svr(X, y[, Cs, n_jobs])

Cross-validated SVR

-

zscore_from_pval(pval[, one_minus_pval, distrib])

+

zscore_from_pval(pval[, one_minus_pval, distrib])

Computing z-scores from one-sided p-values.

diff --git a/docs/auto_examples/index.html b/docs/auto_examples/index.html index a956acdf..cbd8e3c7 100644 --- a/docs/auto_examples/index.html +++ b/docs/auto_examples/index.html @@ -5,7 +5,7 @@ - Examples Gallery — HiDimStat 0.1.dev1+g19e6cf7 documentation + Examples Gallery — HiDimStat 0.1.dev1+g349ade8 documentation @@ -13,7 +13,7 @@ - + diff --git a/docs/auto_examples/plot_2D_simulation_example.html b/docs/auto_examples/plot_2D_simulation_example.html index 873d4579..b64e2836 100644 --- a/docs/auto_examples/plot_2D_simulation_example.html +++ b/docs/auto_examples/plot_2D_simulation_example.html @@ -5,7 +5,7 @@ - Support recovery on simulated data (2D) — HiDimStat 0.1.dev1+g19e6cf7 documentation + Support recovery on simulated data (2D) — HiDimStat 0.1.dev1+g349ade8 documentation @@ -13,7 +13,7 @@ - + @@ -475,8 +475,8 @@

Analysis of the results -

Total running time of the script: (1 minutes 5.243 seconds)

-

Estimated memory usage: 701 MB

+

Total running time of the script: (1 minutes 5.593 seconds)

+

Estimated memory usage: 722 MB

-Type-I Error, Power

Total running time of the script: (1 minutes 2.810 seconds)

-

Estimated memory usage: 638 MB

+Type-I Error, Power

Total running time of the script: (1 minutes 2.729 seconds)

+

Estimated memory usage: 658 MB

-
[Parallel(n_jobs=1)]: Done  49 tasks      | elapsed:    1.6s
-[Parallel(n_jobs=1)]: Done 199 tasks      | elapsed:    6.6s
+pval_corr_ridge_perm_test, one_minus_pval_corr_ridge_perm_test = permutation_test_pval(
+    weight_ridge, weight_ridge_distribution
+)
 

Now, let us run the algorithm introduced by Gaonkar et al. (c.f. References). @@ -332,7 +340,7 @@

Making the inference with several algorithms
Clustered inference: n_clusters = 500, inference method = desparsified-lasso, seed = 0
-/opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/sklearn/linear_model/_coordinate_descent.py:681: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.7422256933791083, tolerance: 0.21600000000000003
+/opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/sklearn/linear_model/_coordinate_descent.py:681: ConvergenceWarning: Objective did not converge. You might want to increase the number of iterations. Duality gap: 1.7422256933791083, tolerance: 0.21600000000000003
   model = cd_fast.enet_coordinate_descent_gram(
 
@@ -349,7 +357,7 @@

Making the inference with several algorithms
[Parallel(n_jobs=2)]: Using backend LokyBackend with 2 concurrent workers.
-[Parallel(n_jobs=2)]: Done   5 out of   5 | elapsed:   34.2s finished
+[Parallel(n_jobs=2)]: Done   5 out of   5 | elapsed:   32.0s finished
 
@@ -450,7 +458,7 @@

Plotting the resultsplot fmri data example
  • plot fmri data example
  • -
    /opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/nilearn/plotting/displays/_slicers.py:313: UserWarning: empty mask
    +
    /opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/nilearn/plotting/displays/_slicers.py:313: UserWarning: empty mask
       ims = self._map_show(img, type="imshow", threshold=threshold, **kwargs)
     
    @@ -469,11 +477,11 @@

    Analysis of the results -
    show()
    +
    # show()
     
    -

    Total running time of the script: (1 minutes 27.619 seconds)

    -

    Estimated memory usage: 3365 MB

    +

    Total running time of the script: (1 minutes 23.795 seconds)

    +

    Estimated memory usage: 3287 MB

    -plot variable importance classif
    [<matplotlib.axis.YTick object at 0x7fa1fa109160>, <matplotlib.axis.YTick object at 0x7fa1fa1a36b0>, <matplotlib.axis.YTick object at 0x7fa1fb042330>, <matplotlib.axis.YTick object at 0x7fa1fb0406b0>, <matplotlib.axis.YTick object at 0x7fa1fb101820>, <matplotlib.axis.YTick object at 0x7fa1fb043e30>, <matplotlib.axis.YTick object at 0x7fa1fb0414c0>, <matplotlib.axis.YTick object at 0x7fa1f94ed1c0>, <matplotlib.axis.YTick object at 0x7fa1f94ef4a0>, <matplotlib.axis.YTick object at 0x7fa1fb0410d0>]
    +plot variable importance classif
    [<matplotlib.axis.YTick object at 0x7fef2ae3e660>, <matplotlib.axis.YTick object at 0x7fef2ae3eae0>, <matplotlib.axis.YTick object at 0x7fef1c38e780>, <matplotlib.axis.YTick object at 0x7fef1c38e660>, <matplotlib.axis.YTick object at 0x7fef1c38e990>, <matplotlib.axis.YTick object at 0x7fef1c38e060>, <matplotlib.axis.YTick object at 0x7fef2aee7710>, <matplotlib.axis.YTick object at 0x7fef2aee4aa0>, <matplotlib.axis.YTick object at 0x7fef2aee48c0>, <matplotlib.axis.YTick object at 0x7fef1c38c7d0>]
     
    @@ -338,7 +338,7 @@

    Variable importance inferenceimportance_arr = np.stack(importance_list)

    -
    /opt/hostedtoolcache/Python/3.12.8/x64/lib/python3.12/site-packages/joblib/externals/loky/process_executor.py:752: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak.
    +
    /opt/hostedtoolcache/Python/3.12.9/x64/lib/python3.12/site-packages/joblib/externals/loky/process_executor.py:752: UserWarning: A worker stopped while some jobs were given to the executor. This can be caused by a too short worker timeout or by a memory leak.
       warnings.warn(
     
    @@ -439,11 +439,11 @@

    Visualize the variable importanceax.legend(handles=handles + [important_legend, ground_truth_legend], loc="upper right")

    -plot variable importance classif
    <matplotlib.legend.Legend object at 0x7fa1f94f54c0>
    +plot variable importance classif
    <matplotlib.legend.Legend object at 0x7fef2ae82540>
     
    -

    Total running time of the script: (0 minutes 44.777 seconds)

    -

    Estimated memory usage: 619 MB

    +

    Total running time of the script: (0 minutes 42.709 seconds)

    +

    Estimated memory usage: 639 MB