deprecated = False fontsize_1 = 35 fontsize_2 = 27.5 fig_size = (22, 7.5) """ GETTING PATHS """ # trainings stuff folder_paths = [ get_path( results_dir=results_dir, learning_type=learning_type, algorithm_or_model_name=algorithm_or_model_name, epoching=epoching, fold_type=fold_type, n_folds=x, deprecated=deprecated ) for x in n_folds_list ] n_trainings = len(folder_paths) # saving stuff savings_dir = join(dirname(dirname(folder_paths[0])), 'learning_curve') touch_dir(savings_dir) """ SUBJECTS STUFF """
from hgdecode.utils import check_significant_digits """ SET HERE YOUR PARAMETERS """ ival = (-500, 4000) frozen_layers_list = [1, 2, 3, 4, 5, 6, -5, -4, -3, -2, -1] reference = 0 # 0 for ML cross, 1 for DL cross, 2 for TL4 ecc. p_flag = False # if true, it will print p value too. """ GETTING PATHS """ folder_paths = [ get_path(results_dir=None, learning_type='dl', algorithm_or_model_name=None, epoching=ival, fold_type='cross_subject', n_folds=None, deprecated=False) ] folder_paths += [ get_path(results_dir=None, learning_type='dl', algorithm_or_model_name=None, epoching=ival, fold_type='transfer_learning', n_folds=128, deprecated=False) ]
n_folds = 12 deprecated = True balanced_fold = True # metrics parameter label = 'Feet' # Feet, LeftHand, Rest or RightHand metric_type = 'overall' # label or overall metric = 'acc' """ GETTING PATHS """ # getting folder path folder_path = get_path(results_dir=results_dir, learning_type=learning_type, algorithm_or_model_name=algorithm_or_model_name, epoching=epoching, fold_type=fold_type, n_folds=n_folds, deprecated=deprecated, balanced_folds=balanced_fold) # getting file_path file_path = os.path.join(folder_path, 'statistics', 'tables') if metric_type == 'overall': file_path = os.path.join(file_path, metric + '.csv') else: file_path = os.path.join(file_path, label, metric + '.csv') """ COMPUTATION START HERE """ with open(file_path) as f: csv = list(reader(f))
""" TRAINING 1 """ results_dir = None learning_type = 'dl' algorithm_or_model_name = None epoching = '-1000_1000' fold_type_1 = 'single_subject' n_folds_list = [12] # must be a list of integer deprecated = False balanced_folds = True folder_paths_1 = [ get_path(results_dir=results_dir, learning_type=learning_type, algorithm_or_model_name=algorithm_or_model_name, epoching=epoching, fold_type=fold_type_1, n_folds=x, deprecated=deprecated, balanced_folds=balanced_folds) for x in n_folds_list ] """ TRAINING 2 """ results_dir = None learning_type = 'ml' algorithm_or_model_name = None epoching = '-500_4000' fold_type_2 = 'single_subject' n_folds_list = [12] # must be a list of integer deprecated = False balanced_folds = True
ival = (-1000, 1000) """ GETTING CROSS-SUBJECT MODELS DIR PATH ------------------------------------- """ # setting cross_subj_dir_path: data from cross-subj computation are stored here learning_type = 'dl' algorithm_or_model_name = None epoching = ival fold_type = 'cross_subject' n_folds = None deprecated = False cross_subj_dir_path = get_path(results_dir=dirname(results_dir), learning_type=learning_type, algorithm_or_model_name=algorithm_or_model_name, epoching=epoching, fold_type=fold_type, n_folds=n_folds, deprecated=deprecated) """ COMPUTATION ----------- """ for subject_id in subject_ids: # creating a log object subj_results_dir = create_log(results_dir=results_dir, learning_type='dl', algorithm_or_model_name=model_name, subject_id=subject_id, output_on_file=False, use_last_result_directory=False)