# Use the searchlight with a neighborhood and a measure¶

## ‘I love it when a plan comes together’¶

In this exercise we integrate concepts and techniques described during previous exercises:

the generic measure concept (exercise), in particular

- cosmo correlation measure, simplifying the split-half correlation exercise.
- cosmo crossvalidation measure, simplifying the single fold classification exercise and cross validation classification exercise.
the generic neighborhood concept (exercise).

to compute a whole brain *information map* using a Neighborhood that indicates where in the brain, locally, regions contain information about the conditions of interest (`.sa.targets`

).

## Part 1¶

Using cosmo fmri dataset, load the t stats for ‘odd’ and ‘even’ runs for s01 (`glm_T_stats_odd.nii`

and `glm_T_stats_even.nii`

), while supplying the `brain`

mask. Assign chunks and targets and stack the two halves into a single dataset `ds`

.

Using cosmo spherical neighborhood, define a spherical neighborhood with a radius of 3 voxels for each feature (voxel) in `ds`

. Show a histogram of the number of features (voxels) in each element in the neighborhood.

Then, using cosmo correlation measure and the cosmo searchlight function, compute a whole-brain information map, visualize the result using cosmo slice, and store the result as a NIFTI file using cosmo map2fmri. The NIFTI file can be visualized with any fMRI analysis package; one simple program is MRIcron.

Hint: run splithalf correlations searchlight skl

Solution: run splithalf correlations searchlight / Matlab output: run_splithalf_correlations_searchlight

*Part 2 is optional; it is used to illustrate that a whole-brain searchlight can be applied with different measures*.

## Part 2¶

Load the dataset with subject `s01`

’s t-statistic for every run (`glm_T_stats_perrun.nii`

) using the `brain`

mask and assign chunks and targets.

Using cosmo spherical neighborhood, define a spherical neighborhood with at least 100 voxels for each feature (voxel) in `ds`

.

Use cosmo oddeven partitioner to define a cross-validation scheme, and use cosmo crossvalidation measure and the cosmo searchlight function to compute a whole-brain information map with classification accuracies, visualize the result using cosmo plot slices, and store the result as a NIFTI file using cosmo map2fmri.

Hint: run crossvalidation searchlight skl

Solution: run crossvalidation searchlight / Matlab output: run_crossvalidation_searchlight