# measure the sensitivity of gamma for the selected brains and save the text file brain_names = brain_list.keys() results_file_c = 'libsvm_measures_C.txt' results_file_g = 'libsvm_measures_gamma.txt' for brain in brain_names: datasets = load_data(dataset_directory, brain) resultc1, resultc2 = '', '' gamma = brain_list[brain][1] C = brain_list[brain][0] brain_str = brain + '\t' + 'gamma=' + str(gamma) + ', \t' brain_str += 'C=' + str(C) + ', \n' for gammap in gammaps: paramsc = [gamma, gammap, C] dice_c, processed_timec = svm_model2(paramsc, datasets) #if brain == 'LG_0008': # pdb.set_trace() resultc1 += "%.7f" % dice_c + '\t' resultc2 += "%.4f" % processed_timec + '\t' resultc1 += '\n' resultc2 += '\n' if not os.path.exists(results_path + results_file_c): with open(results_path + results_file_c, 'w') as c: c.write(brain_str) c.write(resultc1) c.write(resultc2) else: with open(results_path + results_file_c, 'a') as c:
# measure the sensitivity of gamma for the selected brains and save the text file brain_names = brain_list.keys() results_file_c = 'libsvm_measures_C.txt' results_file_g = 'libsvm_measures_gamma.txt' for brain in brain_names: datasets = load_data(dataset_directory , brain) resultc1, resultc2 = '' ,'' gamma = brain_list[brain][1] C = brain_list[brain][0] brain_str = brain + '\t' + 'gamma=' + str(gamma) + ', \t' brain_str += 'C=' + str(C) + ', \n' for gammap in gammaps: paramsc = [ gamma, gammap,C] dice_c , processed_timec = svm_model2( paramsc, datasets) #if brain == 'LG_0008': # pdb.set_trace() resultc1 += "%.7f" % dice_c + '\t' resultc2 += "%.4f" % processed_timec + '\t' resultc1 += '\n' resultc2 += '\n' if not os.path.exists(results_path + results_file_c): with open(results_path + results_file_c,'w') as c: c.write(brain_str) c.write(resultc1) c.write(resultc2) else: with open(results_path + results_file_c,'a') as c: