Update cohort.py
Browse files
cohort.py
CHANGED
@@ -56,13 +56,9 @@ def task_cohort(task,mimic_path,path_benchmark, config_path):
|
|
56 |
cohort_output = day_intervals_cohort_v22.extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
57 |
elif version == '1':
|
58 |
cohort_output = day_intervals_cohort.extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
59 |
-
end = time.time()
|
60 |
-
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
61 |
#----------------------------------------------FEATURES-------------------------------------------------------
|
62 |
if data_icu :
|
63 |
feature_selection_icu.feature_icu(cohort_output, version_path,diag_flag,out_flag,chart_flag,proc_flag,med_flag)
|
64 |
-
end = time.time()
|
65 |
-
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
66 |
#----------------------------------------------GROUPING-------------------------------------------------------
|
67 |
group_diag=False
|
68 |
group_med=False
|
@@ -71,13 +67,9 @@ def task_cohort(task,mimic_path,path_benchmark, config_path):
|
|
71 |
if diag_flag:
|
72 |
group_diag=groupingICD
|
73 |
feature_selection_icu.preprocess_features_icu(cohort_output, diag_flag, group_diag,False,False,False,0,0)
|
74 |
-
end = time.time()
|
75 |
-
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
76 |
#----------------------------------------------SUMMARY-------------------------------------------------------
|
77 |
if data_icu:
|
78 |
feature_selection_icu.generate_summary_icu(diag_flag,proc_flag,med_flag,out_flag,chart_flag)
|
79 |
-
end = time.time()
|
80 |
-
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
81 |
#----------------------------------------------FEATURE SELECTION---------------------------------------------
|
82 |
|
83 |
select_diag= config['select_diag']
|
@@ -88,8 +80,6 @@ def task_cohort(task,mimic_path,path_benchmark, config_path):
|
|
88 |
select_chart= config['select_chart']
|
89 |
|
90 |
feature_selection_icu.features_selection_icu(cohort_output, diag_flag,proc_flag,med_flag,out_flag, chart_flag,select_diag,select_med,select_proc,select_out,select_chart)
|
91 |
-
end = time.time()
|
92 |
-
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
93 |
#---------------------------------------CLEANING OF FEATURES-----------------------------------------------
|
94 |
thresh=0
|
95 |
if data_icu:
|
@@ -100,8 +90,6 @@ def task_cohort(task,mimic_path,path_benchmark, config_path):
|
|
100 |
thresh=config['outlier']
|
101 |
left_thresh=config['left_outlier']
|
102 |
feature_selection_icu.preprocess_features_icu(cohort_output, False, False,chart_flag,clean_chart,impute_outlier_chart,thresh,left_thresh)
|
103 |
-
end = time.time()
|
104 |
-
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
105 |
# ---------------------------------------tim-Series Representation--------------------------------------------
|
106 |
if radimp == 'forward fill and mean' :
|
107 |
impute='Mean'
|
@@ -112,6 +100,8 @@ def task_cohort(task,mimic_path,path_benchmark, config_path):
|
|
112 |
|
113 |
if data_icu:
|
114 |
gen=data_generation_icu_modify.Generator(task,cohort_output,data_mort,data_admn,data_los,diag_flag,proc_flag,out_flag,chart_flag,med_flag,impute,include,bucket,predW)
|
|
|
|
|
115 |
print("[============TASK COHORT SUCCESSFULLY CREATED============]")
|
116 |
|
117 |
if __name__ == '__main__':
|
|
|
56 |
cohort_output = day_intervals_cohort_v22.extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
57 |
elif version == '1':
|
58 |
cohort_output = day_intervals_cohort.extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
|
|
|
|
59 |
#----------------------------------------------FEATURES-------------------------------------------------------
|
60 |
if data_icu :
|
61 |
feature_selection_icu.feature_icu(cohort_output, version_path,diag_flag,out_flag,chart_flag,proc_flag,med_flag)
|
|
|
|
|
62 |
#----------------------------------------------GROUPING-------------------------------------------------------
|
63 |
group_diag=False
|
64 |
group_med=False
|
|
|
67 |
if diag_flag:
|
68 |
group_diag=groupingICD
|
69 |
feature_selection_icu.preprocess_features_icu(cohort_output, diag_flag, group_diag,False,False,False,0,0)
|
|
|
|
|
70 |
#----------------------------------------------SUMMARY-------------------------------------------------------
|
71 |
if data_icu:
|
72 |
feature_selection_icu.generate_summary_icu(diag_flag,proc_flag,med_flag,out_flag,chart_flag)
|
|
|
|
|
73 |
#----------------------------------------------FEATURE SELECTION---------------------------------------------
|
74 |
|
75 |
select_diag= config['select_diag']
|
|
|
80 |
select_chart= config['select_chart']
|
81 |
|
82 |
feature_selection_icu.features_selection_icu(cohort_output, diag_flag,proc_flag,med_flag,out_flag, chart_flag,select_diag,select_med,select_proc,select_out,select_chart)
|
|
|
|
|
83 |
#---------------------------------------CLEANING OF FEATURES-----------------------------------------------
|
84 |
thresh=0
|
85 |
if data_icu:
|
|
|
90 |
thresh=config['outlier']
|
91 |
left_thresh=config['left_outlier']
|
92 |
feature_selection_icu.preprocess_features_icu(cohort_output, False, False,chart_flag,clean_chart,impute_outlier_chart,thresh,left_thresh)
|
|
|
|
|
93 |
# ---------------------------------------tim-Series Representation--------------------------------------------
|
94 |
if radimp == 'forward fill and mean' :
|
95 |
impute='Mean'
|
|
|
100 |
|
101 |
if data_icu:
|
102 |
gen=data_generation_icu_modify.Generator(task,cohort_output,data_mort,data_admn,data_los,diag_flag,proc_flag,out_flag,chart_flag,med_flag,impute,include,bucket,predW)
|
103 |
+
end = time.time()
|
104 |
+
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
105 |
print("[============TASK COHORT SUCCESSFULLY CREATED============]")
|
106 |
|
107 |
if __name__ == '__main__':
|