[Neuroimaging] ER-design task classification with nilearn
bthirion
bertrand.thirion at inria.fr
Wed May 20 16:41:32 EDT 2020
Hi Lewis,
This kind of question would better go to Neurostars.
IIUC, you have put in the dataframe both the target variable (the
class), often denoted "y", and the voxel data ("X"). So you don't need
to apply a Masker any more.
The only thing is to extract X and y from your dataFrame, and give that
to scikit-learn, together with a correct cross-validation scheme.
Does that make sense ?
Best,
Bertrand
On 20/05/2020 10:49, lewis.dunne00 at gmail.com wrote:
>
> Hello. I'm trying to follow the tutorial on Nilearn for decoding
> <https://nilearn.github.io/auto_examples/plot_decoding_tutorial.html#sphx-glr-auto-examples-plot-decoding-tutorial-py>,
> only using my own data which is event related. I used SPM to create
> unique beta images for each trial in my dataset as recommended. But
> since this is a different approach from the Haxby dataset I'm a little
> unclear on how to follow along now. I wonder if I could get some
> feedback on what I have done so far.
>
> I created a dataframe with the trial event labels and paired each
> trial with its respective beta image. I did this by reading in each
> beta file and masking it with a previously made 6mm ROI (not quite
> sure how to make an anatomical mask yet), which left me with a 1x120
> array where 120 is the number of voxels for that trial event within
> the mask. I don't know if this is correct... Since I have 82 events in
> this task, I created an 82x120 matrix containing all of these masked
> beta images as rows, voxel data as columns, and concatenated this onto
> my dataframe containing trial-by-trial task info. My plan was to then
> use these 120 voxels as features and my experimental condition column
> (it's just binary data) as the labels.
>
> The problem is I get to the NiftiMasker and receive this warning:
>
> `UserWarning: Standardization of 3D signal has been requested but
> would lead to zero values. Skipping.
>
> warnings.warn('Standardization of 3D signal has been requested but
> '` ß not a typo
>
> I think this has to do with the fact that these are beta images for
> events rather than an entire block, so there is no time dimension? But
> I'm not sure because I am quite unfamiliar with this. For example in
> the tutorial it says that the variable "fmri_masked" is an array with
> shape `time x voxels`. The array that I get is of course 1 x 120,
> which makes sense given the event-related design, but the tutorial
> doesn't mention anything about this.
>
> I think I've misunderstood something. What should I really be doing
> differently in the case of an event-related design with trial-wise
> betas? Feedback would be greatly appreciated!
>
> Best
>
> L
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> Virus-free. www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> _______________________________________________
> Neuroimaging mailing list
> Neuroimaging at python.org
> https://mail.python.org/mailman/listinfo/neuroimaging
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200520/7f56554a/attachment.html>
More information about the Neuroimaging
mailing list