-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
60 lines (46 loc) · 1.97 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import subprocess
# ==========================================================
thresholds = [.25, 0.5, 0.75, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
threads = 128
# isDurationThresholded = False
# isFrequencyThresholded = True
# target = "REST10" # or "LTDP10"
cols2drop = ["WASO (min)", "S?W shifts"] #TODO: double check whether we should drop these columns
# ==========================================================
import argparse
argparser = argparse.ArgumentParser()
argparser.add_argument('--isDurationThresholded', action='store_true')
argparser.add_argument('--isFrequencyThresholded', action='store_true')
argparser.add_argument('--target', type=str)
args = argparser.parse_args()
isDurationThresholded = args.isDurationThresholded
isFrequencyThresholded = args.isFrequencyThresholded
target = args.target
print("Generating CSV Data")
for i in range(len(thresholds)):
thresholds[i] = str(thresholds[i])
statcols = ["WASO_interval"]
csvgencommand = ["python", "generate_append_WASO.py"] + ["--thresholds"] + thresholds + ["--cols2drop"] + cols2drop
featimpstatcommand = ["python", "feat_imp_plotter.py"]
if isDurationThresholded:
csvgencommand.append("--duration_threshold")
if isFrequencyThresholded:
csvgencommand.append("--frequency_threshold")
subprocess.run(csvgencommand)
statcols.append("WASO")
statcols.append("SW_shifts")
statfilename = "stats"
if isDurationThresholded:
statfilename += "_wasothresholded"
if isFrequencyThresholded:
statfilename += "_swshiftsthresholded"
statfilename += "_" + target + ".csv"
with open(statfilename, "a") as f:
statcols.append("r^2")
line = ",".join(statcols)
f.write(line + "\n")
threads = str(threads)
for threshold in thresholds:
print("--------- threshold: " + threshold)
subprocess.run(["python", "all_data_analysis.py", "--threads", threads, "--wasoint", threshold, "--targetcol", target])
subprocess.run(featimpstatcommand + ["--wasoint", threshold, "--filename", statfilename, "--target_column", target])