-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
73 lines (53 loc) · 2.04 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
from src.classes.ParameterOptimization import ParameterOptimization
from src.classes.Experiment import Experiment
from src.utils.generate_reports import generate_tables, generate_graphs, generate_graph_experiment
def run_parameter_optimization(data, name, models, imputation_methods, iterations_sampler):
print('[INFO] RUNNING PARAMETER OPTIMIZATION]')
optimization = ParameterOptimization(data, name, models, imputation_methods, iterations_sampler)
optimization.run()
print('[INFO] PARAMETER OPTIMIZATION FINISHED')
data_path = f'../results/{data}/{name}'
print('[INFO] GENERATING REPORT')
generate_tables(data_path)
generate_graphs(data_path)
print('[INFO] REPORT GENERATED')
def main(data, name, models, imputation_methods, iterations_sampler, hours_before_onset):
data_path = f'./results/{data}/{name}'
if not os.path.exists(data_path):
run_parameter_optimization(data, name, models, imputation_methods, iterations_sampler)
print('[INFO] STARTING EXPERIMENT')
experiment = Experiment(data, name, hours_before_onset)
experiment.run()
print('[INFO] EXPERIMENT FINISHED')
print('[INFO] GENERATING REPORT')
generate_graph_experiment(data_path)
print('[INFO] REPORT GENERATED')
print('[INFO] EXECUTION FINISHED')
if __name__ == '__main__':
name = 'name_experiment'
hours_before_onset = 7
iterations_sampler = 25
# Mark the chosen ones with 1, others with 0
imputation_methods = {
'carry_forward': 1,
'forward_filling': 1,
'zero_imputation': 1,
'linear_interpolation': 1,
'indicator_imputation': 1,
}
models = {
'TCN': 1,
'CNN': 1,
'MLP': 1,
'GRU': 1,
'LSTM': 1,
'LinearSVC': 1,
'XGBClassifier': 1,
'LogisticRegression': 1,
'AdaBoostClassifier': 1,
'RandomForestClassifier': 1
}
# data = 'MIMIC-III'
data = 'MIMIC-III-Challenge'
main(data, name, models, imputation_methods, iterations_sampler, hours_before_onset)