|
a |
|
b/analysis/submit.py |
|
|
1 |
import argparse |
|
|
2 |
import os |
|
|
3 |
if __name__ == '__main__': |
|
|
4 |
parser = argparse.ArgumentParser(description="An analyst for quick ML applications.", |
|
|
5 |
add_help=False) |
|
|
6 |
|
|
|
7 |
parser.add_argument('-icd', action='store', dest='CODES',default= |
|
|
8 |
'780.93,733.00,530.85,530.81,493.90,333.94,327.23,288.60,278.00,275.42' |
|
|
9 |
',250.00,250.40,729.1,585.9,571.8,564.1,473.9,472.0,428.9,331.0,285.9,277.7' |
|
|
10 |
',276.1,272.4,272.1,256.4,311',type=str, |
|
|
11 |
help='Comma-separated list of icd-9 codes to run') |
|
|
12 |
parser.add_argument('-ml',action='store',dest='MLS', type=str, |
|
|
13 |
default='LogisticRegression') |
|
|
14 |
parser.add_argument('--short',action='store_false',dest='LONG', default=True) |
|
|
15 |
parser.add_argument('--local',action='store_true',dest='LOCAL', default=False) |
|
|
16 |
parser.add_argument('--norare',action='store_true',dest='NORARE', default=False) |
|
|
17 |
parser.add_argument('-n_trials',action='store',dest='NTRIALS', default=1) |
|
|
18 |
parser.add_argument('-m',action='store',dest='M', default=16000) |
|
|
19 |
parser.add_argument('-cutoffs',action='store',dest='CUTOFFS', type=str, default='') |
|
|
20 |
parser.add_argument('-trials',action='store',dest='TRIALS', type=str, default='') |
|
|
21 |
parser.add_argument('-results',action='store',dest='RDIR', type=str, default='/project/moore/users/lacava/geis-ehr/results') |
|
|
22 |
parser.add_argument('-dir',action='store',dest='DIR', type=str, |
|
|
23 |
default='/project/moore/users/lacava/geis-ehr/phased/') |
|
|
24 |
|
|
|
25 |
args = parser.parse_args() |
|
|
26 |
|
|
|
27 |
if len(args.TRIALS)>0: |
|
|
28 |
args.NTRIALS = len(args.TRIALS.split(',')) |
|
|
29 |
|
|
|
30 |
codes = args.CODES.split(',') |
|
|
31 |
cutoffs = args.CUTOFFS.split(',') |
|
|
32 |
|
|
|
33 |
q = 'moore_long' if args.LONG else 'moore_normal' |
|
|
34 |
|
|
|
35 |
if args.LOCAL: |
|
|
36 |
lpc_options = '' |
|
|
37 |
else: |
|
|
38 |
lpc_options = '--lsf -q {Q} -m {M} -n_jobs 1'.format(Q=q,M=args.M) |
|
|
39 |
|
|
|
40 |
for c in codes: |
|
|
41 |
for delay in cutoffs: |
|
|
42 |
if delay != '': |
|
|
43 |
dataset = args.DIR + 'icd9_' + c + '_cutoff' + delay |
|
|
44 |
else: |
|
|
45 |
dataset = args.DIR + 'icd9_' + c |
|
|
46 |
|
|
|
47 |
if len(args.TRIALS)>0: |
|
|
48 |
cmd = ('python analyze.py {DATA} -ml {ML} -n_trials {NTR} {RARE} ' |
|
|
49 |
'-trials {TR} {LPC}').format(DATA=dataset, |
|
|
50 |
ML=args.MLS, |
|
|
51 |
TR=args.TRIALS, |
|
|
52 |
NTR=args.NTRIALS, |
|
|
53 |
RARE='--norare' if args.NORARE else '', |
|
|
54 |
LPC=lpc_options) |
|
|
55 |
else: |
|
|
56 |
cmd = ('python analyze.py {DATA} -ml {ML} -n_trials {NTR} {RARE} ' |
|
|
57 |
'-results {RDIR} {LPC}').format(DATA=dataset, |
|
|
58 |
ML=args.MLS, |
|
|
59 |
NTR=args.NTRIALS, |
|
|
60 |
RARE='--norare' if args.NORARE else '', |
|
|
61 |
RDIR=args.RDIR, |
|
|
62 |
LPC=lpc_options) |
|
|
63 |
print(cmd) |
|
|
64 |
os.system(cmd) |