We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Super verbose CI logs
The CI logs are brimming with noise, making it a chore to debug a real problem.

Moreover TravisCI has a log length beyond which it terminates the testing and we have started bumping against it.

We should systematically check all the warnings being generated and update the codebase so they are no longer generated.

This should be made a priority, these spurious failures are costing time and enthusiasm.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/02_decoding/plot_haxby_different_estimators.py`
Content:
```
1 """
2 Different classifiers in decoding the Haxby dataset
3 =====================================================
4 
5 Here we compare different classifiers on a visual object recognition
6 decoding task.
7 """
8 
9 #############################################################################
10 # We start by loading the data and applying simple transformations to it
11 # -----------------------------------------------------------------------
12 
13 # Fetch data using nilearn dataset fetcher
14 from nilearn import datasets
15 # by default 2nd subject data will be fetched
16 haxby_dataset = datasets.fetch_haxby()
17 
18 # print basic information on the dataset
19 print('First subject anatomical nifti image (3D) located is at: %s' %
20       haxby_dataset.anat[0])
21 print('First subject functional nifti image (4D) is located at: %s' %
22       haxby_dataset.func[0])
23 
24 # load labels
25 import numpy as np
26 import pandas as pd
27 labels = pd.read_csv(haxby_dataset.session_target[0], sep=" ")
28 stimuli = labels['labels']
29 # identify resting state labels in order to be able to remove them
30 task_mask = (stimuli != 'rest')
31 
32 # find names of remaining active labels
33 categories = stimuli[task_mask].unique()
34 
35 # extract tags indicating to which acquisition run a tag belongs
36 session_labels = labels['chunks'][task_mask]
37 
38 # Load the fMRI data
39 from nilearn.input_data import NiftiMasker
40 
41 # For decoding, standardizing is often very important
42 mask_filename = haxby_dataset.mask_vt[0]
43 masker = NiftiMasker(mask_img=mask_filename, standardize=True)
44 func_filename = haxby_dataset.func[0]
45 masked_timecourses = masker.fit_transform(
46     func_filename)[task_mask]
47 
48 
49 #############################################################################
50 # Then we define the various classifiers that we use
51 # ---------------------------------------------------
52 # A support vector classifier
53 from sklearn.svm import SVC
54 svm = SVC(C=1., kernel="linear")
55 
56 # The logistic regression
57 from sklearn.linear_model import (LogisticRegression,
58                                   RidgeClassifier,
59                                   RidgeClassifierCV,
60                                   )
61 logistic = LogisticRegression(C=1., penalty="l1", solver='liblinear')
62 logistic_50 = LogisticRegression(C=50., penalty="l1", solver='liblinear')
63 logistic_l2 = LogisticRegression(C=1., penalty="l2", solver='liblinear')
64 
65 # Cross-validated versions of these classifiers
66 from sklearn.model_selection import GridSearchCV
67 # GridSearchCV is slow, but note that it takes an 'n_jobs' parameter that
68 # can significantly speed up the fitting process on computers with
69 # multiple cores
70 svm_cv = GridSearchCV(SVC(C=1., kernel="linear"),
71                       param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},
72                       scoring='f1', n_jobs=1, cv=3, iid=False)
73 
74 logistic_cv = GridSearchCV(LogisticRegression(C=1., penalty="l1"),
75                            param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},
76                            scoring='f1', cv=3, iid=False)
77 logistic_l2_cv = GridSearchCV(LogisticRegression(C=1., penalty="l2"),
78                               param_grid={
79                                   'C': [.1, .5, 1., 5., 10., 50., 100.]
80                               },
81                               scoring='f1', cv=3, iid=False)
82 
83 # The ridge classifier has a specific 'CV' object that can set it's
84 # parameters faster than using a GridSearchCV
85 ridge = RidgeClassifier()
86 ridge_cv = RidgeClassifierCV()
87 
88 # A dictionary, to hold all our classifiers
89 classifiers = {'SVC': svm,
90                'SVC cv': svm_cv,
91                'log l1': logistic,
92                'log l1 50': logistic_50,
93                'log l1 cv': logistic_cv,
94                'log l2': logistic_l2,
95                'log l2 cv': logistic_l2_cv,
96                'ridge': ridge,
97                'ridge cv': ridge_cv
98                }
99 
100 #############################################################################
101 # Here we compute prediction scores
102 # ----------------------------------
103 # Run time for all these classifiers
104 
105 # Make a data splitting object for cross validation
106 from sklearn.model_selection import LeaveOneGroupOut, cross_val_score
107 cv = LeaveOneGroupOut()
108 
109 import time
110 
111 classifiers_scores = {}
112 
113 for classifier_name, classifier in sorted(classifiers.items()):
114     classifiers_scores[classifier_name] = {}
115     print(70 * '_')
116 
117     for category in categories:
118         classification_target = stimuli[task_mask].isin([category])
119         t0 = time.time()
120         classifiers_scores[classifier_name][category] = cross_val_score(
121             classifier,
122             masked_timecourses,
123             classification_target,
124             cv=cv,
125             groups=session_labels,
126             scoring="f1",
127         )
128 
129         print(
130             "%10s: %14s -- scores: %1.2f +- %1.2f, time %.2fs" %
131             (
132                 classifier_name,
133                 category,
134                 classifiers_scores[classifier_name][category].mean(),
135                 classifiers_scores[classifier_name][category].std(),
136                 time.time() - t0,
137             ),
138         )
139 
140 ###############################################################################
141 # Then we make a rudimentary diagram
142 import matplotlib.pyplot as plt
143 plt.figure()
144 
145 tick_position = np.arange(len(categories))
146 plt.xticks(tick_position, categories, rotation=45)
147 
148 for color, classifier_name in zip(
149         ['b', 'c', 'm', 'g', 'y', 'k', '.5', 'r', '#ffaaaa'],
150         sorted(classifiers)):
151     score_means = [classifiers_scores[classifier_name][category].mean()
152                    for category in categories]
153     plt.bar(tick_position, score_means, label=classifier_name,
154             width=.11, color=color)
155     tick_position = tick_position + .09
156 
157 plt.ylabel('Classification accurancy (f1 score)')
158 plt.xlabel('Visual stimuli category')
159 plt.ylim(ymin=0)
160 plt.legend(loc='lower center', ncol=3)
161 plt.title(
162     'Category-specific classification accuracy for different classifiers')
163 plt.tight_layout()
164 
165 ###############################################################################
166 # Finally, w plot the face vs house map for the different classifiers
167 
168 # Use the average EPI as a background
169 from nilearn import image
170 mean_epi_img = image.mean_img(func_filename)
171 
172 # Restrict the decoding to face vs house
173 condition_mask = stimuli.isin(['face', 'house'])
174 masked_timecourses = masked_timecourses[
175     condition_mask[task_mask]]
176 stimuli = (stimuli[condition_mask] == 'face')
177 # Transform the stimuli to binary values
178 stimuli.astype(np.int)
179 
180 from nilearn.plotting import plot_stat_map, show
181 
182 for classifier_name, classifier in sorted(classifiers.items()):
183     classifier.fit(masked_timecourses, stimuli)
184 
185     if hasattr(classifier, 'coef_'):
186         weights = classifier.coef_[0]
187     elif hasattr(classifier, 'best_estimator_'):
188         weights = classifier.best_estimator_.coef_[0]
189     else:
190         continue
191     weight_img = masker.inverse_transform(weights)
192     weight_map = weight_img.get_data()
193     threshold = np.max(np.abs(weight_map)) * 1e-3
194     plot_stat_map(weight_img, bg_img=mean_epi_img,
195                   display_mode='z', cut_coords=[-15],
196                   threshold=threshold,
197                   title='%s: face vs house' % classifier_name)
198 
199 show()
200
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/examples/02_decoding/plot_haxby_different_estimators.py b/examples/02_decoding/plot_haxby_different_estimators.py
--- a/examples/02_decoding/plot_haxby_different_estimators.py
+++ b/examples/02_decoding/plot_haxby_different_estimators.py
@@ -71,14 +71,18 @@
                       param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},
                       scoring='f1', n_jobs=1, cv=3, iid=False)
 
-logistic_cv = GridSearchCV(LogisticRegression(C=1., penalty="l1"),
-                           param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},
-                           scoring='f1', cv=3, iid=False)
-logistic_l2_cv = GridSearchCV(LogisticRegression(C=1., penalty="l2"),
-                              param_grid={
-                                  'C': [.1, .5, 1., 5., 10., 50., 100.]
-                              },
-                              scoring='f1', cv=3, iid=False)
+logistic_cv = GridSearchCV(
+        LogisticRegression(C=1., penalty="l1", solver='liblinear'),
+        param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},
+        scoring='f1', cv=3, iid=False,
+        )
+logistic_l2_cv = GridSearchCV(
+        LogisticRegression(C=1., penalty="l2", solver='liblinear'),
+        param_grid={
+            'C': [.1, .5, 1., 5., 10., 50., 100.]
+            },
+        scoring='f1', cv=3, iid=False,
+        )
 
 # The ridge classifier has a specific 'CV' object that can set it's
 # parameters faster than using a GridSearchCV

{"golden_diff": "diff --git a/examples/02_decoding/plot_haxby_different_estimators.py b/examples/02_decoding/plot_haxby_different_estimators.py\n--- a/examples/02_decoding/plot_haxby_different_estimators.py\n+++ b/examples/02_decoding/plot_haxby_different_estimators.py\n@@ -71,14 +71,18 @@\n                       param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},\n                       scoring='f1', n_jobs=1, cv=3, iid=False)\n \n-logistic_cv = GridSearchCV(LogisticRegression(C=1., penalty=\"l1\"),\n-                           param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},\n-                           scoring='f1', cv=3, iid=False)\n-logistic_l2_cv = GridSearchCV(LogisticRegression(C=1., penalty=\"l2\"),\n-                              param_grid={\n-                                  'C': [.1, .5, 1., 5., 10., 50., 100.]\n-                              },\n-                              scoring='f1', cv=3, iid=False)\n+logistic_cv = GridSearchCV(\n+        LogisticRegression(C=1., penalty=\"l1\", solver='liblinear'),\n+        param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},\n+        scoring='f1', cv=3, iid=False,\n+        )\n+logistic_l2_cv = GridSearchCV(\n+        LogisticRegression(C=1., penalty=\"l2\", solver='liblinear'),\n+        param_grid={\n+            'C': [.1, .5, 1., 5., 10., 50., 100.]\n+            },\n+        scoring='f1', cv=3, iid=False,\n+        )\n \n # The ridge classifier has a specific 'CV' object that can set it's\n # parameters faster than using a GridSearchCV\n", "issue": "Super verbose CI logs\nThe CI logs are brimming with noise, making it a chore to debug a real problem.\r\n\r\nMoreover TravisCI has a log length beyond which it terminates the testing and we have started bumping against it.\r\n\r\nWe should systematically check all the warnings being generated and update the codebase so they are no longer generated.\r\n\r\nThis should be made a priority, these spurious failures are costing time and enthusiasm.\n", "before_files": [{"content": "\"\"\"\nDifferent classifiers in decoding the Haxby dataset\n=====================================================\n\nHere we compare different classifiers on a visual object recognition\ndecoding task.\n\"\"\"\n\n#############################################################################\n# We start by loading the data and applying simple transformations to it\n# -----------------------------------------------------------------------\n\n# Fetch data using nilearn dataset fetcher\nfrom nilearn import datasets\n# by default 2nd subject data will be fetched\nhaxby_dataset = datasets.fetch_haxby()\n\n# print basic information on the dataset\nprint('First subject anatomical nifti image (3D) located is at: %s' %\n      haxby_dataset.anat[0])\nprint('First subject functional nifti image (4D) is located at: %s' %\n      haxby_dataset.func[0])\n\n# load labels\nimport numpy as np\nimport pandas as pd\nlabels = pd.read_csv(haxby_dataset.session_target[0], sep=\" \")\nstimuli = labels['labels']\n# identify resting state labels in order to be able to remove them\ntask_mask = (stimuli != 'rest')\n\n# find names of remaining active labels\ncategories = stimuli[task_mask].unique()\n\n# extract tags indicating to which acquisition run a tag belongs\nsession_labels = labels['chunks'][task_mask]\n\n# Load the fMRI data\nfrom nilearn.input_data import NiftiMasker\n\n# For decoding, standardizing is often very important\nmask_filename = haxby_dataset.mask_vt[0]\nmasker = NiftiMasker(mask_img=mask_filename, standardize=True)\nfunc_filename = haxby_dataset.func[0]\nmasked_timecourses = masker.fit_transform(\n    func_filename)[task_mask]\n\n\n#############################################################################\n# Then we define the various classifiers that we use\n# ---------------------------------------------------\n# A support vector classifier\nfrom sklearn.svm import SVC\nsvm = SVC(C=1., kernel=\"linear\")\n\n# The logistic regression\nfrom sklearn.linear_model import (LogisticRegression,\n                                  RidgeClassifier,\n                                  RidgeClassifierCV,\n                                  )\nlogistic = LogisticRegression(C=1., penalty=\"l1\", solver='liblinear')\nlogistic_50 = LogisticRegression(C=50., penalty=\"l1\", solver='liblinear')\nlogistic_l2 = LogisticRegression(C=1., penalty=\"l2\", solver='liblinear')\n\n# Cross-validated versions of these classifiers\nfrom sklearn.model_selection import GridSearchCV\n# GridSearchCV is slow, but note that it takes an 'n_jobs' parameter that\n# can significantly speed up the fitting process on computers with\n# multiple cores\nsvm_cv = GridSearchCV(SVC(C=1., kernel=\"linear\"),\n                      param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},\n                      scoring='f1', n_jobs=1, cv=3, iid=False)\n\nlogistic_cv = GridSearchCV(LogisticRegression(C=1., penalty=\"l1\"),\n                           param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},\n                           scoring='f1', cv=3, iid=False)\nlogistic_l2_cv = GridSearchCV(LogisticRegression(C=1., penalty=\"l2\"),\n                              param_grid={\n                                  'C': [.1, .5, 1., 5., 10., 50., 100.]\n                              },\n                              scoring='f1', cv=3, iid=False)\n\n# The ridge classifier has a specific 'CV' object that can set it's\n# parameters faster than using a GridSearchCV\nridge = RidgeClassifier()\nridge_cv = RidgeClassifierCV()\n\n# A dictionary, to hold all our classifiers\nclassifiers = {'SVC': svm,\n               'SVC cv': svm_cv,\n               'log l1': logistic,\n               'log l1 50': logistic_50,\n               'log l1 cv': logistic_cv,\n               'log l2': logistic_l2,\n               'log l2 cv': logistic_l2_cv,\n               'ridge': ridge,\n               'ridge cv': ridge_cv\n               }\n\n#############################################################################\n# Here we compute prediction scores\n# ----------------------------------\n# Run time for all these classifiers\n\n# Make a data splitting object for cross validation\nfrom sklearn.model_selection import LeaveOneGroupOut, cross_val_score\ncv = LeaveOneGroupOut()\n\nimport time\n\nclassifiers_scores = {}\n\nfor classifier_name, classifier in sorted(classifiers.items()):\n    classifiers_scores[classifier_name] = {}\n    print(70 * '_')\n\n    for category in categories:\n        classification_target = stimuli[task_mask].isin([category])\n        t0 = time.time()\n        classifiers_scores[classifier_name][category] = cross_val_score(\n            classifier,\n            masked_timecourses,\n            classification_target,\n            cv=cv,\n            groups=session_labels,\n            scoring=\"f1\",\n        )\n\n        print(\n            \"%10s: %14s -- scores: %1.2f +- %1.2f, time %.2fs\" %\n            (\n                classifier_name,\n                category,\n                classifiers_scores[classifier_name][category].mean(),\n                classifiers_scores[classifier_name][category].std(),\n                time.time() - t0,\n            ),\n        )\n\n###############################################################################\n# Then we make a rudimentary diagram\nimport matplotlib.pyplot as plt\nplt.figure()\n\ntick_position = np.arange(len(categories))\nplt.xticks(tick_position, categories, rotation=45)\n\nfor color, classifier_name in zip(\n        ['b', 'c', 'm', 'g', 'y', 'k', '.5', 'r', '#ffaaaa'],\n        sorted(classifiers)):\n    score_means = [classifiers_scores[classifier_name][category].mean()\n                   for category in categories]\n    plt.bar(tick_position, score_means, label=classifier_name,\n            width=.11, color=color)\n    tick_position = tick_position + .09\n\nplt.ylabel('Classification accurancy (f1 score)')\nplt.xlabel('Visual stimuli category')\nplt.ylim(ymin=0)\nplt.legend(loc='lower center', ncol=3)\nplt.title(\n    'Category-specific classification accuracy for different classifiers')\nplt.tight_layout()\n\n###############################################################################\n# Finally, w plot the face vs house map for the different classifiers\n\n# Use the average EPI as a background\nfrom nilearn import image\nmean_epi_img = image.mean_img(func_filename)\n\n# Restrict the decoding to face vs house\ncondition_mask = stimuli.isin(['face', 'house'])\nmasked_timecourses = masked_timecourses[\n    condition_mask[task_mask]]\nstimuli = (stimuli[condition_mask] == 'face')\n# Transform the stimuli to binary values\nstimuli.astype(np.int)\n\nfrom nilearn.plotting import plot_stat_map, show\n\nfor classifier_name, classifier in sorted(classifiers.items()):\n    classifier.fit(masked_timecourses, stimuli)\n\n    if hasattr(classifier, 'coef_'):\n        weights = classifier.coef_[0]\n    elif hasattr(classifier, 'best_estimator_'):\n        weights = classifier.best_estimator_.coef_[0]\n    else:\n        continue\n    weight_img = masker.inverse_transform(weights)\n    weight_map = weight_img.get_data()\n    threshold = np.max(np.abs(weight_map)) * 1e-3\n    plot_stat_map(weight_img, bg_img=mean_epi_img,\n                  display_mode='z', cut_coords=[-15],\n                  threshold=threshold,\n                  title='%s: face vs house' % classifier_name)\n\nshow()\n", "path": "examples/02_decoding/plot_haxby_different_estimators.py"}], "after_files": [{"content": "\"\"\"\nDifferent classifiers in decoding the Haxby dataset\n=====================================================\n\nHere we compare different classifiers on a visual object recognition\ndecoding task.\n\"\"\"\n\n#############################################################################\n# We start by loading the data and applying simple transformations to it\n# -----------------------------------------------------------------------\n\n# Fetch data using nilearn dataset fetcher\nfrom nilearn import datasets\n# by default 2nd subject data will be fetched\nhaxby_dataset = datasets.fetch_haxby()\n\n# print basic information on the dataset\nprint('First subject anatomical nifti image (3D) located is at: %s' %\n      haxby_dataset.anat[0])\nprint('First subject functional nifti image (4D) is located at: %s' %\n      haxby_dataset.func[0])\n\n# load labels\nimport numpy as np\nimport pandas as pd\nlabels = pd.read_csv(haxby_dataset.session_target[0], sep=\" \")\nstimuli = labels['labels']\n# identify resting state labels in order to be able to remove them\ntask_mask = (stimuli != 'rest')\n\n# find names of remaining active labels\ncategories = stimuli[task_mask].unique()\n\n# extract tags indicating to which acquisition run a tag belongs\nsession_labels = labels['chunks'][task_mask]\n\n# Load the fMRI data\nfrom nilearn.input_data import NiftiMasker\n\n# For decoding, standardizing is often very important\nmask_filename = haxby_dataset.mask_vt[0]\nmasker = NiftiMasker(mask_img=mask_filename, standardize=True)\nfunc_filename = haxby_dataset.func[0]\nmasked_timecourses = masker.fit_transform(\n    func_filename)[task_mask]\n\n\n#############################################################################\n# Then we define the various classifiers that we use\n# ---------------------------------------------------\n# A support vector classifier\nfrom sklearn.svm import SVC\nsvm = SVC(C=1., kernel=\"linear\")\n\n# The logistic regression\nfrom sklearn.linear_model import (LogisticRegression,\n                                  RidgeClassifier,\n                                  RidgeClassifierCV,\n                                  )\nlogistic = LogisticRegression(C=1., penalty=\"l1\", solver='liblinear')\nlogistic_50 = LogisticRegression(C=50., penalty=\"l1\", solver='liblinear')\nlogistic_l2 = LogisticRegression(C=1., penalty=\"l2\", solver='liblinear')\n\n# Cross-validated versions of these classifiers\nfrom sklearn.model_selection import GridSearchCV\n# GridSearchCV is slow, but note that it takes an 'n_jobs' parameter that\n# can significantly speed up the fitting process on computers with\n# multiple cores\nsvm_cv = GridSearchCV(SVC(C=1., kernel=\"linear\"),\n                      param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},\n                      scoring='f1', n_jobs=1, cv=3, iid=False)\n\nlogistic_cv = GridSearchCV(\n        LogisticRegression(C=1., penalty=\"l1\", solver='liblinear'),\n        param_grid={'C': [.1, .5, 1., 5., 10., 50., 100.]},\n        scoring='f1', cv=3, iid=False,\n        )\nlogistic_l2_cv = GridSearchCV(\n        LogisticRegression(C=1., penalty=\"l2\", solver='liblinear'),\n        param_grid={\n            'C': [.1, .5, 1., 5., 10., 50., 100.]\n            },\n        scoring='f1', cv=3, iid=False,\n        )\n\n# The ridge classifier has a specific 'CV' object that can set it's\n# parameters faster than using a GridSearchCV\nridge = RidgeClassifier()\nridge_cv = RidgeClassifierCV()\n\n# A dictionary, to hold all our classifiers\nclassifiers = {'SVC': svm,\n               'SVC cv': svm_cv,\n               'log l1': logistic,\n               'log l1 50': logistic_50,\n               'log l1 cv': logistic_cv,\n               'log l2': logistic_l2,\n               'log l2 cv': logistic_l2_cv,\n               'ridge': ridge,\n               'ridge cv': ridge_cv\n               }\n\n#############################################################################\n# Here we compute prediction scores\n# ----------------------------------\n# Run time for all these classifiers\n\n# Make a data splitting object for cross validation\nfrom sklearn.model_selection import LeaveOneGroupOut, cross_val_score\ncv = LeaveOneGroupOut()\n\nimport time\n\nclassifiers_scores = {}\n\nfor classifier_name, classifier in sorted(classifiers.items()):\n    classifiers_scores[classifier_name] = {}\n    print(70 * '_')\n\n    for category in categories:\n        classification_target = stimuli[task_mask].isin([category])\n        t0 = time.time()\n        classifiers_scores[classifier_name][category] = cross_val_score(\n            classifier,\n            masked_timecourses,\n            classification_target,\n            cv=cv,\n            groups=session_labels,\n            scoring=\"f1\",\n        )\n\n        print(\n            \"%10s: %14s -- scores: %1.2f +- %1.2f, time %.2fs\" %\n            (\n                classifier_name,\n                category,\n                classifiers_scores[classifier_name][category].mean(),\n                classifiers_scores[classifier_name][category].std(),\n                time.time() - t0,\n            ),\n        )\n\n###############################################################################\n# Then we make a rudimentary diagram\nimport matplotlib.pyplot as plt\nplt.figure()\n\ntick_position = np.arange(len(categories))\nplt.xticks(tick_position, categories, rotation=45)\n\nfor color, classifier_name in zip(\n        ['b', 'c', 'm', 'g', 'y', 'k', '.5', 'r', '#ffaaaa'],\n        sorted(classifiers)):\n    score_means = [classifiers_scores[classifier_name][category].mean()\n                   for category in categories]\n    plt.bar(tick_position, score_means, label=classifier_name,\n            width=.11, color=color)\n    tick_position = tick_position + .09\n\nplt.ylabel('Classification accurancy (f1 score)')\nplt.xlabel('Visual stimuli category')\nplt.ylim(ymin=0)\nplt.legend(loc='lower center', ncol=3)\nplt.title(\n    'Category-specific classification accuracy for different classifiers')\nplt.tight_layout()\n\n###############################################################################\n# Finally, w plot the face vs house map for the different classifiers\n\n# Use the average EPI as a background\nfrom nilearn import image\nmean_epi_img = image.mean_img(func_filename)\n\n# Restrict the decoding to face vs house\ncondition_mask = stimuli.isin(['face', 'house'])\nmasked_timecourses = masked_timecourses[\n    condition_mask[task_mask]]\nstimuli = (stimuli[condition_mask] == 'face')\n# Transform the stimuli to binary values\nstimuli.astype(np.int)\n\nfrom nilearn.plotting import plot_stat_map, show\n\nfor classifier_name, classifier in sorted(classifiers.items()):\n    classifier.fit(masked_timecourses, stimuli)\n\n    if hasattr(classifier, 'coef_'):\n        weights = classifier.coef_[0]\n    elif hasattr(classifier, 'best_estimator_'):\n        weights = classifier.best_estimator_.coef_[0]\n    else:\n        continue\n    weight_img = masker.inverse_transform(weights)\n    weight_map = weight_img.get_data()\n    threshold = np.max(np.abs(weight_map)) * 1e-3\n    plot_stat_map(weight_img, bg_img=mean_epi_img,\n                  display_mode='z', cut_coords=[-15],\n                  threshold=threshold,\n                  title='%s: face vs house' % classifier_name)\n\nshow()\n", "path": "examples/02_decoding/plot_haxby_different_estimators.py"}]}