<s> """<STR_LIT>""" <EOL> import nilearn . datasets <EOL> atlas = nilearn . datasets . fetch_atlas_msdl ( ) <EOL> dataset = nilearn . datasets . fetch_adhd ( n_subjects = <NUM_LIT:30> ) <EOL> import nilearn . input_data <EOL> masker = nilearn . input_data . NiftiMapsMasker ( <EOL> atlas . maps , resampling_target = "<STR_LIT>" , detrend = True , <EOL> low_pass = None , high_pass = None , t_r = <NUM_LIT> , standardize = False , <EOL> memory = '<STR_LIT>' , memory_level = <NUM_LIT:1> ) <EOL> subjects = [ ] <EOL> sites = [ ] <EOL> adhds = [ ] <EOL> for func_file , phenotypic in zip ( dataset . func , dataset . phenotypic ) : <EOL> if phenotypic [ '<STR_LIT>' ] in [ b'<STR_LIT>' , b'<STR_LIT>' , b'<STR_LIT>' ] : <EOL> time_series = masker . fit_transform ( func_file ) <EOL> subjects . append ( time_series ) <EOL> sites . append ( phenotypic [ '<STR_LIT>' ] ) <EOL> adhds . append ( phenotypic [ '<STR_LIT>' ] ) <EOL> import nilearn . connectome <EOL> kinds = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> individual_connectivity_matrices = { } <EOL> mean_connectivity_matrix = { } <EOL> for kind in kinds : <EOL> conn_measure = nilearn . connectome . ConnectivityMeasure ( kind = kind ) <EOL> individual_connectivity_matrices [ kind ] = conn_measure . fit_transform ( <EOL> subjects ) <EOL> if kind == '<STR_LIT>' : <EOL> mean_connectivity_matrix [ kind ] = conn_measure . mean_ <EOL> else : <EOL> mean_connectivity_matrix [ kind ] = individual_connectivity_matrices [ kind ] . mean ( axis = <NUM_LIT:0> ) <EOL> import numpy as np <EOL> import nilearn . plotting <EOL> labels = atlas . labels <EOL> region_coords = atlas . region_coords <EOL> for kind in kinds : <EOL> nilearn . plotting . plot_connectome ( mean_connectivity_matrix [ kind ] , <EOL> region_coords , edge_threshold = '<STR_LIT>' , <EOL> title = kind ) <EOL> from sklearn . svm import LinearSVC <EOL> from sklearn . cross_validation import StratifiedKFold , cross_val_score <EOL> classes = [ '<STR_LIT>' . format ( site , adhd ) for site , adhd in zip ( sites , adhds ) ] <EOL> print ( '<STR_LIT>' ) <EOL> mean_scores = [ ] <EOL> cv = StratifiedKFold ( classes , n_folds = <NUM_LIT:3> ) <EOL> for kind in kinds : <EOL> svc = LinearSVC ( ) <EOL> coonectivity_coefs = nilearn . connectome . sym_to_vec ( <EOL> individual_connectivity_matrices [ kind ] ) <EOL> cv_scores = cross_val_score ( svc , coonectivity_coefs , <EOL> adhds , cv = cv , scoring = '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' % ( kind , cv_scores . mean ( ) , <EOL> cv_scores . std ( ) ) ) <EOL> mean_scores . append ( cv_scores . mean ( ) ) <EOL> import matplotlib . pyplot as plt <EOL> plt . figure ( figsize = ( <NUM_LIT:6> , <NUM_LIT:4> ) ) <EOL> positions = np . arange ( len ( kinds ) ) * <NUM_LIT> + <NUM_LIT> <EOL> plt . barh ( positions , mean_scores , align = '<STR_LIT>' , height = <NUM_LIT> ) <EOL> yticks = [ kind . replace ( '<STR_LIT:U+0020>' , '<STR_LIT:\n>' ) for kind in kinds ] <EOL> plt . yticks ( positions , yticks ) <EOL> plt . xlabel ( '<STR_LIT>' ) <EOL> plt . grid ( True ) <EOL> plt . tight_layout ( ) <EOL> plt . show ( ) </s>
