[pymvpa] Visualization of the sensitivity map
Maria Hakonen
maria.hakonen at gmail.com
Thu Jan 21 14:18:42 UTC 2016
Dear pyMVPA experts,
I am working on my first fMRI data and would like to try MVPA analysis. I
have two classes that I have classified with linear SVM. I would like to
determine which voxels contribute most to the clasifier’s successful
discrimination of the classes. As far as understand, the absolute value of
the SVM weights directly reflect the importance of a feature (voxel) in
discriminating the two classes. I would like to average the SVM weights
across all 18 cross-validation folds for each voxel and wrap the resulting
map into the standard space in order to display a map of the resulting
overlap. My script is shown below. The results seems reasonable, but could
you please yet check that the visualization is correctly done.
# Select the classifier
clf = LinearCSVMC()
# select top 5% of the ANOVA F-scores
fsel = SensitivityBasedFeatureSelection(OneWayAnova(),
FractionTailSelector(0.05, mode='select', tail='upper'))
fclf = FeatureSelectionClassifier(clf, fsel)
cvte = CrossValidation(fclf, NFoldPartitioner(), errorfx=lambda p, t:
np.mean(p == t), enable_ca=['stats'])
sensana = fclf.get_sensitivity_analyzer()
cv_sensana = RepeatedMeasure(sensana,
ChainNode((NFoldPartitioner(),
Splitter('partitions',
attr_values=(1,)))))
# Get 18 sensitivity maps, one for each cross-validation fold
sens = cv_sensana(ds)
#Get absolute values:
sens_abs = sens.get_mapped(absolute_features())
# Get average over the 18 folds:
sens_avg = sens_abs.get_mapped(mean_sample())
# Map data into the original dataspace and wrap it into an Image
map2nifti(ds, sens_avg).to_filename(fname)
Thanks,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20160121/9da4c88a/attachment.html>
More information about the Pkg-ExpPsy-PyMVPA
mailing list