skbold.utils package

The utils subpackage contains some extra utilities for machine learning pipelines on fMRI data. Most notably, the CrossvalSplitter class allows for the construction of counterbalanced splits between train- and test-sets (e.g. counterbalancing a certain confounding variable in the train-set and between the train- and test-set).

More information can be found on the homepage of ReadTheDocs.

To do: - extend crossvalsplitter to create 3 groups (train, cv, test)

sort_numbered_list(stat_list)[source]

Sorts a list containing numbers.

Sorts list with paths to statistic files (e.g. COPEs, VARCOPES), which are often sorted wrong (due to single and double digits). This function extracts the numbers from the stat files and sorts the original list accordingly.

Parameters:stat_list (list or str) – list with absolute paths to files
Returns:sorted_list – sorted stat_list
Return type:list of str
class CrossvalSplitter(data, train_size, vars, cb_between_splits=False, binarize=None, include=None, exclude=None, interactions=True, sep='t', index_col=0, ignore=None, iterations=1000)[source]

Bases: object

plot_results(out_dir)[source]
save(out_dir, save_plots=True)[source]
split(verbose=False)[source]
parse_roi_labels(atlas_type='Talairach', lateralized=False, debug=False)[source]

Parses xml-files belonging to FSL atlases.

Parameters:
  • atlas_type (str) – String identifying which atlas needs to be parsed.
  • lateralized (bool) – Whether to use the lateralized version of the atlas (only applicable to HarvardOxford masks)
Returns:

info_dict – Dictionary with indices and coordinates (values) per ROI (keys).

Return type:

dict