[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errata in examples 2.1 and 2.4 #1130

Open
Joaoloula opened this issue Jun 14, 2016 · 4 comments
Open

Errata in examples 2.1 and 2.4 #1130

Joaoloula opened this issue Jun 14, 2016 · 4 comments
Labels
Documentation for documentation related questions or requests Good first issue Good for newcomers. Equivalent to "very low" effort.

Comments

@Joaoloula
Copy link
Contributor

In section 2.1.3.1, the pipeline model is used to fit and predict X and y variables that weren't declared before in the tutorial: it seems these were taken from the example plot_haxby_anova_svm.py, so something like this should probably be added:

mask_filename = haxby_dataset.mask
nifti_masker = NiftiMasker(mask_img=mask_filename, standardize=True)
func_filename = haxby_dataset.func[0]
X = nifti_masker.fit_transform(func_filename)
X = X[condition_mask]

with eventually a change in the name of the mask variables just to make it clear that they're different from those used at the beginning of the section. The y variable can just be replaced with the target variable declared before.

In the first paragraph of section 2.4.1, both links to [Grosenick et al. 2013] redirect to [Gramfort et al. 2013], they should probably be changed to http://www.ncbi.nlm.nih.gov/pubmed/23298747.

@KamalakerDadi
Copy link
Contributor

the pipeline model is used to fit and predict X and y variables that weren't declared before in the tutorial:

The idea of this section being that more focussed on how to do feature selection procedure providing an idea. For me, I think user will know the meaning of X and y in fit and predict (as it explained above).

In the first paragraph of section 2.4.1, both links to [Grosenick et al. 2013] redirect to [Gramfort et al. 2013], they should probably be changed to http://www.ncbi.nlm.nih.gov/pubmed/23298747.

Thanks for spotting. PR welcome. :)

@Joaoloula
Copy link
Contributor Author

Ok, I'll do a PR

@dohmatob
Copy link
Contributor

On Tue, Jun 14, 2016 at 11:05 PM, Joao Loula notifications@github.com
wrote:

In section 2.1.3.1,
http://nilearn.github.io/decoding/decoding_tutorial.html#dimension-reduction-with-feature-selection
the pipeline model is used to fit and predict X and y variables that
weren't declared before in the tutorial: it seems these were taken from the
example plot_haxby_anova_svm.py, so something like this should probably
be added:

mask_filename = haxby_dataset.mask
nifti_masker = NiftiMasker(mask_img=mask_filename, standardize=True)
func_filename = haxby_dataset.func[0]
X = nifti_masker.fit_transform(func_filename)
X = X[condition_mask]

with eventually a change in the name of the mask variables just to make it
clear that they're different from those used at the beginning of the
section. The y variable can just be replaced with the target variable
declared before.

In the first paragraph of section 2.4.1
http://nilearn.github.io/decoding/space_net.html#the-spacenet-decoder,
both links to [Grosenick et al. 2013] redirect to [Gramfort et al. 2013],
they should probably be changed to
http://www.ncbi.nlm.nih.gov/pubmed/23298747.

Good catch.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1130, or mute the thread
https://github.com/notifications/unsubscribe/AAms1Ia4nL3lNUBaf2xnNnP68LD2PxESks5qLxevgaJpZM4I1wqY
.

Elvis Dohmatob,
sent from my potato...
http://dohmatob.blogspot.fr/, https://team.inria.fr/parietal/elvis/,
https://github.com/dohmatob

@tsalo
Copy link
Member
tsalo commented Dec 29, 2020

It looks like the link issues were resolved in #1184, so now the only problem is that Example 2.1 (An introduction to decoding) does not define the variables used in section 2.1.3.1 (Dimension reduction with feature selection)- specifically func_img and conditions.

The example uses the following lines from plot_haxby_anova_svm.py, which does not include the code used to define func_img and conditions:

from nilearn.decoding import Decoder
# Here screening_percentile is set to 5 percent
mask_img = haxby_dataset.mask
decoder = Decoder(estimator='svc', mask=mask_img, smoothing_fwhm=4,
standardize=True, screening_percentile=5, scoring='accuracy')
#############################################################################
# Fit the decoder and predict
# ----------------------------
decoder.fit(func_img, conditions)
y_pred = decoder.predict(func_img)
#############################################################################
# Obtain prediction scores via cross validation
# -----------------------------------------------
# Define the cross-validation scheme used for validation. Here we use a
# LeaveOneGroupOut cross-validation on the session group which corresponds to a
# leave a session out scheme, then pass the cross-validator object to the cv
# parameter of decoder.leave-one-session-out For more details please take a
# look at:
# <https://nilearn.github.io/auto_examples/plot_decoding_tutorial.html#measuring-prediction-scores-using-cross-validation>
from sklearn.model_selection import LeaveOneGroupOut
cv = LeaveOneGroupOut()
decoder = Decoder(estimator='svc', mask=mask_img, standardize=True,
screening_percentile=5, scoring='accuracy', cv=cv)
# Compute the prediction accuracy for the different folds (i.e. session)
decoder.fit(func_img, conditions, groups=session_label)
# Print the CV scores
print(decoder.cv_scores_['face'])

@bthirion bthirion added Documentation for documentation related questions or requests Good first issue Good for newcomers. Equivalent to "very low" effort. labels Jan 13, 2021
@Remi-Gau Remi-Gau added hacktoberfest For issues available for the hacktoberfest and removed Help wanted hacktoberfest For issues available for the hacktoberfest labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation for documentation related questions or requests Good first issue Good for newcomers. Equivalent to "very low" effort.
Projects
None yet
Development

No branches or pull requests

6 participants