Skip to content

Commit

Permalink
Dev docs nilearn/nilearn@bb3484f : [MAINT] Handle 2 numpy and matplol…
Browse files Browse the repository at this point in the history
…ib deprecation warnings (#4522)

* do not use matrix subclass

* rm deprecation warnings

* check if matplolib installed

* use tight_layout

* rm helper function
  • Loading branch information
actions-user committed Sep 5, 2024
1 parent 82ba8ab commit 73c47b6
Show file tree
Hide file tree
Showing 780 changed files with 3,814 additions and 3,868 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/2ce0f24d145edf0cb7091fe8dae3bd07/plot_carpet.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/44cb3a7d606fae23fb2b04d989cc6947/plot_hrf.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/4f6c009516d6956f180d8a05a141b383/plot_oasis.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@


# Fit one graph lasso per subject
try:
from sklearn.covariance import GraphicalLassoCV
except ImportError:
# for Scitkit-Learn < v0.20.0
from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
from sklearn.covariance import GraphicalLassoCV

gl = GraphicalLassoCV(verbose=1)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n\nfig = plt.figure(figsize=(10, 7))\nplt.subplots_adjust(hspace=0.4)\nfor n in range(n_displayed):\n ax = plt.subplot(n_displayed, 4, 4 * n + 1)\n max_precision = precisions[n].max()\n plotting.plot_matrix(\n precisions[n],\n vmin=-max_precision,\n vmax=max_precision,\n axes=ax,\n colorbar=False,\n )\n\n if n == 0:\n plt.title(\"ground truth\")\n plt.ylabel(f\"subject {int(n)}\")\n\n\n# Run group-sparse covariance on all subjects\nfrom nilearn.connectome import GroupSparseCovarianceCV\n\ngsc = GroupSparseCovarianceCV(max_iter=50, verbose=1)\ngsc.fit(subjects)\n\nfor n in range(n_displayed):\n ax = plt.subplot(n_displayed, 4, 4 * n + 2)\n max_precision = gsc.precisions_[..., n].max()\n plotting.plot_matrix(\n gsc.precisions_[..., n],\n axes=ax,\n vmin=-max_precision,\n vmax=max_precision,\n colorbar=False,\n )\n if n == 0:\n plt.title(f\"group-sparse\\n$\\\\alpha={gsc.alpha_:.2f}$\")\n\n\n# Fit one graph lasso per subject\ntry:\n from sklearn.covariance import GraphicalLassoCV\nexcept ImportError:\n # for Scitkit-Learn < v0.20.0\n from sklearn.covariance import GraphLassoCV as GraphicalLassoCV\n\ngl = GraphicalLassoCV(verbose=1)\n\nfor n, subject in enumerate(subjects[:n_displayed]):\n gl.fit(subject)\n\n ax = plt.subplot(n_displayed, 4, 4 * n + 3)\n max_precision = gl.precision_.max()\n plotting.plot_matrix(\n gl.precision_,\n axes=ax,\n vmin=-max_precision,\n vmax=max_precision,\n colorbar=False,\n )\n if n == 0:\n plt.title(\"graph lasso\")\n plt.ylabel(f\"$\\\\alpha={gl.alpha_:.2f}$\")\n\n\n# Fit one graph lasso for all subjects at once\nimport numpy as np\n\ngl.fit(np.concatenate(subjects))\n\nax = plt.subplot(n_displayed, 4, 4)\nmax_precision = gl.precision_.max()\nplotting.plot_matrix(\n gl.precision_,\n axes=ax,\n vmin=-max_precision,\n vmax=max_precision,\n colorbar=False,\n)\nplt.title(f\"graph lasso, all subjects\\n$\\\\alpha={gl.alpha_:.2f}$\")\n\nplotting.show()"
"import matplotlib.pyplot as plt\n\nfig = plt.figure(figsize=(10, 7))\nplt.subplots_adjust(hspace=0.4)\nfor n in range(n_displayed):\n ax = plt.subplot(n_displayed, 4, 4 * n + 1)\n max_precision = precisions[n].max()\n plotting.plot_matrix(\n precisions[n],\n vmin=-max_precision,\n vmax=max_precision,\n axes=ax,\n colorbar=False,\n )\n\n if n == 0:\n plt.title(\"ground truth\")\n plt.ylabel(f\"subject {int(n)}\")\n\n\n# Run group-sparse covariance on all subjects\nfrom nilearn.connectome import GroupSparseCovarianceCV\n\ngsc = GroupSparseCovarianceCV(max_iter=50, verbose=1)\ngsc.fit(subjects)\n\nfor n in range(n_displayed):\n ax = plt.subplot(n_displayed, 4, 4 * n + 2)\n max_precision = gsc.precisions_[..., n].max()\n plotting.plot_matrix(\n gsc.precisions_[..., n],\n axes=ax,\n vmin=-max_precision,\n vmax=max_precision,\n colorbar=False,\n )\n if n == 0:\n plt.title(f\"group-sparse\\n$\\\\alpha={gsc.alpha_:.2f}$\")\n\n\n# Fit one graph lasso per subject\nfrom sklearn.covariance import GraphicalLassoCV\n\ngl = GraphicalLassoCV(verbose=1)\n\nfor n, subject in enumerate(subjects[:n_displayed]):\n gl.fit(subject)\n\n ax = plt.subplot(n_displayed, 4, 4 * n + 3)\n max_precision = gl.precision_.max()\n plotting.plot_matrix(\n gl.precision_,\n axes=ax,\n vmin=-max_precision,\n vmax=max_precision,\n colorbar=False,\n )\n if n == 0:\n plt.title(\"graph lasso\")\n plt.ylabel(f\"$\\\\alpha={gl.alpha_:.2f}$\")\n\n\n# Fit one graph lasso for all subjects at once\nimport numpy as np\n\ngl.fit(np.concatenate(subjects))\n\nax = plt.subplot(n_displayed, 4, 4)\nmax_precision = gl.precision_.max()\nplotting.plot_matrix(\n gl.precision_,\n axes=ax,\n vmin=-max_precision,\n vmax=max_precision,\n colorbar=False,\n)\nplt.title(f\"graph lasso, all subjects\\n$\\\\alpha={gl.alpha_:.2f}$\")\n\nplotting.show()"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
"outputs": [],
"source": [
"try:\n from sklearn.covariance import GraphicalLassoCV\nexcept ImportError:\n # for Scitkit-Learn < v0.20.0\n from sklearn.covariance import GraphLassoCV as GraphicalLassoCV\n\nestimator = GraphicalLassoCV()\nestimator.fit(time_series)"
"from sklearn.covariance import GraphicalLassoCV\n\nestimator = GraphicalLassoCV()\nestimator.fit(time_series)"
]
},
{
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@
# %%
# Compute the sparse inverse covariance
# -------------------------------------
try:
from sklearn.covariance import GraphicalLassoCV
except ImportError:
# for Scitkit-Learn < v0.20.0
from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
from sklearn.covariance import GraphicalLassoCV

estimator = GraphicalLassoCV()
estimator.fit(time_series)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
},
"outputs": [],
"source": [
"try:\n from sklearn.covariance import GraphicalLassoCV\nexcept ImportError:\n # for Scitkit-Learn < v0.20.0\n from sklearn.covariance import GraphLassoCV as GraphicalLassoCV\n\ncovariance_estimator = GraphicalLassoCV(cv=3, verbose=1)"
"from sklearn.covariance import GraphicalLassoCV\n\ncovariance_estimator = GraphicalLassoCV(cv=3, verbose=1)"
]
},
{
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/a61865436a8c739855dd39d7e9ff3f6e/plot_overlay.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,7 @@
# %%
# in which situation the graphical lasso **sparse inverse covariance**
# estimator captures well the covariance **structure**.
try:
from sklearn.covariance import GraphicalLassoCV
except ImportError:
# for Scitkit-Learn < v0.20.0
from sklearn.covariance import GraphLassoCV as GraphicalLassoCV
from sklearn.covariance import GraphicalLassoCV

covariance_estimator = GraphicalLassoCV(cv=3, verbose=1)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_downloads/ec9ec7cc0c1ea84207d4b1895aa51c35/plot_atlas.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified dev/_images/sphx_glr_plot_advanced_decoding_scikit_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_advanced_decoding_scikit_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_beta_series_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_beta_series_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_beta_series_003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_beta_series_004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_beta_series_005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_beta_series_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_bids_analysis_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_bids_analysis_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_bids_analysis_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_bids_features_007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_design_matrix_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_design_matrix_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_design_matrix_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_first_level_details_024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_anova_svm_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_anova_svm_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_different_estimators_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_different_estimators_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_different_estimators_005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_different_estimators_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_grid_search_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_grid_search_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_mass_univariate_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dev/_images/sphx_glr_plot_haxby_searchlight_001.png
Binary file modified dev/_images/sphx_glr_plot_haxby_searchlight_thumb.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_001.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_002.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_003.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_004.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_005.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_006.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_007.png
Binary file modified dev/_images/sphx_glr_plot_haxby_stimuli_thumb.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_001.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_002.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_003.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_004.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_005.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_006.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_007.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_008.png
Binary file modified dev/_images/sphx_glr_plot_ica_neurovault_thumb.png
Binary file modified dev/_images/sphx_glr_plot_neurovault_meta_analysis_001.png
Binary file modified dev/_images/sphx_glr_plot_neurovault_meta_analysis_002.png
Binary file modified dev/_images/sphx_glr_plot_neurovault_meta_analysis_004.png
Binary file modified dev/_images/sphx_glr_plot_neurovault_meta_analysis_005.png
Binary file modified dev/_images/sphx_glr_plot_neurovault_meta_analysis_007.png
Binary file modified dev/_images/sphx_glr_plot_neurovault_meta_analysis_thumb.png
Binary file modified dev/_images/sphx_glr_plot_oasis_005.png
Binary file modified dev/_images/sphx_glr_plot_oasis_006.png
Binary file modified dev/_images/sphx_glr_plot_oasis_vbm_004.png
Binary file modified dev/_images/sphx_glr_plot_second_level_association_test_003.png
Binary file modified dev/_images/sphx_glr_plot_second_level_one_sample_test_003.png
Binary file modified dev/_images/sphx_glr_plot_simulated_data_002.png
Binary file modified dev/_images/sphx_glr_plot_simulated_data_003.png
Binary file modified dev/_images/sphx_glr_plot_simulated_data_004.png
Binary file modified dev/_images/sphx_glr_plot_simulated_data_006.png
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ statistical map:
.. code-block:: none
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f78215716a0>
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f47f3e15b50>
Expand Down Expand Up @@ -156,7 +156,7 @@ Visualizing works better with a threshold
.. code-block:: none
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f7821455190>
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f47f34d5400>
Expand Down Expand Up @@ -269,7 +269,7 @@ We can then plot it
.. code-block:: none
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f78209c9e80>
<nilearn.plotting.displays._slicers.OrthoSlicer object at 0x7f47fb627470>
Expand Down Expand Up @@ -480,9 +480,9 @@ image.

.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 21.330 seconds)
**Total running time of the script:** (0 minutes 20.886 seconds)

**Estimated memory usage:** 373 MB
**Estimated memory usage:** 374 MB


.. _sphx_glr_download_auto_examples_00_tutorials_plot_3d_and_4d_niimg.py:
Expand Down
Loading

0 comments on commit 73c47b6

Please sign in to comment.