############################################################################### from pymri.dataset.datasets import DatasetManager mvpa_directory = '/tmp/Maestro_Project1/GK011RZJA/Right_Hand/mvpa/' print('Loading database from %s' % mvpa_directory) dataset = DatasetManager( mvpa_directory=mvpa_directory, # conditions has to be tuples contrast=(('PlanTool_0', 'PlanTool_5'), ('PlanCtrl_0', 'PlanCtrl_5')), ) dataset_reduced = dataset.feature_reduction( k_features=784, reduction_method='SelectKBest (SKB)', normalize=True, nnadl=True) from pymri.model import FNN # create Classifier cls = FNN(type='FNN simple', input_layer_size=784, hidden_layer_size=46, output_layer_size=2, epochs=100, mini_batch_size=11, learning_rate=3.0, verbose=True)
from pymri.dataset.datasets import DatasetManager mvpa_directory = '/tmp/Maestro_Project1/GK011RZJA/Right_Hand/mvpa' roi_path = '/tmp/Maestro_Project1/GK011RZJA/Right_Hand/mvpa/ROIs/pSMG.nii.gz' runs = 5 volumes = 145 n_time = 0 # Load the dataset print('Loading database from %s' % mvpa_directory) dataset = DatasetManager( mvpa_directory=mvpa_directory, # conditions has to be tuples contrast=(('PlanTool_0', 'PlanTool_5'), ('PlanCtrl_0', 'PlanCtrl_5'))) dataset.feature_reduction(roi_path=roi_path, k_features=784, reduction_method='SKB') training_data, test_data, validation_data = dataset.leave_one_run_out( runs=runs, volumes=volumes, n_time=n_time) print('Saving file to /tmp/fmri.pkl') import pickle pickle.dump((training_data, test_data), open("/tmp/fmri.pkl", "wb"))
path_mask_brain=path_base + 'mask.nii.gz', contrast=(('ExeTool_0', 'ExeTool_5'), ('ExeCtrl_0', 'ExeCtrl_5')), nnadl=True) # load data ds.load_data() ############################################################################### # # CHOOSE ROIs # ############################################################################### # select feature reduction method ds.feature_reduction(roi_selection='SelectKBest', k_features=k_features, normalize=True) # ds.feature_reduction( # roi_selection='/amu/master/nifti/bold/roi_mask_plan.nii.gz', # normalize=True # ) k_features = ds.X_processed.shape[1] print(k_features) ''' roi - 'SelectKBest' xor 'PCA' xor 'RBM' xor 'path_to_mask.nii.gz' NOTICE: the same number of features has to be used for each mask. So if number of features in mask differ then smaller number of feautres is chosen (k). From the more numerous masks only k-greatest is taken.
n_time = 0 # Load the dataset print('Loading database from %s' % mvpa_directory) dataset = DatasetManager( mvpa_directory=mvpa_directory, # conditions has to be tuples contrast=( ('PlanTool_0', 'PlanTool_5'), ('PlanCtrl_0', 'PlanCtrl_5') ) ) dataset.feature_reduction( roi_path=roi_path, k_features=784, reduction_method='SKB' ) training_data, test_data, validation_data = dataset.leave_one_run_out( runs=runs, volumes=volumes, n_time=n_time ) print('Saving file to /tmp/fmri.pkl') import pickle pickle.dump( (training_data, test_data), open("/tmp/fmri.pkl", "wb") )
path_mask_brain=path_base + 'mask.nii.gz', contrast=(('ExeTool_0', 'ExeTool_5'), ('ExeCtrl_0', 'ExeCtrl_5')), nnadl = True ) # load data ds.load_data() ############################################################################### # # CHOOSE ROIs # ############################################################################### # select feature reduction method ds.feature_reduction( roi_selection='SelectKBest', k_features=k_features, normalize=True ) # ds.feature_reduction( # roi_selection='/amu/master/nifti/bold/roi_mask_plan.nii.gz', # normalize=True # ) k_features = ds.X_processed.shape[1] print(k_features) ''' roi - 'SelectKBest' xor 'PCA' xor 'RBM' xor 'path_to_mask.nii.gz' NOTICE: the same number of features has to be used for each mask. So if number of features in mask differ then smaller number of feautres is
# mvpa_directory = '/tmp/Maestro_Project1/GK011RZJA/Right_Hand/mvpa/' mvpa_directory = \ '/amu/master/Maestro_Project1.preprocessed/GK011RZJA/Right_Hand/mvpa/' print('Loading database from %s' % mvpa_directory) dataset = DatasetManager( mvpa_directory=mvpa_directory, # conditions has to be tuples contrast=(('PlanTool_0', 'PlanTool_5'), ('PlanCtrl_0', 'PlanCtrl_5')), ) dataset_reduced = dataset.feature_reduction( k_features=k_features, reduction_method='SelectKBest (SKB)', normalize=True, nnadl=True ) from pymri.model import FNN # create Classifier cls = FNN( type='FNN simple', input_layer_size=k_features, hidden_layer_size=46, output_layer_size=2, epochs=100, # epochs=10, mini_batch_size=11, learning_rate=3.0,