with open(SUBJECT_FILE, 'r') as f: subjects = [x for x in f.read().split('\n') if len(x) == 8] if not TEST and test_subject not in subjects: print("No test subject found, using all subjects...") test_subject = None if TEST: test_subject = subjects[2] subjects = subjects[:3] for clf in CLASSIFIERS: # for i, cval in enumerate([.0001,.001,.01,.1,1.,10.,100.,1000.]): for i, cval in enumerate([.1,1.,10.]): if cval > .0001 and 'elasticnet'==clf: break project = Project(subjects) rfe = SGDRFE(project, NIFTII, BEHAVIORAL, TRS, test_subj=test_subject, lag=LAG, clftype=clf, cut=CUT, C=cval, stop_threshold=STOP_THRESHOLD, descriptor=descriptor) rfe.run() test_sub_name = test_subject if test_subject is not None else 'all_subjects' niftii_name = '_'.join([test_sub_name, str(cval), descriptor, clf, NIFTII_OUT_NAME ]) rfe.save_nii(savename=niftii_name) if TEST: break
# # rfe.save_nii(savename=niftii_name) # if TEST: # break for clf in ['elasticnet']: for max_iter in [5, 25, 100, 200, 500, 1000, 10000]: for l1_ratio in [.001, .05, .15, .25, .5, .75, .85, .95, .999]: try: project = Project(subjects) rfe = SGDRFE(project, NIFTII, BEHAVIORAL, TRS, test_subj=test_subject, lag=LAG, clftype=clf, cut=CUT, stop_threshold=STOP_THRESHOLD, l1_ratio=l1_ratio, max_iter=max_iter, descriptor='dvn') rfe.run() test_sub_name = test_subject if test_subject is not None else 'all_subjects' # niftii_name = '_'.join([test_sub_name, str(cval), clf, NIFTII_OUT_NAME ]) # rfe.save_nii(savename=niftii_name) if TEST: break except: pass
test_subject = subjects[2] subjects = subjects[:3] for clf in CLASSIFIERS: # for i, cval in enumerate([.0001,.001,.01,.1,1.,10.,100.,1000.]): for i, cval in enumerate([.1, 1., 10.]): if cval > .0001 and 'elasticnet' == clf: break project = Project(subjects) rfe = SGDRFE(project, NIFTII, BEHAVIORAL, TRS, test_subj=test_subject, lag=LAG, clftype=clf, cut=CUT, C=cval, stop_threshold=STOP_THRESHOLD, descriptor=descriptor) rfe.run() test_sub_name = test_subject if test_subject is not None else 'all_subjects' niftii_name = '_'.join( [test_sub_name, str(cval), descriptor, clf, NIFTII_OUT_NAME]) rfe.save_nii(savename=niftii_name) if TEST: break
# rfe = SGDRFE(project, NIFTII, BEHAVIORAL, TRS, # test_subj=test_subject, lag=LAG, clftype=clf, cut=CUT, # C=cval, stop_threshold=STOP_THRESHOLD) # rfe.run() # test_sub_name = test_subject if test_subject is not None else 'all_subjects' # # niftii_name = '_'.join([test_sub_name, str(cval), clf, NIFTII_OUT_NAME ]) # # rfe.save_nii(savename=niftii_name) # if TEST: # break for clf in ['elasticnet']: for max_iter in [5, 25, 100, 200, 500, 1000, 10000]: for l1_ratio in [.001, .05, .15, .25, .5, .75, .85, .95,.999]: try: project = Project(subjects) rfe = SGDRFE(project, NIFTII, BEHAVIORAL, TRS, test_subj=test_subject, lag=LAG, clftype=clf, cut=CUT, stop_threshold=STOP_THRESHOLD, l1_ratio=l1_ratio, max_iter=max_iter, descriptor='dvn') rfe.run() test_sub_name = test_subject if test_subject is not None else 'all_subjects' # niftii_name = '_'.join([test_sub_name, str(cval), clf, NIFTII_OUT_NAME ]) # rfe.save_nii(savename=niftii_name) if TEST: break except: pass