Moving from Libsvm to nilearn

Our lab has been using Libsvm for decoding but I have decided to switch to nilearn.

Our approach to MVPA so far was seperating events into groups and then estimating beta values using a first level analysis. Then those beta values were passed on to libsvm on several ROIs to classify activity to specific events.

I have checked the plot_haxby_glm_decoding.ipynb notebook and it looked like this would be what I’d need.

However, I can not see any beta estimates inside this folder:

So I’m confused if this code is even doing what I think it should be doing.

And all I see is a single value of classification accuracy:

image

However, my expectations was to see classification accuracies for each type of picture (house, bottle, chair etc.)

Is this notebook what I should base my code on so that I have a similar pipeline to my previous one, or is it something else?

Hi,

The beta map gets generated in the following line of code and is inside of the variable called glm.

# fit the glm
    glm.fit(fmri_session, events=events[session])

I’m guessing you could subject-level average and then export the condition specific beta maps and feed that into the decoder, but most nilearn tutorial will use z-maps.

The classification accuracy in the tutorial assesses the “between-condition” discriminability. Maybe this tutorial would be better if you want to see class level performance?

1 Like

Thanks a lot for your reply. There is a lot to digest about this library and I don’t know where to start from.

Is there any place I can find example code on how people do things? Tutorial code is good too, but It may be better by examining code which works on actual data.

I recommend that you just go through the guide step-by-step. I also just recently got into it… I think it helps if instead of using Jupyter notebooks you use an editor like Spyder because then you can inspect the variables you are creating like you would in Matlab…

You can definitely look for real-life use cases, maybe by drilling in the references of this paper? Frontiers | Machine learning for neuroimaging with scikit-learn other than that searching on github is you best option in my opinion!