CoSMoMVPA functions¶
Dataset input/output 

Check consistency of a dataset. 

load an fmri volumetric dataset 

maps a dataset structure to a NIFTI, AFNI, or BV structure or file 

maps a dataset to a FieldTrip or EEGlab structure or file 

maps a dataset structure to AFNI/SUMA NIML dset or BV SMP file 

Returns a dataset structure based on MEEG data 

Returns a dataset structure based on surface mesh data 

generate synthetic dataset 

Dataset operations 

insert a dataset dimension 

prune dataset dimension values that are not used after slicing 

remove a dataset dimension 

rename dimension attribute name 

move a dataset dimension from samples to features or vice versa 

Slice a dataset by samples (the default) or features 

splits a dataset by unique values in (a) sample or feature attribute(s). 

stacks multiple datasets to yield a single dataset 

Dataset processing 

average subsets of samples by unique combinations of sample attributes 

apply a function to unique combinations of .sa or .fa values 

correct baseline of MEEG dataset 

normalize dataset either by estimating or applying estimated parameters 

provides randomized target labels 

remove ‘useless’ (constant and/or nonfinite) samples or features 

MEEG related functions 

determine neighborhood of channels in MEEG dataset 

find neighbors of MEEG channels 

return channel types and optionally a feature mask matching a type 

finds an MEEG channel layout associated with a dataset 

return supported MEEG channel layouts 

Read FieldTrip layout 

return mapping from MEEG sensor types to sensor layouts 

return supported MEEG acquisition systems and their channel labels 

fMRI related functions 

convert xform code between numeric and string in fmri dataset 

deoblique a dataset 

get orientation of a dataset 

Change the orientation of an fmri dataset 

convert to and from spatial (x,y,z) coordinates 

convert between volumetric (fmri) and gridbased (meeg source) dataset 

Data visualization 

display the input as a string representation 

Plots a set of slices from a dataset, nifti image, or 3D data array 

Correlations 

Computes correlation  faster than than matlab’s “corr” for Pearson. 

Computes a splithalf correlation measure 

Classification and crossvalidation 

knearest neighbor classifier 

linear discriminant analysis classifier  without prior 

libsvmbased SVM classifier 

SVM multiclassifier using matlab’s SVM implementation 

svm classifier wrapper (around svmtrain/svmclassify) 

meta classifier that uses feature selection on the training data 

naive bayes classifier 

nearest neighbor classifier 

classifier wrapper that uses either matlab’s or libsvm’s SVM. 

Returns a confusion matrix 

performs crossvalidation using a classifier 

performs crossvalidation using a classifier 

Given multiple predictions, get indices that were predicted most often. 

Representational similarity analysis 

measure generalization across pairwise combinations over time (or any other dimension) 

Compute a dissimilarity matrix measure 

apply DISTATIS measure to each feature 

compute pairwise distance between samples in a matrix 

converts pairwise distances between matrix and vector form 

measure correlation with target dissimilarity matrix 

Partitioning (for crossvalidation) 

balances a partition so that each target occurs equally often in each training and test chunk 

check whether partitions are balanced and not doubledippy 

check whether partitions are balanced and not doubledippy 

assigns chunks that are as balanced as possible based on targets. 

Compute partitioning scheme based on dataset with independent samples 

partitions for into nchoosek(n,k) parititions with optional grouping schemas. 

generates an nfold partition scheme 

generates an oddeven partition scheme 

Neighborhoods and searchlight 

cross neighborhoods along dataset dimensions 

compute neighborhoods stretching intervals 

determine neighborhood of channels in MEEG dataset 

Run (fast) Naive Bayes classifier searchlight with crossvalidation 

partitions a neighborhood in a cell with (smaller) neigborhoods 

Generic searchlight function returns a map of results computed at each searchlight location 

computes sub index offsets for voxels in a sphere 

computes neighbors for a spherical searchlight 

neighborhood definition for surfacebased searchlight 

Featurebased clustering 

check that a neighborhood is kosher 

define neighborhood suitable for clusterbased analysis 

fast depthfirst clustering based on equal values of neighbors 

Converts between cell, matrix and struct representations of neighborhoods 

find local extrema in a dataset using a neighborhood 

General cluster measure 

compute randomeffect cluster statistics corrected for multiple comparisons 

Univariate statistics 

find the features that show the most variance between classes 

compute ttest or Ftest (ANOVA) statistic 

Convert statcode for different analysis packages 

Utility functions 

find permutation so that values in two inputs are matched 

returns the cartesian product with all combinations of the input 

find dimension attribute in dataset 

return a mask indicating match of dataset dimensions with values 

index unique (combinations of) elements 

compares two input for equality with NaNs considered being equal 

checks the presence of (possibly nested) fieldnames in a struct 

normalize dataset either by estimating or applying estimated parameters 

find intersection mask across a set of datasets 

returns a mask indicating matching occurences in two arrays or cells relative to the second array 

compute overlap between vectors or cellstrings in two cells 

Principal Component Analysis 

generate uniform pseudorandom numbers, optionally using a seed value 

generate random permutation of integers 

sample without replacement from subsets of integers in balanced manner 

joins strings using a delimeter string 

splits a string based on another delimeter string 

joins values in structs or keyvalue pairs 

find values in left or right tail of a vector or string 

Misceleanous helper functions 

Checks whether a certain external toolbox exists, or list citation info 

return a struc with configuration settings, or store such settings 

return a struc with configuration settings, or store such settings 

list files recursively in a directory 

flattens an arbitrary array to a dataset structure 

get number of processes available from Matlab parallel processing pool 

applies a function to elements in a cell in parallel 

set the matlab path for CoSMoMVPA 

Shows a progress bar, and time elapsed and expected to complete. 

print or return ASCII contents of a file 

unflattens a dataset from 2 to (1+K) dimensions. 

show a warning message; by default just once for each message 

GUIbased ‘wizard’ to set CoSMoMVPA configuration file 

Developer functions 

give temporary filename that does not exist when this function is called 

notify that a test in the test suite is skipped 

helper function to publish example scripts (for developers) 

run unit and documentation tests 

Notify that test in the test suite is skipped if no external is present 

return system, toolbox and externals information 

Deprecated  to be removed in the future 

Slice a dataset by features (columns) [deprecated] 

Slice a dataset by samples (rows) [deprecated] 

slice and prune a dataset with dimension attributes [deprecated] 

meta classifier that uses feature selection on the training data [deprecated] 

Other functions (possibly experimental) 

compute phase statistics based on Monte Carlo simulation 

subsample a dataset to have an equal number of samples for each target 

return neighborhood where each feature is only neighbor of itself 

compute inverse normal cumulative distribution function 

Compute ranks for the input along the specified dimension 

Compute phase perturbation, or opposition sum or product phase statistic 

compute phase inter trial coherence 

svm classifier wrapper (around fitcsvm) 